From owner-svn-src-all@freebsd.org Sun Feb 18 00:02:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32814F1E779; Sun, 18 Feb 2018 00:02:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D620474631; Sun, 18 Feb 2018 00:02:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D109523DD9; Sun, 18 Feb 2018 00:02:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I029X8050920; Sun, 18 Feb 2018 00:02:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I029fH050919; Sun, 18 Feb 2018 00:02:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802180002.w1I029fH050919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 00:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329483 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 329483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:02:10 -0000 Author: ian Date: Sun Feb 18 00:02:09 2018 New Revision: 329483 URL: https://svnweb.freebsd.org/changeset/base/329483 Log: Fix fallout from the import of fresh dts source files from linux 4.15. It appears that node names no longer include leading zeroes in the @address qualifiers, so we have to search for the nodes involved in interrupt fixup using both flavors of name to be compatible with old and new .dtb files. (You know you're in a bad place when you're applying a workaround to code that exists only as a workaround for another problem.) Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Sat Feb 17 23:54:59 2018 (r329482) +++ head/sys/arm/freescale/imx/imx6_machdep.c Sun Feb 18 00:02:09 2018 (r329483) @@ -88,6 +88,12 @@ static platform_cpu_reset_t imx6_cpu_reset; * per-soc logic. We handle this at platform attach time rather than via the * fdt_fixup_table, because the latter requires matching on the FDT "model" * property, and this applies to all boards including those not yet invented. + * + * This just in: as of the import of dts files from linux 4.15 on 2018-02-10, + * they appear to have applied a new style rule to the dts which forbids leading + * zeroes in the @address qualifiers on node names. Since we have to find those + * nodes by string matching we now have to search for both flavors of each node + * name involved. */ static void fix_fdt_interrupt_data(void) @@ -107,9 +113,13 @@ fix_fdt_interrupt_data(void) /* GIC node may be child of soc node, or appear directly at root. */ gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); + if (gicnode == -1) + gicnode = OF_finddevice("/soc/interrupt-controller@a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); if (gicnode == -1) + gicnode = OF_finddevice("/interrupt-controller@a01000"); + if (gicnode == -1) return; } gicxref = OF_xref_from_node(gicnode); @@ -121,6 +131,8 @@ fix_fdt_interrupt_data(void) gicipar = gicxref; gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000"); + if (gpcnode == -1) + gpcnode = OF_finddevice("/soc/aips-bus@2000000/gpc@20dc000"); if (gpcnode == -1) return; result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar, From owner-svn-src-all@freebsd.org Sun Feb 18 00:17:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2CD3F1FBBF; Sun, 18 Feb 2018 00:17:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82E37750EC; Sun, 18 Feb 2018 00:17:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D79423F8B; Sun, 18 Feb 2018 00:17:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0Hcrr056214; Sun, 18 Feb 2018 00:17:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0HbYG056202; Sun, 18 Feb 2018 00:17:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180017.w1I0HbYG056202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:17:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329484 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/comm... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contri... X-SVN-Commit-Revision: 329484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:17:39 -0000 Author: mav Date: Sun Feb 18 00:17:37 2018 New Revision: 329484 URL: https://svnweb.freebsd.org/changeset/base/329484 Log: MFC r328224: MFV r328220: 8677 Open-Context Channel Programs illumos/illumos-gate@a3b2868063897ff0083dea538f55f9873eec981f https://www.illumos.org/issues/8677 We want to be able to run channel programs outside of synching context. This would greatly improve performance of channel program that just gather information, as we won't have to wait for synching context anymore. This feature should introduce the following: - A new command line flag in "zfs program" to specify our intention to run in open context. - A new flag/option within the channel program ioctl which selects the context. - Appropriate error handling whenever we try a channel program in open-context that contains zfs.sync* expressions. - Documentation for the new feature in the manual pages. Reviewed by: Matt Ahrens Reviewed by: Chris Williamson Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Serapheim Dimitropoulos Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Feb 18 00:17:37 2018 (r329484) @@ -18,6 +18,7 @@ .Nd executes ZFS channel programs .Sh SYNOPSIS .Cm zfs program +.Op Fl n .Op Fl t Ar instruction-limit .Op Fl m Ar memory-limit .Ar pool @@ -45,6 +46,14 @@ will be run on and any attempts to access or modify other pools will cause an error. .Sh OPTIONS .Bl -tag -width "-t" +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from the +zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before a +channel program can complete. .It Fl t Ar instruction-limit Execution time limit, in number of Lua instructions to execute. If a channel program executes more than the specified number of instructions, Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 18 00:17:37 2018 (r329484) @@ -287,6 +287,7 @@ .Op Ar snapshot Ns | Ns Ar filesystem .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3294,6 +3295,7 @@ Display the path's inode change time as the first colu .It Xo .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3316,6 +3318,14 @@ For full documentation of the ZFS channel program inte page for .Xr zfs-program 8 . .Bl -tag -width indent +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from +the zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before +a channel program can complete. .It Fl t Ar timeout Execution time limit, in milliseconds. If a channel program executes for longer than the provided timeout, it will Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Feb 18 00:17:37 2018 (r329484) @@ -345,7 +345,7 @@ get_usage(zfs_help_t idx) case HELP_BOOKMARK: return (gettext("\tbookmark \n")); case HELP_CHANNEL_PROGRAM: - return (gettext("\tprogram [-t ] " + return (gettext("\tprogram [-n] [-t ] " "[-m ] " "[lua args...]\n")); } @@ -7131,11 +7131,12 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *outnvl; uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT; uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT; + boolean_t sync_flag = B_TRUE; zpool_handle_t *zhp; /* check options */ while (-1 != - (c = getopt(argc, argv, "t:(instr-limit)m:(memory-limit)"))) { + (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) { switch (c) { case 't': case 'm': { @@ -7173,6 +7174,10 @@ zfs_do_channel_program(int argc, char **argv) } break; } + case 'n': { + sync_flag = B_FALSE; + break; + } case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -7244,8 +7249,13 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *argnvl = fnvlist_alloc(); fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2); - ret = lzc_channel_program(poolname, progbuf, instrlimit, memlimit, - argnvl, &outnvl); + if (sync_flag) { + ret = lzc_channel_program(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } else { + ret = lzc_channel_program_nosync(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } if (ret != 0) { /* Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Feb 18 00:17:37 2018 (r329484) @@ -2381,7 +2381,7 @@ zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t fnvlist_add_string(argnvl, "dataset", zhp->zfs_name); fnvlist_add_string(argnvl, "property", zfs_prop_to_name(prop)); - error = lzc_channel_program(poolname, program, + error = lzc_channel_program_nosync(poolname, program, 10 * 1000 * 1000, 10 * 1024 * 1024, argnvl, &outnvl); if (error == 0) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sun Feb 18 00:17:37 2018 (r329484) @@ -918,6 +918,25 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **err return (error); } +static int +lzc_channel_program_impl(const char *pool, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + int error; + nvlist_t *args; + + args = fnvlist_alloc(); + fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); + fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); + fnvlist_add_boolean_value(args, ZCP_ARG_SYNC, sync); + fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); + fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); + error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); + fnvlist_free(args); + + return (error); +} + /* * Executes a channel program. * @@ -955,16 +974,26 @@ int lzc_channel_program(const char *pool, const char *program, uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) { - int error; - nvlist_t *args; + return (lzc_channel_program_impl(pool, program, B_TRUE, instrlimit, + memlimit, argnvl, outnvl)); +} - args = fnvlist_alloc(); - fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); - fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); - fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); - fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); - error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); - fnvlist_free(args); - - return (error); +/* + * Executes a read-only channel program. + * + * A read-only channel program works programmatically the same way as a + * normal channel program executed with lzc_channel_program(). The only + * difference is it runs exclusively in open-context and therefore can + * return faster. The downside to that, is that the program cannot change + * on-disk state by calling functions from the zfs.sync submodule. + * + * The return values of this function (and their meaning) are exactly the + * same as the ones described in lzc_channel_program(). + */ +int +lzc_channel_program_nosync(const char *pool, const char *program, + uint64_t timeout, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + return (lzc_channel_program_impl(pool, program, B_FALSE, timeout, + memlimit, argnvl, outnvl)); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Sun Feb 18 00:17:37 2018 (r329484) @@ -86,8 +86,10 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); -int lzc_channel_program(const char *, const char *, uint64_t, uint64_t, - nvlist_t *, nvlist_t **); +int lzc_channel_program(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); +int lzc_channel_program_nosync(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sun Feb 18 00:17:37 2018 (r329484) @@ -542,6 +542,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d nvlist_t *result = fnvlist_alloc(); int error = zcp_eval(nvpair_name(nvlist_next_nvpair(snaps, NULL)), program, + B_TRUE, 0, zfs_lua_max_memlimit, nvlist_next_nvpair(wrapper, NULL), result); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Sun Feb 18 00:17:37 2018 (r329484) @@ -38,20 +38,25 @@ extern uint64_t zfs_lua_max_memlimit; int zcp_argerror(lua_State *, int, const char *, ...); -int zcp_eval(const char *, const char *, uint64_t, uint64_t, nvpair_t *, - nvlist_t *); +int zcp_eval(const char *, const char *, boolean_t, uint64_t, uint64_t, + nvpair_t *, nvlist_t *); int zcp_load_list_lib(lua_State *); int zcp_load_synctask_lib(lua_State *, boolean_t); typedef void (zcp_cleanup_t)(void *); +typedef struct zcp_cleanup_handler { + zcp_cleanup_t *zch_cleanup_func; + void *zch_cleanup_arg; + list_node_t zch_node; +} zcp_cleanup_handler_t; typedef struct zcp_run_info { dsl_pool_t *zri_pool; /* - * An estimate of the total ammount of space consumed by all + * An estimate of the total amount of space consumed by all * synctasks we have successfully performed so far in this * channel program. Used to generate ENOSPC errors for syncfuncs. */ @@ -89,16 +94,21 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* - * The currently registered cleanup function, which will be called - * with the stored argument if a fatal error occurs. + * Boolean indicating whether or not we are running in syncing + * context. */ - zcp_cleanup_t *zri_cleanup; - void *zri_cleanup_arg; + boolean_t zri_sync; + + /* + * List of currently registered cleanup handlers, which will be + * triggered in the event of a fatal error. + */ + list_t zri_cleanup_handlers; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); -void zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); -void zcp_clear_cleanup(lua_State *); +zcp_cleanup_handler_t *zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); +void zcp_deregister_cleanup(lua_State *, zcp_cleanup_handler_t *); void zcp_cleanup(lua_State *); /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Feb 18 00:17:37 2018 (r329484) @@ -137,13 +137,6 @@ typedef struct zcp_eval_arg { uint64_t ea_instrlimit; } zcp_eval_arg_t; -/*ARGSUSED*/ -static int -zcp_eval_check(void *arg, dmu_tx_t *tx) -{ - return (0); -} - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -187,41 +180,45 @@ zcp_argerror(lua_State *state, int narg, const char *m * * If an error occurs, the cleanup function will be invoked exactly once and * then unreigstered. + * + * Returns the registered cleanup handler so the caller can deregister it + * if no error occurs. */ -void +zcp_cleanup_handler_t * zcp_register_cleanup(lua_State *state, zcp_cleanup_t cleanfunc, void *cleanarg) { zcp_run_info_t *ri = zcp_run_info(state); - /* - * A cleanup function should always be explicitly removed before - * installing a new one to avoid accidental clobbering. - */ - ASSERT3P(ri->zri_cleanup, ==, NULL); - ri->zri_cleanup = cleanfunc; - ri->zri_cleanup_arg = cleanarg; + zcp_cleanup_handler_t *zch = kmem_alloc(sizeof (*zch), KM_SLEEP); + zch->zch_cleanup_func = cleanfunc; + zch->zch_cleanup_arg = cleanarg; + list_insert_head(&ri->zri_cleanup_handlers, zch); + + return (zch); } void -zcp_clear_cleanup(lua_State *state) +zcp_deregister_cleanup(lua_State *state, zcp_cleanup_handler_t *zch) { zcp_run_info_t *ri = zcp_run_info(state); - - ri->zri_cleanup = NULL; - ri->zri_cleanup_arg = NULL; + list_remove(&ri->zri_cleanup_handlers, zch); + kmem_free(zch, sizeof (*zch)); } /* - * If it exists, execute the currently set cleanup function then unregister it. + * Execute the currently registered cleanup handlers then free them and + * destroy the handler list. */ void zcp_cleanup(lua_State *state) { zcp_run_info_t *ri = zcp_run_info(state); - if (ri->zri_cleanup != NULL) { - ri->zri_cleanup(ri->zri_cleanup_arg); - zcp_clear_cleanup(state); + for (zcp_cleanup_handler_t *zch = + list_remove_head(&ri->zri_cleanup_handlers); zch != NULL; + zch = list_remove_head(&ri->zri_cleanup_handlers)) { + zch->zch_cleanup_func(zch->zch_cleanup_arg); + kmem_free(zch, sizeof (*zch)); } } @@ -822,19 +819,12 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_sync(void *arg, dmu_tx_t *tx) +zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) { int err; zcp_run_info_t ri; - zcp_eval_arg_t *evalargs = arg; lua_State *state = evalargs->ea_state; - /* - * Open context should have setup the stack to contain: - * 1: Error handler callback - * 2: Script to run (converted to a Lua function) - * 3: nvlist input to function (converted to Lua table or nil) - */ VERIFY3U(3, ==, lua_gettop(state)); /* @@ -847,8 +837,9 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) ri.zri_cred = evalargs->ea_cred; ri.zri_tx = tx; ri.zri_timed_out = B_FALSE; - ri.zri_cleanup = NULL; - ri.zri_cleanup_arg = NULL; + ri.zri_sync = sync; + list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); ri.zri_curinstrs = 0; ri.zri_maxinstrs = evalargs->ea_instrlimit; @@ -885,10 +876,10 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) /* * Remove the error handler callback from the stack. At this point, - * if there is a cleanup function registered, then it was registered - * but never run or removed, which should never occur. + * there shouldn't be any cleanup handler registered in the handler + * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - ASSERT3P(ri.zri_cleanup, ==, NULL); + list_destroy(&ri.zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -970,9 +961,73 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) } } +static void +zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +{ + evalargs->ea_result = SET_ERROR(ECHRNG); + (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + poolname); + zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, + ZCP_RET_ERROR, evalargs); + +} + +static void +zcp_eval_sync(void *arg, dmu_tx_t *tx) +{ + zcp_eval_arg_t *evalargs = arg; + + /* + * Open context should have setup the stack to contain: + * 1: Error handler callback + * 2: Script to run (converted to a Lua function) + * 3: nvlist input to function (converted to Lua table or nil) + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + zcp_eval_impl(tx, B_TRUE, evalargs); +} + +static void +zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +{ + + int error; + dsl_pool_t *dp; + dmu_tx_t *tx; + + /* + * See comment from the same assertion in zcp_eval_sync(). + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + error = dsl_pool_hold(poolname, FTAG, &dp); + if (error != 0) { + zcp_pool_error(evalargs, poolname); + return; + } + + /* + * As we are running in open-context, we have no transaction associated + * with the channel program. At the same time, functions from the + * zfs.check submodule need to be associated with a transaction as + * they are basically dry-runs of their counterparts in the zfs.sync + * submodule. These functions should be able to run in open-context. + * Therefore we create a new transaction that we later abort once + * the channel program has been evaluated. + */ + tx = dmu_tx_create_dd(dp->dp_mos_dir); + + zcp_eval_impl(tx, B_FALSE, evalargs); + + dmu_tx_abort(tx); + + dsl_pool_rele(dp, FTAG); +} + int -zcp_eval(const char *poolname, const char *program, uint64_t instrlimit, - uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) +zcp_eval(const char *poolname, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) { int err; lua_State *state; @@ -1083,9 +1138,14 @@ zcp_eval(const char *poolname, const char *program, ui evalargs.ea_outnvl = outnvl; evalargs.ea_result = 0; - VERIFY0(dsl_sync_task(poolname, zcp_eval_check, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE)); - + if (sync) { + err = dsl_sync_task(poolname, NULL, + zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE); + if (err != 0) + zcp_pool_error(&evalargs, poolname); + } else { + zcp_eval_open(&evalargs, poolname); + } lua_close(state); return (evalargs.ea_result); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Sun Feb 18 00:17:37 2018 (r329484) @@ -55,6 +55,10 @@ typedef struct zcp_synctask_info { * * If 'sync' is false, executes a dry run and returns the error code. * + * If we are not running in syncing context and we are not doing a dry run + * (meaning we are running a zfs.sync function in open-context) then we + * return a Lua error. + * * This function also handles common fatal error cases for channel program * library functions. If a fatal error occurs, err_dsname will be the dataset * name reported in error messages, if supplied. @@ -70,6 +74,13 @@ zcp_sync_task(lua_State *state, dsl_checkfunc_t *check if (!sync) return (err); + if (!ri->zri_sync) { + return (luaL_error(state, "running functions from the zfs.sync " + "submodule requires passing sync=TRUE to " + "lzc_channel_program() (i.e. do not specify the \"-n\" " + "command line argument)")); + } + if (err == 0) { syncfunc(arg, ri->zri_tx); } else if (err == EIO) { @@ -234,6 +245,15 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync zcp_run_info_t *ri = zcp_run_info(state); /* + * On old pools, the ZIL must not be active when a snapshot is created, + * but we can't suspend the ZIL because we're already in syncing + * context. + */ + if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { + return (ENOTSUP); + } + + /* * We only allow for a single snapshot rather than a list, so the * error list output is unnecessary. */ @@ -243,33 +263,23 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync ddsa.ddsa_snaps = fnvlist_alloc(); fnvlist_add_boolean(ddsa.ddsa_snaps, dsname); - /* - * On old pools, the ZIL must not be active when a snapshot is created, - * but we can't suspend the ZIL because we're already in syncing - * context. - */ - if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { - return (ENOTSUP); - } + zcp_cleanup_handler_t *zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, ddsa.ddsa_snaps); err = zcp_sync_task(state, dsl_dataset_snapshot_check, dsl_dataset_snapshot_sync, &ddsa, sync, dsname); + zcp_deregister_cleanup(state, zch); fnvlist_free(ddsa.ddsa_snaps); return (err); } -void -zcp_synctask_wrapper_cleanup(void *arg) -{ - fnvlist_free(arg); -} - static int zcp_synctask_wrapper(lua_State *state) { int err; + zcp_cleanup_handler_t *zch; int num_ret = 1; nvlist_t *err_details = fnvlist_alloc(); @@ -277,7 +287,8 @@ zcp_synctask_wrapper(lua_State *state) * Make sure err_details is properly freed, even if a fatal error is * thrown during the synctask. */ - zcp_register_cleanup(state, &zcp_synctask_wrapper_cleanup, err_details); + zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, err_details); zcp_synctask_info_t *info = lua_touserdata(state, lua_upvalueindex(1)); boolean_t sync = lua_toboolean(state, lua_upvalueindex(2)); @@ -317,7 +328,7 @@ zcp_synctask_wrapper(lua_State *state) num_ret++; } - zcp_clear_cleanup(state); + zcp_deregister_cleanup(state, zch); fnvlist_free(err_details); return (num_ret); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Feb 18 00:17:37 2018 (r329484) @@ -3777,11 +3777,15 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t { char *program; uint64_t instrlimit, memlimit; + boolean_t sync_flag; nvpair_t *nvarg = NULL; if (0 != nvlist_lookup_string(innvl, ZCP_ARG_PROGRAM, &program)) { return (EINVAL); } + if (0 != nvlist_lookup_boolean_value(innvl, ZCP_ARG_SYNC, &sync_flag)) { + sync_flag = B_TRUE; + } if (0 != nvlist_lookup_uint64(innvl, ZCP_ARG_INSTRLIMIT, &instrlimit)) { instrlimit = ZCP_DEFAULT_INSTRLIMIT; } @@ -3797,7 +3801,7 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t if (memlimit == 0 || memlimit > zfs_lua_max_memlimit) return (EINVAL); - return (zcp_eval(poolname, program, instrlimit, memlimit, + return (zcp_eval(poolname, program, sync_flag, instrlimit, memlimit, nvarg, outnvl)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 18 00:02:09 2018 (r329483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 18 00:17:37 2018 (r329484) @@ -984,6 +984,7 @@ typedef enum { */ #define ZCP_ARG_PROGRAM "program" #define ZCP_ARG_ARGLIST "arg" +#define ZCP_ARG_SYNC "sync" #define ZCP_ARG_INSTRLIMIT "instrlimit" #define ZCP_ARG_MEMLIMIT "memlimit" From owner-svn-src-all@freebsd.org Sun Feb 18 00:19:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1B10F1FE19; Sun, 18 Feb 2018 00:19:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5479175389; Sun, 18 Feb 2018 00:19:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F4D423F8F; Sun, 18 Feb 2018 00:19:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0J4ip056421; Sun, 18 Feb 2018 00:19:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0J4Of056419; Sun, 18 Feb 2018 00:19:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180019.w1I0J4Of056419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329485 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:19:05 -0000 Author: mav Date: Sun Feb 18 00:19:03 2018 New Revision: 329485 URL: https://svnweb.freebsd.org/changeset/base/329485 Log: MFC r328226: MFV r328225: 8603 rename zilog's "zl_writer_lock" to "zl_issuer_lock" illumos/illumos-gate@cf07d3da9915c0d22da8f59e991639f819463cef https://www.illumos.org/issues/8603: To help make the ZIL's code more understandable, it was suggested that the zilog_t's "zl_writer_lock" field should be renamed to "zl_issuer_lock". Reviewed by: C Fraire Approved by: Dan McDonald Author: Prakash Surya Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Feb 18 00:17:37 2018 (r329484) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Feb 18 00:19:03 2018 (r329485) @@ -57,9 +57,9 @@ typedef enum { * Log write block (lwb) * * Prior to an lwb being issued to disk via zil_lwb_write_issue(), it - * will be protected by the zilog's "zl_writer_lock". Basically, prior + * will be protected by the zilog's "zl_issuer_lock". Basically, prior * to it being issued, it will only be accessed by the thread that's - * holding the "zl_writer_lock". After the lwb is issued, the zilog's + * holding the "zl_issuer_lock". After the lwb is issued, the zilog's * "zl_lock" is used to protect the lwb against concurrent access. */ typedef struct lwb { @@ -91,10 +91,10 @@ typedef struct lwb { * * The "zcw_lock" field is used to protect the commit waiter against * concurrent access. This lock is often acquired while already holding - * the zilog's "zl_writer_lock" or "zl_lock"; see the functions + * the zilog's "zl_issuer_lock" or "zl_lock"; see the functions * zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples * of this. Thus, one must be careful not to acquire the - * "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock"; + * "zl_issuer_lock" or "zl_lock" when already holding the "zcw_lock"; * e.g. see the zil_commit_waiter_timeout() function. */ typedef struct zil_commit_waiter { @@ -161,7 +161,7 @@ struct zilog { uint8_t zl_keep_first; /* keep first log block in destroy */ uint8_t zl_replay; /* replaying records while set */ uint8_t zl_stop_sync; /* for debugging */ - kmutex_t zl_writer_lock; /* single writer, per ZIL, at a time */ + kmutex_t zl_issuer_lock; /* single writer, per ZIL, at a time */ uint8_t zl_logbias; /* latency or throughput */ uint8_t zl_sync; /* synchronous or asynchronous */ int zl_parse_error; /* last zil_parse() error */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Feb 18 00:17:37 2018 (r329484) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Feb 18 00:19:03 2018 (r329485) @@ -1104,7 +1104,7 @@ zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) zbookmark_phys_t zb; zio_priority_t prio; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); EQUIV(lwb->lwb_root_zio == NULL, lwb->lwb_state == LWB_STATE_CLOSED); EQUIV(lwb->lwb_root_zio != NULL, lwb->lwb_state == LWB_STATE_OPENED); @@ -1201,7 +1201,7 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) int i, error; boolean_t slog; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb->lwb_root_zio, !=, NULL); ASSERT3P(lwb->lwb_write_zio, !=, NULL); ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); @@ -1335,7 +1335,7 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) char *lr_buf; uint64_t dlen, dnow, lwb_sp, reclen, txg; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); ASSERT3P(lwb->lwb_buf, !=, NULL); @@ -1751,7 +1751,7 @@ zil_get_commit_list(zilog_t *zilog) uint64_t otxg, txg; list_t *commit_list = &zilog->zl_itx_commit_list; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ otxg = ZILTEST_TXG; @@ -1858,7 +1858,7 @@ zil_prune_commit_list(zilog_t *zilog) { itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); while (itx = list_head(&zilog->zl_itx_commit_list)) { lr_t *lrc = &itx->itx_lr; @@ -1908,12 +1908,12 @@ zil_commit_writer_stall(zilog_t *zilog) * crash (because the previous lwb on-disk would not point to * it). * - * We must hold the zilog's zl_writer_lock while we do this, to + * We must hold the zilog's zl_issuer_lock while we do this, to * ensure no new threads enter zil_process_commit_list() until * all lwb's in the zl_lwb_list have been synced and freed * (which is achieved via the txg_wait_synced() call). */ - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); txg_wait_synced(zilog->zl_dmu_pool, 0); ASSERT3P(list_tail(&zilog->zl_lwb_list), ==, NULL); } @@ -1932,7 +1932,7 @@ zil_process_commit_list(zilog_t *zilog) lwb_t *lwb; itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); /* * Return if there's nothing to commit before we dirty the fs by @@ -2102,17 +2102,17 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); if (zcw->zcw_lwb != NULL || zcw->zcw_done) { /* * It's possible that, while we were waiting to acquire - * the "zl_writer_lock", another thread committed this + * the "zl_issuer_lock", another thread committed this * waiter to an lwb. If that occurs, we bail out early, * without processing any of the zilog's queue of itxs. * * On certain workloads and system configurations, the - * "zl_writer_lock" can become highly contended. In an + * "zl_issuer_lock" can become highly contended. In an * attempt to reduce this contention, we immediately drop * the lock if the waiter has already been processed. * @@ -2129,13 +2129,13 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t zil_process_commit_list(zilog); out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); } static void zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_waiter_t *zcw) { - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); ASSERT3B(zcw->zcw_done, ==, B_FALSE); @@ -2147,7 +2147,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w * If the lwb has already been issued by another thread, we can * immediately return since there's no work to be done (the * point of this function is to issue the lwb). Additionally, we - * do this prior to acquiring the zl_writer_lock, to avoid + * do this prior to acquiring the zl_issuer_lock, to avoid * acquiring it when it's not necessary to do so. */ if (lwb->lwb_state == LWB_STATE_ISSUED || @@ -2156,13 +2156,13 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * In order to call zil_lwb_write_issue() we must hold the - * zilog's "zl_writer_lock". We can't simply acquire that lock, + * zilog's "zl_issuer_lock". We can't simply acquire that lock, * since we're already holding the commit waiter's "zcw_lock", * and those two locks are aquired in the opposite order * elsewhere. */ mutex_exit(&zcw->zcw_lock); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); mutex_enter(&zcw->zcw_lock); /* @@ -2180,7 +2180,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * We've already checked this above, but since we hadn't - * acquired the zilog's zl_writer_lock, we have to perform this + * acquired the zilog's zl_issuer_lock, we have to perform this * check a second time while holding the lock. We can't call * zil_lwb_write_issue() if the lwb had already been issued. */ @@ -2243,7 +2243,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w } out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); } @@ -2270,7 +2270,7 @@ static void zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t *zcw) { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); @@ -2531,7 +2531,7 @@ zil_commit_itx_assign(zilog_t *zilog, zil_commit_waite * on two fundamental concepts: * * 1. The creation and issuance of lwb zio's is protected by - * the zilog's "zl_writer_lock", which ensures only a single + * the zilog's "zl_issuer_lock", which ensures only a single * thread is creating and/or issuing lwb's at a time * 2. The "previous" lwb is a child of the "current" lwb * (leveraging the zio parent-child depenency graph) @@ -2780,7 +2780,7 @@ zil_alloc(objset_t *os, zil_header_t *zh_phys) zilog->zl_last_lwb_latency = 0; mutex_init(&zilog->zl_lock, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&zilog->zl_writer_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&zilog->zl_issuer_lock, NULL, MUTEX_DEFAULT, NULL); for (int i = 0; i < TXG_SIZE; i++) { mutex_init(&zilog->zl_itxg[i].itxg_lock, NULL, @@ -2825,7 +2825,7 @@ zil_free(zilog_t *zilog) mutex_destroy(&zilog->zl_itxg[i].itxg_lock); } - mutex_destroy(&zilog->zl_writer_lock); + mutex_destroy(&zilog->zl_issuer_lock); mutex_destroy(&zilog->zl_lock); cv_destroy(&zilog->zl_cv_suspend); From owner-svn-src-all@freebsd.org Sun Feb 18 00:20:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4CF1F1FFBD; Sun, 18 Feb 2018 00:20:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 586B275514; Sun, 18 Feb 2018 00:20:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 530DA23F97; Sun, 18 Feb 2018 00:20:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0K7ra056540; Sun, 18 Feb 2018 00:20:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0K6SA056535; Sun, 18 Feb 2018 00:20:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180020.w1I0K6SA056535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329486 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:20:08 -0000 Author: mav Date: Sun Feb 18 00:20:06 2018 New Revision: 329486 URL: https://svnweb.freebsd.org/changeset/base/329486 Log: MFC r328228: MFV r328227: 8909 8585 can cause a use-after-free kernel panic illumos/illumos-gate@94ddd0900a8838f62bba15e270649a42f4ef9f81 https://www.illumos.org/issues/8909: There's a race condition that exists if `zil_free_lwb` races with either `zil_commit_waiter_timeout` and/or `zil_lwb_flush_vdevs_done`. Here's an example panic due to this bug: > ::status debugging crash dump vmcore.0 (64-bit) from ip-10-110-205-40 operating system: 5.11 dlpx-5.2.2.0_2017-12-04-17-28-32b6ba51fb (i86pc) image uuid: 4af0edfb-e58e-6ed8-cafc-d3e9167c7513 panic message: BAD TRAP: type=e (#pf Page fault) rp=ffffff0010555970 addr=60 occurred in mo dule "zfs" due to a NULL pointer dereference dump content: kernel pages only > $c zio_shrink+0x12() zil_lwb_write_issue+0x30d(ffffff03dcd15cc0, ffffff03e0730e20) zil_commit_waiter_timeout+0xa2(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit_waiter+0xf3(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit+0x80(ffffff03dcd15cc0, 9a9) zfs_write+0xc34(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) fop_write+0x5b(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) write+0x250(42, fffffd7ff4832000, 2000) sys_syscall+0x177() If there's an outstanding lwb that's in `zil_commit_waiter_timeout` waiting to timeout, waiting on it's waiter's CV, we must be sure not to call `zil_free_lwb`. If we end up calling `zil_free_lwb`, then that LWB may be freed and can result in a use-after-free situation where the stale lwb pointer stored in the `zil_commit_waiter_t` structure of the thread waiting on the waiter's CV is used. A similar situation can occur if an lwb is issued to disk, and thus in the `LWB_STATE_ISSUED` state, and `zil_free_lwb` is called while the disk is servicing that lwb. In this situation, the lwb will be freed by `zil_free_lwb`, which will result in a use-after-free situation when the lwb's zio completes, and `zil_lwb_flush_vdevs_done` is called. This race condition is prevented in `zil_close` by calling `zil_commit` before `zil_free_lwb` is called, which will ensure all outstanding (i.e. all lwb's in the `LWB_STATE_OPEN` and/or `LWB_STATE_ISSUED` states) reach the `LWB_STATE_DONE` state before the lwb's are freed (`zil_commit` will not return untill all the lwb's are `LWB_STATE_DONE`). Further, this race condition is prevented in `zil_sync` by only calling `zil_free_lwb` for lwb's that do not have their `lwb_buf` pointer set. All lwb's not in the `LWB_STATE_DONE` state will have a non-null value for this pointer; the pointer is only cleared in `zil_lwb_flush_vdevs_done`, at which point the lwb's state will be changed to `LWB_STATE_DONE`. This race is present in `zil_suspend`, leading to this bug. At first glance, it would appear as though this would not be true because `zil_suspend` will call `zil_commit`, just like `zil_close`, but the problem is that `zil_suspend` will set the zilog's `zl_suspend` field prior to calling `zil_commit`. Further, in `zil_commit`, if `zl_suspend` is set, `zil_commit` will take a special branch of logic and use `txg_wait_synced` instead of performing the normal `zil_commit` logic. This call to `txg_wait_synced` might be good enough for the data to reach disk safely before it returns, but it does not ensure that all outstanding lwb's reach the `LWB_STATE_DONE` state before it returns. This is because, if there's an lwb "stuck" in `zil_commit_waiter_timeout`, waiting for it's lwb to timeout, it will maintain a non-null value for it's `lwb_buf` field and thus `zil_sync` will not free that lwb. Thus, even though the lwb's data is already on disk, the lwb will be left lingering, waiting on the CV, and will eventually timeout and be issued to disk even though the write is unnesseary. So, after `zil_commit` is called from `zil_suspend`, we incorrectly assume that there are not outstanding lwb's, and proceed to free all lwb's found on the zilog's lwb list. As a result, we free the lwb that will later be used `zil_commit_waiter_timeout`. Reviewed by: John Kennedy Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Brad Lewis Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Prakash Surya Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sun Feb 18 00:19:03 2018 (r329485) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sun Feb 18 00:20:06 2018 (r329486) @@ -418,6 +418,7 @@ extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, extern void zil_async_to_sync(zilog_t *zilog, uint64_t oid); extern void zil_commit(zilog_t *zilog, uint64_t oid); +extern void zil_commit_impl(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); extern int zil_claim(struct dsl_pool *dp, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Feb 18 00:19:03 2018 (r329485) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Feb 18 00:20:06 2018 (r329486) @@ -37,13 +37,38 @@ extern "C" { #endif /* - * Possbile states for a given lwb structure. An lwb will start out in - * the "closed" state, and then transition to the "opened" state via a - * call to zil_lwb_write_open(). After the lwb is "open", it can - * transition into the "issued" state via zil_lwb_write_issue(). After - * the lwb's zio completes, and the vdev's are flushed, the lwb will - * transition into the "done" state via zil_lwb_write_done(), and the - * structure eventually freed. + * Possbile states for a given lwb structure. + * + * An lwb will start out in the "closed" state, and then transition to + * the "opened" state via a call to zil_lwb_write_open(). When + * transitioning from "closed" to "opened" the zilog's "zl_issuer_lock" + * must be held. + * + * After the lwb is "opened", it can transition into the "issued" state + * via zil_lwb_write_issue(). Again, the zilog's "zl_issuer_lock" must + * be held when making this transition. + * + * After the lwb's zio completes, and the vdev's are flushed, the lwb + * will transition into the "done" state via zil_lwb_write_done(). When + * transitioning from "issued" to "done", the zilog's "zl_lock" must be + * held, *not* the "zl_issuer_lock". + * + * The zilog's "zl_issuer_lock" can become heavily contended in certain + * workloads, so we specifically avoid acquiring that lock when + * transitioning an lwb from "issued" to "done". This allows us to avoid + * having to acquire the "zl_issuer_lock" for each lwb ZIO completion, + * which would have added more lock contention on an already heavily + * contended lock. + * + * Additionally, correctness when reading an lwb's state is often + * acheived by exploiting the fact that these state transitions occur in + * this specific order; i.e. "closed" to "opened" to "issued" to "done". + * + * Thus, if an lwb is in the "closed" or "opened" state, holding the + * "zl_issuer_lock" will prevent a concurrent thread from transitioning + * that lwb to the "issued" state. Likewise, if an lwb is already in the + * "issued" state, holding the "zl_lock" will prevent a concurrent + * thread from transitioning that lwb to the "done" state. */ typedef enum { LWB_STATE_CLOSED, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Feb 18 00:19:03 2018 (r329485) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Feb 18 00:20:06 2018 (r329486) @@ -592,7 +592,6 @@ extern enum zio_checksum zio_checksum_dedup_select(spa extern enum zio_compress zio_compress_select(spa_t *spa, enum zio_compress child, enum zio_compress parent); -extern void zio_cancel(zio_t *zio); extern void zio_suspend(spa_t *spa, zio_t *zio); extern int zio_resume(spa_t *spa); extern void zio_resume_wait(spa_t *spa); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Feb 18 00:19:03 2018 (r329485) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Feb 18 00:20:06 2018 (r329486) @@ -511,7 +511,7 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); + VERIFY(list_is_empty(&lwb->lwb_waiters)); return (lwb); } @@ -521,31 +521,13 @@ zil_free_lwb(zilog_t *zilog, lwb_t *lwb) { ASSERT(MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); - - if (lwb->lwb_state == LWB_STATE_OPENED) { - avl_tree_t *t = &lwb->lwb_vdev_tree; - void *cookie = NULL; - zil_vdev_node_t *zv; - - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) - kmem_free(zv, sizeof (*zv)); - - ASSERT3P(lwb->lwb_root_zio, !=, NULL); - ASSERT3P(lwb->lwb_write_zio, !=, NULL); - - zio_cancel(lwb->lwb_root_zio); - zio_cancel(lwb->lwb_write_zio); - - lwb->lwb_root_zio = NULL; - lwb->lwb_write_zio = NULL; - } else { - ASSERT3S(lwb->lwb_state, !=, LWB_STATE_ISSUED); - } - + VERIFY(list_is_empty(&lwb->lwb_waiters)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); ASSERT3P(lwb->lwb_write_zio, ==, NULL); ASSERT3P(lwb->lwb_root_zio, ==, NULL); + ASSERT3U(lwb->lwb_max_txg, <=, spa_syncing_txg(zilog->zl_spa)); + ASSERT(lwb->lwb_state == LWB_STATE_CLOSED || + lwb->lwb_state == LWB_STATE_DONE); /* * Clear the zilog's field to indicate this lwb is no longer @@ -892,6 +874,12 @@ zil_commit_waiter_skip(zil_commit_waiter_t *zcw) static void zil_commit_waiter_link_lwb(zil_commit_waiter_t *zcw, lwb_t *lwb) { + /* + * The lwb_waiters field of the lwb is protected by the zilog's + * zl_lock, thus it must be held when calling this function. + */ + ASSERT(MUTEX_HELD(&lwb->lwb_zilog->zl_lock)); + mutex_enter(&zcw->zcw_lock); ASSERT(!list_link_active(&zcw->zcw_node)); ASSERT3P(zcw->zcw_lwb, ==, NULL); @@ -1357,8 +1345,10 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) * For more details, see the comment above zil_commit(). */ if (lrc->lrc_txtype == TX_COMMIT) { + mutex_enter(&zilog->zl_lock); zil_commit_waiter_link_lwb(itx->itx_private, lwb); itx->itx_private = NULL; + mutex_exit(&zilog->zl_lock); return (lwb); } @@ -1966,16 +1956,54 @@ zil_process_commit_list(zilog_t *zilog) zilog_t *, zilog, itx_t *, itx); } - /* - * This is inherently racy and may result in us writing - * out a log block for a txg that was just synced. This - * is ok since we'll end cleaning up that log block the - * next time we call zil_sync(). - */ boolean_t synced = txg <= spa_last_synced_txg(spa); boolean_t frozen = txg > spa_freeze_txg(spa); - if (!synced || frozen) { + /* + * If the txg of this itx has already been synced out, then + * we don't need to commit this itx to an lwb. This is + * because the data of this itx will have already been + * written to the main pool. This is inherently racy, and + * it's still ok to commit an itx whose txg has already + * been synced; this will result in a write that's + * unnecessary, but will do no harm. + * + * With that said, we always want to commit TX_COMMIT itxs + * to an lwb, regardless of whether or not that itx's txg + * has been synced out. We do this to ensure any OPENED lwb + * will always have at least one zil_commit_waiter_t linked + * to the lwb. + * + * As a counter-example, if we skipped TX_COMMIT itx's + * whose txg had already been synced, the following + * situation could occur if we happened to be racing with + * spa_sync: + * + * 1. we commit a non-TX_COMMIT itx to an lwb, where the + * itx's txg is 10 and the last synced txg is 9. + * 2. spa_sync finishes syncing out txg 10. + * 3. we move to the next itx in the list, it's a TX_COMMIT + * whose txg is 10, so we skip it rather than committing + * it to the lwb used in (1). + * + * If the itx that is skipped in (3) is the last TX_COMMIT + * itx in the commit list, than it's possible for the lwb + * used in (1) to remain in the OPENED state indefinitely. + * + * To prevent the above scenario from occuring, ensuring + * that once an lwb is OPENED it will transition to ISSUED + * and eventually DONE, we always commit TX_COMMIT itx's to + * an lwb here, even if that itx's txg has already been + * synced. + * + * Finally, if the pool is frozen, we _always_ commit the + * itx. The point of freezing the pool is to prevent data + * from being written to the main pool via spa_sync, and + * instead rely solely on the ZIL to persistently store the + * data; i.e. when the pool is frozen, the last synced txg + * value can't be trusted. + */ + if (frozen || !synced || lrc->lrc_txtype == TX_COMMIT) { if (lwb != NULL) { lwb = zil_lwb_commit(zilog, itx, lwb); } else if (lrc->lrc_txtype == TX_COMMIT) { @@ -1983,22 +2011,6 @@ zil_process_commit_list(zilog_t *zilog) zil_commit_waiter_link_nolwb( itx->itx_private, &nolwb_waiters); } - } else if (lrc->lrc_txtype == TX_COMMIT) { - ASSERT3B(synced, ==, B_TRUE); - ASSERT3B(frozen, ==, B_FALSE); - - /* - * If this is a commit itx, then there will be a - * thread that is either: already waiting for - * it, or soon will be waiting. - * - * This itx has already been committed to disk - * via spa_sync() so we don't bother committing - * it to an lwb. As a result, we cannot use the - * lwb zio callback to signal the waiter and - * mark it as done, so we must do that here. - */ - zil_commit_waiter_skip(itx->itx_private); } list_remove(&zilog->zl_itx_commit_list, itx); @@ -2100,7 +2112,6 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zilog->zl_issuer_lock); @@ -2179,10 +2190,24 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w ASSERT3P(lwb, ==, zcw->zcw_lwb); /* - * We've already checked this above, but since we hadn't - * acquired the zilog's zl_issuer_lock, we have to perform this - * check a second time while holding the lock. We can't call + * We've already checked this above, but since we hadn't acquired + * the zilog's zl_issuer_lock, we have to perform this check a + * second time while holding the lock. + * + * We don't need to hold the zl_lock since the lwb cannot transition + * from OPENED to ISSUED while we hold the zl_issuer_lock. The lwb + * _can_ transition from ISSUED to DONE, but it's OK to race with + * that transition since we treat the lwb the same, whether it's in + * the ISSUED or DONE states. + * + * The important thing, is we treat the lwb differently depending on + * if it's ISSUED or OPENED, and block any other threads that might + * attempt to issue this lwb. For that reason we hold the + * zl_issuer_lock when checking the lwb_state; we must not call * zil_lwb_write_issue() if the lwb had already been issued. + * + * See the comment above the lwb_state_t structure definition for + * more details on the lwb states, and locking requirements. */ if (lwb->lwb_state == LWB_STATE_ISSUED || lwb->lwb_state == LWB_STATE_DONE) @@ -2272,7 +2297,6 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zcw->zcw_lock); @@ -2589,6 +2613,12 @@ zil_commit(zilog_t *zilog, uint64_t foid) return; } + zil_commit_impl(zilog, foid); +} + +void +zil_commit_impl(zilog_t *zilog, uint64_t foid) +{ /* * Move the "async" itxs for the specified foid to the "sync" * queues, such that they will be later committed (or skipped) @@ -3001,7 +3031,22 @@ zil_suspend(const char *osname, void **cookiep) zilog->zl_suspending = B_TRUE; mutex_exit(&zilog->zl_lock); - zil_commit(zilog, 0); + /* + * We need to use zil_commit_impl to ensure we wait for all + * LWB_STATE_OPENED and LWB_STATE_ISSUED lwb's to be committed + * to disk before proceeding. If we used zil_commit instead, it + * would just call txg_wait_synced(), because zl_suspend is set. + * txg_wait_synced() doesn't wait for these lwb's to be + * LWB_STATE_DONE before returning. + */ + zil_commit_impl(zilog, 0); + + /* + * Now that we've ensured all lwb's are LWB_STATE_DONE, we use + * txg_wait_synced() to ensure the data from the zilog has + * migrated to the main pool before calling zil_destroy(). + */ + txg_wait_synced(zilog->zl_dmu_pool, 0); zil_destroy(zilog, B_FALSE); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Feb 18 00:19:03 2018 (r329485) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Feb 18 00:20:06 2018 (r329486) @@ -1815,20 +1815,6 @@ zio_reexecute(zio_t *pio) } void -zio_cancel(zio_t *zio) -{ - /* - * Disallow cancellation of a zio that's already been issued. - */ - VERIFY3P(zio->io_executor, ==, NULL); - - zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; - zio->io_done = NULL; - - zio_nowait(zio); -} - -void zio_suspend(spa_t *spa, zio_t *zio) { if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC) From owner-svn-src-all@freebsd.org Sun Feb 18 00:20:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F390F200EA; Sun, 18 Feb 2018 00:20:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1185C7569C; Sun, 18 Feb 2018 00:20:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C48B23FAE; Sun, 18 Feb 2018 00:20:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0Kk1q056616; Sun, 18 Feb 2018 00:20:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0Kknk056615; Sun, 18 Feb 2018 00:20:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180020.w1I0Kknk056615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329487 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:20:47 -0000 Author: mav Date: Sun Feb 18 00:20:46 2018 New Revision: 329487 URL: https://svnweb.freebsd.org/changeset/base/329487 Log: MFC r328230: MFV r328229: 8930 zfs_zinactive: do not remove the node if the filesystem is readonly illumos/illumos-gate@93c618e0f4932dc0bb9a9c90d8c4a5d029de5797 https://www.illumos.org/issues/8930: We normally remove an unlinked node when its last user goes away and the node becomes inactive. However, we should not do that if the filesystem is mounted read-only including the case where it has its readonly property set. The node will remain on the unlinked queue, so it will not be leaked. One particular scenario is when we receive an incremental stream into a mounted read-only filesystem and that stream contains an unlinked file (still on the unlinked queue). If that file is opened before the receive and some time later after the receive it becomes inactive we would remove it and, thus, modify the read-only filesystem. As a result, the filesystem would diverge from its source and further incremental receives would not be possible (without forcing a rollback). Another related scenario, that may or may not be possible depending on an OS / VFS policy, is when an open file is unlinked, then the filesystem is remounted read-only, and then the file is closed. Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Feb 18 00:20:06 2018 (r329486) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Feb 18 00:20:46 2018 (r329487) @@ -1336,12 +1336,24 @@ zfs_rezget(znode_t *zp) return (EIO); } - zp->z_unlinked = (zp->z_links == 0); zp->z_blksz = doi.doi_data_block_size; vn_pages_remove(vp, 0, 0); if (zp->z_size != size) vnode_pager_setsize(vp, zp->z_size); + /* + * If the file has zero links, then it has been unlinked on the send + * side and it must be in the received unlinked set. + * We call zfs_znode_dmu_fini() now to prevent any accesses to the + * stale data and to prevent automatical removal of the file in + * zfs_zinactive(). The file will be removed either when it is removed + * on the send side and the next incremental stream is received or + * when the unlinked set gets processed. + */ + zp->z_unlinked = (zp->z_links == 0); + if (zp->z_unlinked) + zfs_znode_dmu_fini(zp); + ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); return (0); @@ -1380,13 +1392,20 @@ zfs_zinactive(znode_t *zp) ZFS_OBJ_HOLD_ENTER(zfsvfs, z_id); /* - * If this was the last reference to a file with no links, - * remove the file from the file system. + * If this was the last reference to a file with no links, remove + * the file from the file system unless the file system is mounted + * read-only. That can happen, for example, if the file system was + * originally read-write, the file was opened, then unlinked and + * the file system was made read-only before the file was finally + * closed. The file will remain in the unlinked set. */ if (zp->z_unlinked) { - ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - zfs_rmnode(zp); - return; + ASSERT(!zfsvfs->z_issnap); + if ((zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) == 0) { + ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); + zfs_rmnode(zp); + return; + } } zfs_znode_dmu_fini(zp); From owner-svn-src-all@freebsd.org Sun Feb 18 00:21:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 011F2F20299; Sun, 18 Feb 2018 00:21:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB4F2758A4; Sun, 18 Feb 2018 00:21:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A612B23FF0; Sun, 18 Feb 2018 00:21:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0Lgux058975; Sun, 18 Feb 2018 00:21:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0Lg8N058974; Sun, 18 Feb 2018 00:21:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180021.w1I0Lg8N058974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329488 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:21:43 -0000 Author: mav Date: Sun Feb 18 00:21:42 2018 New Revision: 329488 URL: https://svnweb.freebsd.org/changeset/base/329488 Log: MFC r328232: MFV r328231: 8897 zpool online -e fails assertion when run on non-leaf vdevs illumos/illumos-gate@9a551dd645b478816cb11251b19f5034d885bf01 https://www.illumos.org/issues/8897: # zpool online -e test mirror-1 Assertion failed: nvlist_lookup_string(tgt, "path", &pathname) == 0, file ../common/libzfs_pool.c, line 2558, function zpool_vdev_online Abort (core dumped) Not a big deal per se, but should be handled gracefully, same way as 'offline' and 'online' without '-e'. Also reported as: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221408 Reviewed by: Toomas Soome Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Yuri Pankov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:20:46 2018 (r329487) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:21:42 2018 (r329488) @@ -2419,6 +2419,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat { zfs_cmd_t zc = { 0 }; char msg[1024]; + char *pathname; nvlist_t *tgt; boolean_t avail_spare, l2cache, islog; libzfs_handle_t *hdl = zhp->zpool_hdl; @@ -2441,15 +2442,13 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat if (avail_spare) return (zfs_error(hdl, EZFS_ISSPARE, msg)); - if (flags & ZFS_ONLINE_EXPAND || - zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) { - char *pathname = NULL; + if ((flags & ZFS_ONLINE_EXPAND || + zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) && + nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) { uint64_t wholedisk = 0; (void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk); - verify(nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, - &pathname) == 0); /* * XXX - L2ARC 1.0 devices can't support expansion. From owner-svn-src-all@freebsd.org Sun Feb 18 00:23:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A763F205DD; Sun, 18 Feb 2018 00:23:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CFE675C14; Sun, 18 Feb 2018 00:23:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EEB024128; Sun, 18 Feb 2018 00:23:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0NCbr061273; Sun, 18 Feb 2018 00:23:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0NCGr061271; Sun, 18 Feb 2018 00:23:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180023.w1I0NCGr061271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329489 - in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Commit-Revision: 329489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:23:13 -0000 Author: mav Date: Sun Feb 18 00:23:12 2018 New Revision: 329489 URL: https://svnweb.freebsd.org/changeset/base/329489 Log: MFC r328234: MFV r328233: 8898 creating fs with checksum=skein on the boot pools fails ungracefully illumos/illumos-gate@9fa2266d9a78b8366e1cd2d5f050e8b5e37d558c https://www.illumos.org/issues/8898: # zfs create -o checksum=skein rpool/test internal error: Result too large Abort (core dumped) Not a big deal per se, but should be handled correctly. Reviewed by: Toomas Soome Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Yuri Pankov PR: 222199 Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 18 00:21:42 2018 (r329488) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 18 00:23:12 2018 (r329489) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 16, 2016 +.Dd December 6, 2017 .Dt ZFS 8 .Os .Sh NAME @@ -974,6 +974,10 @@ Please see for more information on these algorithms. .Pp Changing this property affects only newly-written data. +.Pp +Salted checksum algorithms +.Pq Cm edonr , skein +are currently not supported for any filesystem on the boot pools. .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle | Cm lz4 Controls the compression algorithm used for this dataset. Setting compression to Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Feb 18 00:21:42 2018 (r329488) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Feb 18 00:23:12 2018 (r329489) @@ -29,7 +29,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov - * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Nexenta Systems, Inc. * Copyright 2017 RackTop Systems. */ @@ -3522,6 +3522,10 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs "pool must be upgraded to set this " "property or value")); return (zfs_error(hdl, EZFS_BADVERSION, errbuf)); + case ERANGE: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "invalid property value(s) specified")); + return (zfs_error(hdl, EZFS_BADPROP, errbuf)); #ifdef _ILP32 case EOVERFLOW: /* From owner-svn-src-all@freebsd.org Sun Feb 18 00:23:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58A76F206A3; Sun, 18 Feb 2018 00:23:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A66975D59; Sun, 18 Feb 2018 00:23:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 052132412A; Sun, 18 Feb 2018 00:23:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0NpbL061360; Sun, 18 Feb 2018 00:23:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0NpbV061359; Sun, 18 Feb 2018 00:23:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180023.w1I0NpbV061359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329490 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:23:52 -0000 Author: mav Date: Sun Feb 18 00:23:51 2018 New Revision: 329490 URL: https://svnweb.freebsd.org/changeset/base/329490 Log: MFC r328246: MFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff https://www.illumos.org/issues/8856: arc_cksum_is_equal() calls zio_push_transform() that requires abd_t* (second arg), but a void* is passed. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Gordon Ross Author: Roman Strashkin Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Feb 18 00:23:12 2018 (r329489) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Feb 18 00:23:51 2018 (r329490) @@ -23,7 +23,7 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* @@ -1857,8 +1857,9 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) uint64_t lsize = HDR_GET_LSIZE(hdr); uint64_t csize; - void *cbuf = zio_buf_alloc(HDR_GET_PSIZE(hdr)); - csize = zio_compress_data(compress, zio->io_abd, cbuf, lsize); + abd_t *cdata = abd_alloc_linear(HDR_GET_PSIZE(hdr), B_TRUE); + csize = zio_compress_data(compress, zio->io_abd, + abd_to_buf(cdata), lsize); ASSERT3U(csize, <=, HDR_GET_PSIZE(hdr)); if (csize < HDR_GET_PSIZE(hdr)) { @@ -1874,10 +1875,10 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) * and zero out any part that should not contain * data. */ - bzero((char *)cbuf + csize, HDR_GET_PSIZE(hdr) - csize); + abd_zero_off(cdata, csize, HDR_GET_PSIZE(hdr) - csize); csize = HDR_GET_PSIZE(hdr); } - zio_push_transform(zio, cbuf, csize, HDR_GET_PSIZE(hdr), NULL); + zio_push_transform(zio, cdata, csize, HDR_GET_PSIZE(hdr), NULL); } /* From owner-svn-src-all@freebsd.org Sun Feb 18 00:24:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8694AF20811; Sun, 18 Feb 2018 00:24:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3991175F05; Sun, 18 Feb 2018 00:24:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BEE82412D; Sun, 18 Feb 2018 00:24:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0OVrp061449; Sun, 18 Feb 2018 00:24:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0OVM5061447; Sun, 18 Feb 2018 00:24:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180024.w1I0OVM5061447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329491 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent X-SVN-Commit-Revision: 329491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:24:32 -0000 Author: mav Date: Sun Feb 18 00:24:31 2018 New Revision: 329491 URL: https://svnweb.freebsd.org/changeset/base/329491 Log: MFC r328248: MFV r328247: 8959 Add notifications when a scrub is paused or resumed illumos/illumos-gate@301fd1d6f25595cd8c6d6795f39c72d97aff8cd9 Reviewed by: Alek Pinchuk Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Sean Eric Fagan Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Feb 18 00:23:51 2018 (r329490) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Feb 18 00:24:31 2018 (r329491) @@ -387,6 +387,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); + spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -441,6 +442,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); + spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -2012,8 +2014,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); - if (err == 0) + if (err == 0) { + spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); + } return (SET_ERROR(err)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Sun Feb 18 00:23:51 2018 (r329490) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Sun Feb 18 00:24:31 2018 (r329491) @@ -262,6 +262,9 @@ extern "C" { #define ESC_ZFS_CONFIG_SYNC "ESC_ZFS_config_sync" #define ESC_ZFS_SCRUB_START "ESC_ZFS_scrub_start" #define ESC_ZFS_SCRUB_FINISH "ESC_ZFS_scrub_finish" +#define ESC_ZFS_SCRUB_ABORT "ESC_ZFS_scrub_abort" +#define ESC_ZFS_SCRUB_RESUME "ESC_ZFS_scrub_resume" +#define ESC_ZFS_SCRUB_PAUSED "ESC_ZFS_scrub_paused" #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" From owner-svn-src-all@freebsd.org Sun Feb 18 00:25:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12A63F2098C; Sun, 18 Feb 2018 00:25:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BAEB476075; Sun, 18 Feb 2018 00:25:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5D9F2412E; Sun, 18 Feb 2018 00:25:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0PLXp061545; Sun, 18 Feb 2018 00:25:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0PLbn061544; Sun, 18 Feb 2018 00:25:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180025.w1I0PLbn061544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329492 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:25:22 -0000 Author: mav Date: Sun Feb 18 00:25:21 2018 New Revision: 329492 URL: https://svnweb.freebsd.org/changeset/base/329492 Log: MFC r328250: MFV r328249: 8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs illumos/illumos-gate@2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9 https://www.illumos.org/issues/8641: "zpool clear" and "zinject -d" can both operate on specific vdevs, either leaf or interior. However, due to an oversight, neither works on a "spare" or "replacing" vdev. For example: sudo zpool create foo raidz1 c1t5000CCA000081D61d0 c1t5000CCA000186235d0 spare c 1t5000CCA000094115d0 sudo zpool replace foo c1t5000CCA000186235d0 c1t5000CCA000094115d0 $ zpool status foo pool: foo state: ONLINE scan: resilvered 81.5K in 0h0m with 0 errors on Fri Sep 8 10:53:03 2017 config: NAME STATE READ WRITE CKSUM foo ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 c1t5000CCA000081D61d0 ONLINE 0 0 0 spare-1 ONLINE 0 0 0 c1t5000CCA000186235d0 ONLINE 0 0 0 c1t5000CCA000094115d0 ONLINE 0 0 0 spares c1t5000CCA000094115d0 INUSE currently in use $ sudo zinject -d spare-1 -A degrade foo cannot find device 'spare-1' in pool 'foo' $ sudo zpool clear foo spare-1 cannot clear errors for spare-1: no such device in pool Even though there was nothing to clear, those commands shouldn't have reported an error. by contrast, trying to clear "raidz1-0" works just fine: $ sudo zpool clear foo raidz1-0 Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Alan Somers Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:24:31 2018 (r329491) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:25:21 2018 (r329492) @@ -50,6 +50,7 @@ #include "zfeature_common.h" static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -2065,10 +2066,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo break; } - verify(strncmp(type, VDEV_TYPE_RAIDZ, - strlen(VDEV_TYPE_RAIDZ)) == 0 || - strncmp(type, VDEV_TYPE_MIRROR, - strlen(VDEV_TYPE_MIRROR)) == 0); + verify(zpool_vdev_is_interior(type)); verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID, &id) == 0); @@ -2175,10 +2173,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const /* * Determine if we have an "interior" top-level vdev (i.e mirror/raidz). */ -boolean_t +static boolean_t zpool_vdev_is_interior(const char *name) { if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 || + strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 || + strncmp(name, + VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 || strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0) return (B_TRUE); return (B_FALSE); From owner-svn-src-all@freebsd.org Sun Feb 18 00:26:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD36FF20AAD; Sun, 18 Feb 2018 00:26:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C23076207; Sun, 18 Feb 2018 00:26:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66AF424132; Sun, 18 Feb 2018 00:26:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0Q1Q8061627; Sun, 18 Feb 2018 00:26:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0Q0LE061623; Sun, 18 Feb 2018 00:26:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180026.w1I0Q0LE061623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329493 - in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/com... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 329493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:26:02 -0000 Author: mav Date: Sun Feb 18 00:26:00 2018 New Revision: 329493 URL: https://svnweb.freebsd.org/changeset/base/329493 Log: MFC r328252: MFV r328251: 8652 Tautological comparisons with ZPROP_INVAL illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 https://www.illumos.org/issues/8652: Clang and GCC prefer to use unsigned ints to store enums. With Clang, that causes tautological comparison warnings when comparing a zfs_prop_t or zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error handling code is being silently removed as a result. Reviewed by: Matthew Ahrens Reviewed by: Igor Kozhukhov Approved by: Gordon Ross Author: Alan Somers Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Feb 18 00:25:21 2018 (r329492) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Feb 18 00:26:00 2018 (r329493) @@ -441,7 +441,7 @@ add_prop_list(const char *propname, char *propval, nvl * feature@ properties and version should not be specified * at the same time. */ - if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) && + if ((prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname) && nvlist_exists(proplist, vname)) || (prop == ZPOOL_PROP_VERSION && prop_list_contains_feature(proplist))) { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:25:21 2018 (r329492) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Feb 18 00:26:00 2018 (r329493) @@ -445,7 +445,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char const char *propname = nvpair_name(elem); prop = zpool_name_to_prop(propname); - if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) { + if (prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname)) { int err; char *fname = strchr(propname, '@') + 1; @@ -484,7 +484,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char /* * Make sure this property is valid and applies to this type. */ - if (prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_INVAL) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "invalid property '%s'"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Feb 18 00:25:21 2018 (r329492) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Feb 18 00:26:00 2018 (r329493) @@ -348,7 +348,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) zprop_source_t src = ZPROP_SRC_DEFAULT; zpool_prop_t prop; - if ((prop = zpool_name_to_prop(za.za_name)) == ZPROP_INVAL) + if ((prop = zpool_name_to_prop(za.za_name)) == ZPOOL_PROP_INVAL) continue; switch (za.za_integer_length) { @@ -436,7 +436,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) zpool_prop_t prop = zpool_name_to_prop(propname); switch (prop) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: if (!zpool_prop_feature(propname)) { error = SET_ERROR(EINVAL); break; @@ -685,7 +685,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp) prop == ZPOOL_PROP_READONLY) continue; - if (prop == ZPOOL_PROP_VERSION || prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_VERSION || prop == ZPOOL_PROP_INVAL) { uint64_t ver; if (prop == ZPOOL_PROP_VERSION) { @@ -6663,7 +6663,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) spa_feature_t fid; switch (prop = zpool_name_to_prop(nvpair_name(elem))) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: /* * We checked this earlier in spa_prop_validate(). */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 18 00:25:21 2018 (r329492) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Feb 18 00:26:00 2018 (r329493) @@ -90,7 +90,9 @@ typedef enum dmu_objset_type { * the property table in usr/src/common/zfs/zfs_prop.c. */ typedef enum { - ZFS_PROP_TYPE, + ZPROP_CONT = -2, + ZPROP_INVAL = -1, + ZFS_PROP_TYPE = 0, ZFS_PROP_CREATION, ZFS_PROP_USED, ZFS_PROP_AVAILABLE, @@ -183,6 +185,7 @@ extern const char *zfs_userquota_prop_prefixes[ZFS_NUM * the property table in usr/src/common/zfs/zpool_prop.c. */ typedef enum { + ZPOOL_PROP_INVAL = -1, ZPOOL_PROP_NAME, ZPOOL_PROP_SIZE, ZPOOL_PROP_CAPACITY, @@ -213,9 +216,6 @@ typedef enum { /* Small enough to not hog a whole line of printout in zpool(1M). */ #define ZPROP_MAX_COMMENT 32 - -#define ZPROP_CONT -2 -#define ZPROP_INVAL -1 #define ZPROP_VALUE "value" #define ZPROP_SOURCE "source" From owner-svn-src-all@freebsd.org Sun Feb 18 00:26:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA645F20C10; Sun, 18 Feb 2018 00:26:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8880776355; Sun, 18 Feb 2018 00:26:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8384224133; Sun, 18 Feb 2018 00:26:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0QYYe061701; Sun, 18 Feb 2018 00:26:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0QY8M061700; Sun, 18 Feb 2018 00:26:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180026.w1I0QY8M061700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329494 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:26:35 -0000 Author: mav Date: Sun Feb 18 00:26:34 2018 New Revision: 329494 URL: https://svnweb.freebsd.org/changeset/base/329494 Log: MFC r328254: MFV r328253: 8835 Speculative prefetch in ZFS not working for misaligned reads illumos/illumos-gate@5cb8d943bc8513c6230589aad5a409d58b0297cb https://www.illumos.org/issues/8835: Sequential reads not aligned to block size are not detected by ZFS prefetcher as sequential, killing prefetch and severely hurting performance. It is caused by dmu_zfetch() in case of misaligned sequential accesses being called with overlap of one block. Reviewed by: Matthew Ahrens Reviewed by: Allan Jude Approved by: Gordon Ross Author: Alexander Motin Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sun Feb 18 00:26:00 2018 (r329493) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sun Feb 18 00:26:34 2018 (r329494) @@ -240,19 +240,33 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblk rw_enter(&zf->zf_rwlock, RW_READER); + /* + * Find matching prefetch stream. Depending on whether the accesses + * are block-aligned, first block of the new access may either follow + * the last block of the previous access, or be equal to it. + */ for (zs = list_head(&zf->zf_stream); zs != NULL; zs = list_next(&zf->zf_stream, zs)) { - if (blkid == zs->zs_blkid) { + if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) { mutex_enter(&zs->zs_lock); /* * zs_blkid could have changed before we * acquired zs_lock; re-check them here. */ - if (blkid != zs->zs_blkid) { - mutex_exit(&zs->zs_lock); - continue; + if (blkid == zs->zs_blkid) { + break; + } else if (blkid + 1 == zs->zs_blkid) { + blkid++; + nblks--; + if (nblks == 0) { + /* Already prefetched this before. */ + mutex_exit(&zs->zs_lock); + rw_exit(&zf->zf_rwlock); + return; + } + break; } - break; + mutex_exit(&zs->zs_lock); } } From owner-svn-src-all@freebsd.org Sun Feb 18 00:27:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96A71F20ED3; Sun, 18 Feb 2018 00:27:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ACF76569; Sun, 18 Feb 2018 00:27:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44A7024140; Sun, 18 Feb 2018 00:27:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0Ra7j061796; Sun, 18 Feb 2018 00:27:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0RaqU061795; Sun, 18 Feb 2018 00:27:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180027.w1I0RaqU061795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 00:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329495 - stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 329495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:27:36 -0000 Author: mav Date: Sun Feb 18 00:27:35 2018 New Revision: 329495 URL: https://svnweb.freebsd.org/changeset/base/329495 Log: MFC r328256: MFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39 https://www.illumos.org/issues/8972: 'zfs holds -H' does not properly output content in scripted mode. It uses a tab instead of two spaces, but it still pads column widths with spaces when it should not. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Allan Jude Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Feb 18 00:26:34 2018 (r329494) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Feb 18 00:27:35 2018 (r329495) @@ -5636,8 +5636,6 @@ print_holds(boolean_t scripted, boolean_t literal, siz uint64_t val = 0; time_t time; struct tm t; - char sep = scripted ? '\t' : ' '; - size_t sepnum = scripted ? 1 : 2; (void) nvpair_value_uint64(nvp2, &val); if (literal) @@ -5649,8 +5647,13 @@ print_holds(boolean_t scripted, boolean_t literal, siz gettext(STRFTIME_FMT_STR), &t); } - (void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname, - sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf); + if (scripted) { + (void) printf("%s\t%s\t%s\n", zname, + tagname, tsbuf); + } else { + (void) printf("%-*s %-*s %s\n", nwidth, + zname, tagwidth, tagname, tsbuf); + } } } } From owner-svn-src-all@freebsd.org Sun Feb 18 00:44:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 379E4F226DE; Sun, 18 Feb 2018 00:44:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB80B7748D; Sun, 18 Feb 2018 00:44:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D681C2448E; Sun, 18 Feb 2018 00:44:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0i9Zw071783; Sun, 18 Feb 2018 00:44:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0i9KF071782; Sun, 18 Feb 2018 00:44:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180044.w1I0i9KF071782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 00:44:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329496 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:44:10 -0000 Author: kevans Date: Sun Feb 18 00:44:09 2018 New Revision: 329496 URL: https://svnweb.freebsd.org/changeset/base/329496 Log: stand/lua: Fix verbiage and some typos "other_kernel" is decidedly not spelled "other_kern" Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Feb 18 00:27:35 2018 (r329495) +++ head/stand/lua/config.lua Sun Feb 18 00:44:09 2018 (r329496) @@ -38,11 +38,11 @@ function config.setKey(k, n, v) end function config.lsModules() - print("== Dumping modules"); + print("== Listing modules"); for k, v in pairs(modules) do print(k, v.load); end - print("== Dump ended"); + print("== List of modules ended"); end local pattern_table = { @@ -296,8 +296,8 @@ function config.loadkernel(other_kernel) local module_path = loader.getenv("module_path"); local res = nil; - if other_kern ~= nil then - kernel = other_kern; + if other_kernel ~= nil then + kernel = other_kernel; end -- first try load kernel with module_path = /boot/${kernel} -- then try load with module_path=${kernel} From owner-svn-src-all@freebsd.org Sun Feb 18 00:56:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 554E6F238E4; Sun, 18 Feb 2018 00:56:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0063F77D74; Sun, 18 Feb 2018 00:56:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAAB52462A; Sun, 18 Feb 2018 00:56:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I0uCvr076914; Sun, 18 Feb 2018 00:56:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I0uC96076913; Sun, 18 Feb 2018 00:56:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180056.w1I0uC96076913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 00:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329497 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 00:56:13 -0000 Author: kevans Date: Sun Feb 18 00:56:12 2018 New Revision: 329497 URL: https://svnweb.freebsd.org/changeset/base/329497 Log: stand/lua: Fix module_path handling with multiple kernels Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepend the kernel directory to the current module_path and end up with multiple kernel paths, potentially with mismatched kernel/modules, added to module_path. Fix it by caching module_path at load() time and using the cached version whenever we load a new kernel. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Feb 18 00:44:09 2018 (r329496) +++ head/stand/lua/config.lua Sun Feb 18 00:56:12 2018 (r329497) @@ -115,6 +115,7 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -124,6 +125,7 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) + print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -293,7 +295,9 @@ function config.loadkernel(other_kernel) return false; end else - local module_path = loader.getenv("module_path"); + -- Use our cached module_path, so we don't end up with multiple + -- automatically added kernel paths to our final module_path + local module_path = config.module_path; local res = nil; if other_kernel ~= nil then @@ -308,9 +312,9 @@ function config.loadkernel(other_kernel) loader.setenv("module_path", v); res = load_bootfile(); - -- succeeded add path to module_path + -- succeeded, add path to module_path if res ~= nil then - if module_path ~= nil then + if (module_path ~= nil) then loader.setenv("module_path", v..";".. module_path); end @@ -349,6 +353,9 @@ function config.load(file) end end end + + -- Cache the provided module_path at load time for later use + config.module_path = loader.getenv("module_path"); print("Loading kernel..."); config.loadkernel(); From owner-svn-src-all@freebsd.org Sun Feb 18 01:01:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA4A2F23EC9; Sun, 18 Feb 2018 01:01:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3E4781F0; Sun, 18 Feb 2018 01:01:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9849E24763; Sun, 18 Feb 2018 01:01:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I11FU8078702; Sun, 18 Feb 2018 01:01:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I11FAg078701; Sun, 18 Feb 2018 01:01:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180101.w1I11FAg078701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 01:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329498 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:01:16 -0000 Author: kevans Date: Sun Feb 18 01:01:15 2018 New Revision: 329498 URL: https://svnweb.freebsd.org/changeset/base/329498 Log: stand/lua: Remove some debugging bits that snuck in... gr... Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Feb 18 00:56:12 2018 (r329497) +++ head/stand/lua/config.lua Sun Feb 18 01:01:15 2018 (r329498) @@ -115,7 +115,6 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end @@ -125,7 +124,6 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - print("Setting '"..k.."' to '"..v.."'") if loader.setenv(k, v) ~= 0 then print("Failed to set '"..k.."' with value: "..v..""); end From owner-svn-src-all@freebsd.org Sun Feb 18 01:13:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23607F24D21; Sun, 18 Feb 2018 01:13:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB29478A8C; Sun, 18 Feb 2018 01:13:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C60BD2498E; Sun, 18 Feb 2018 01:13:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1DwSD087359; Sun, 18 Feb 2018 01:13:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1DwJl087356; Sun, 18 Feb 2018 01:13:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802180113.w1I1DwJl087356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Feb 2018 01:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329499 - in head/stand: common liblua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: common liblua X-SVN-Commit-Revision: 329499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:13:59 -0000 Author: cem Date: Sun Feb 18 01:13:58 2018 New Revision: 329499 URL: https://svnweb.freebsd.org/changeset/base/329499 Log: interp_lua: Register io/loader with regular Lua module system Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14421 Modified: head/stand/common/interp_lua.c head/stand/liblua/lutils.c head/stand/liblua/lutils.h Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/common/interp_lua.c Sun Feb 18 01:13:58 2018 (r329499) @@ -85,6 +85,8 @@ static const luaL_Reg loadedlibs[] = { // {LUA_MATHLIBNAME, luaopen_math}, // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, + {"io", luaopen_io}, + {"loader", luaopen_loader}, {NULL, NULL} }; @@ -105,7 +107,6 @@ interp_init(void) abort(); } softc->luap = luap; - register_utils(luap); /* "require" functions from 'loadedlibs' and set results to global table */ for (lib = loadedlibs; lib->func; lib++) { Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/liblua/lutils.c Sun Feb 18 01:13:58 2018 (r329499) @@ -233,11 +233,15 @@ static const struct luaL_Reg iolib[] = { }; #undef REG_SIMPLE -void -register_utils(lua_State *L) +int +luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); - lua_setglobal(L, "loader"); - luaL_newlib(L, iolib); - lua_setglobal(L, "io"); + return 1; } + +int +luaopen_io(lua_State *L) +{ + luaL_newlib(L, iolib); + return 1; Modified: head/stand/liblua/lutils.h ============================================================================== --- head/stand/liblua/lutils.h Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/liblua/lutils.h Sun Feb 18 01:13:58 2018 (r329499) @@ -28,4 +28,5 @@ #include -void register_utils(lua_State *); +int luaopen_loader(lua_State *); +int luaopen_io(lua_State *); From owner-svn-src-all@freebsd.org Sun Feb 18 01:15:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8F38F24EA2; Sun, 18 Feb 2018 01:15:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9797578C39; Sun, 18 Feb 2018 01:15:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90D2D2499F; Sun, 18 Feb 2018 01:15:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1FQIc087462; Sun, 18 Feb 2018 01:15:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1FQPv087458; Sun, 18 Feb 2018 01:15:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802180115.w1I1FQPv087458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Feb 2018 01:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329500 - in head/stand: common liblua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: common liblua X-SVN-Commit-Revision: 329500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:15:27 -0000 Author: cem Date: Sun Feb 18 01:15:25 2018 New Revision: 329500 URL: https://svnweb.freebsd.org/changeset/base/329500 Log: Lua loader: Add barebones "lfs" module Add a Lua FileSystem module, an emulation of a subset of the permissively licensed (MIT) Lua library of the same name[0], to our loader's Lua environment. [0]: https://github.com/keplerproject/luafilesystem/ Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14418 Added: head/stand/liblua/lfs.c (contents, props changed) head/stand/liblua/lfs.h (contents, props changed) Modified: head/stand/common/interp_lua.c head/stand/liblua/Makefile Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Sun Feb 18 01:13:58 2018 (r329499) +++ head/stand/common/interp_lua.c Sun Feb 18 01:15:25 2018 (r329500) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include struct interp_lua_softc { lua_State *luap; @@ -86,6 +87,7 @@ static const luaL_Reg loadedlibs[] = { // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, {"io", luaopen_io}, + {"lfs", luaopen_lfs}, {"loader", luaopen_loader}, {NULL, NULL} }; Modified: head/stand/liblua/Makefile ============================================================================== --- head/stand/liblua/Makefile Sun Feb 18 01:13:58 2018 (r329499) +++ head/stand/liblua/Makefile Sun Feb 18 01:15:25 2018 (r329500) @@ -21,7 +21,7 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lstd.c lutils.c +SRCS+= lfs.c lstd.c lutils.c WARNS= 3 Added: head/stand/liblua/lfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/liblua/lfs.c Sun Feb 18 01:15:25 2018 (r329500) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Portions derived from https://github.com/keplerproject/luafilesystem under + * the terms of the MIT license: + * + * Copyright (c) 2003-2014 Kepler Project. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "lauxlib.h" +#include "lfs.h" +#include "lstd.h" +#include "lutils.h" +#include "bootstrap.h" + +#ifndef nitems +#define nitems(x) (sizeof((x)) / sizeof((x)[0])) +#endif + +/* + * The goal is to emulate a subset of the upstream Lua FileSystem library, as + * faithfully as possible in the boot environment. Only APIs that seem useful + * need to emulated. + * + * Example usage: + * + * for file in lfs.dir("/boot") do + * print("\t"..file) + * end + * + * Prints: + * . + * .. + * (etc.) + * + * The other available API is lfs.attributes(), which functions somewhat like + * stat(2) and returns a table of values: + * + * for k, v in pairs(lfs.attributes("/boot")) do + * print(k .. ":\t" .. v) + * end + * + * Prints: + * gid: 0 + * change: 140737488342640 + * mode: directory + * rdev: 0 + * ino: 4199275 + * dev: 140737488342544 + * modification: 140737488342576 + * size: 512 + * access: 140737488342560 + * permissions: 755 + * nlink: 58283552 + * uid: 1001 + */ + +#define DIR_METATABLE "directory iterator metatable" + +static int +lua_dir_iter_next(lua_State *L) +{ + struct dirent *entry; + DIR *dp, **dpp; + + dpp = (DIR **)luaL_checkudata(L, 1, DIR_METATABLE); + dp = *dpp; + luaL_argcheck(L, dp != NULL, 1, "closed directory"); + + entry = readdirfd(dp->fd); + if (entry == NULL) { + closedir(dp); + *dpp = NULL; + return 0; + } + + lua_pushstring(L, entry->d_name); + return 1; +} + +static int +lua_dir_iter_close(lua_State *L) +{ + DIR *dp, **dpp; + + dpp = (DIR **)lua_touserdata(L, 1); + dp = *dpp; + if (dp == NULL) + return 0; + + closedir(dp); + *dpp = NULL; + return 0; +} + +static int +lua_dir(lua_State *L) +{ + const char *path; + DIR *dp; + + if (lua_gettop(L) != 1) { + lua_pushnil(L); + return 1; + } + + path = luaL_checkstring(L, 1); + dp = opendir(path); + if (dp == NULL) { + lua_pushnil(L); + return 1; + } + + lua_pushcfunction(L, lua_dir_iter_next); + *(DIR **)lua_newuserdata(L, sizeof(DIR **)) = dp; + luaL_getmetatable(L, DIR_METATABLE); + lua_setmetatable(L, -2); + return 2; +} + +static void +register_metatable(lua_State *L) +{ + /* + * Create so-called metatable for iterator object returned by + * lfs.dir(). + */ + luaL_newmetatable(L, DIR_METATABLE); + + lua_newtable(L); + lua_pushcfunction(L, lua_dir_iter_next); + lua_setfield(L, -2, "next"); + lua_pushcfunction(L, lua_dir_iter_close); + lua_setfield(L, -2, "close"); + + /* Magically associate anonymous method table with metatable. */ + lua_setfield(L, -2, "__index"); + /* Implement magic destructor method */ + lua_pushcfunction(L, lua_dir_iter_close); + lua_setfield(L, -2, "__gc"); + + lua_pop(L, 1); +} + +#define PUSH_INTEGER(lname, stname) \ +static void \ +push_st_ ## lname (lua_State *L, struct stat *sb) \ +{ \ + lua_pushinteger(L, (lua_Integer)sb->st_ ## stname); \ +} +PUSH_INTEGER(dev, dev) +PUSH_INTEGER(ino, ino) +PUSH_INTEGER(nlink, nlink) +PUSH_INTEGER(uid, uid) +PUSH_INTEGER(gid, gid) +PUSH_INTEGER(rdev, rdev) +PUSH_INTEGER(access, atime) +PUSH_INTEGER(modification, mtime) +PUSH_INTEGER(change, ctime) +PUSH_INTEGER(size, size) +#undef PUSH_INTEGER + +static void +push_st_mode(lua_State *L, struct stat *sb) +{ + const char *mode_s; + mode_t mode; + + mode = (sb->st_mode & S_IFMT); + if (S_ISREG(mode)) + mode_s = "file"; + else if (S_ISDIR(mode)) + mode_s = "directory"; + else if (S_ISLNK(mode)) + mode_s = "link"; + else if (S_ISSOCK(mode)) + mode_s = "socket"; + else if (S_ISFIFO(mode)) + mode_s = "fifo"; + else if (S_ISCHR(mode)) + mode_s = "char device"; + else if (S_ISBLK(mode)) + mode_s = "block device"; + else + mode_s = "other"; + + lua_pushstring(L, mode_s); +} + +static void +push_st_permissions(lua_State *L, struct stat *sb) +{ + char buf[20]; + + /* + * XXX + * Could actually format as "-rwxrwxrwx" -- do we care? + */ + snprintf(buf, sizeof(buf), "%o", sb->st_mode & ~S_IFMT); + lua_pushstring(L, buf); +} + +#define PUSH_ENTRY(n) { #n, push_st_ ## n } +struct stat_members { + const char *name; + void (*push)(lua_State *, struct stat *); +} members[] = { + PUSH_ENTRY(mode), + PUSH_ENTRY(dev), + PUSH_ENTRY(ino), + PUSH_ENTRY(nlink), + PUSH_ENTRY(uid), + PUSH_ENTRY(gid), + PUSH_ENTRY(rdev), + PUSH_ENTRY(access), + PUSH_ENTRY(modification), + PUSH_ENTRY(change), + PUSH_ENTRY(size), + PUSH_ENTRY(permissions), +}; +#undef PUSH_ENTRY + +static int +lua_attributes(lua_State *L) +{ + struct stat sb; + const char *path, *member; + size_t i; + int rc; + + path = luaL_checkstring(L, 1); + if (path == NULL) { + lua_pushnil(L); + return 1; + } + + rc = stat(path, &sb); + if (rc != 0) { + lua_pushnil(L); + lua_pushfstring(L, + "cannot obtain information from file '%s': %s", path, + strerror(errno)); + lua_pushinteger(L, errno); + return 3; + } + + if (lua_isstring(L, 2)) { + member = lua_tostring(L, 2); + for (i = 0; i < nitems(members); i++) { + if (strcmp(members[i].name, member) != 0) + continue; + + members[i].push(L, &sb); + return 1; + } + return luaL_error(L, "invalid attribute name '%s'", member); + } + + /* Create or reuse existing table */ + lua_settop(L, 2); + if (!lua_istable(L, 2)) + lua_newtable(L); + + /* Export all stat data to caller */ + for (i = 0; i < nitems(members); i++) { + lua_pushstring(L, members[i].name); + members[i].push(L, &sb); + lua_rawset(L, -3); + } + return 1; +} + +#define REG_SIMPLE(n) { #n, lua_ ## n } +static const struct luaL_Reg fslib[] = { + REG_SIMPLE(attributes), + REG_SIMPLE(dir), + { NULL, NULL }, +}; +#undef REG_SIMPLE + +int +luaopen_lfs(lua_State *L) +{ + register_metatable(L); + luaL_newlib(L, fslib); + return 1; +} Added: head/stand/liblua/lfs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/liblua/lfs.h Sun Feb 18 01:15:25 2018 (r329500) @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#pragma once + +#include + +int luaopen_lfs(lua_State *L); From owner-svn-src-all@freebsd.org Sun Feb 18 01:16:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61551F2504F; Sun, 18 Feb 2018 01:16:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1443A78DE6; Sun, 18 Feb 2018 01:16:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F3AF249A5; Sun, 18 Feb 2018 01:16:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1GbDn087541; Sun, 18 Feb 2018 01:16:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1Gbq1087540; Sun, 18 Feb 2018 01:16:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802180116.w1I1Gbq1087540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Feb 2018 01:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329501 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:16:38 -0000 Author: cem Date: Sun Feb 18 01:16:37 2018 New Revision: 329501 URL: https://svnweb.freebsd.org/changeset/base/329501 Log: lua loader: Auto detect eligible list of kernels to boot Reviewed by: imp, kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14419 Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Sun Feb 18 01:15:25 2018 (r329500) +++ head/stand/lua/core.lua Sun Feb 18 01:16:37 2018 (r329501) @@ -127,17 +127,47 @@ function core.kernelList() local v = loader.getenv("kernels") or ""; local kernels = {}; + local unique = {}; local i = 0; if (k ~= nil) then i = i + 1; kernels[i] = k; + unique[k] = true; end for n in v:gmatch("([^; ]+)[; ]?") do - if (n ~= k) then + if (unique[n] == nil) then i = i + 1; kernels[i] = n; + unique[n] = true; end + end + + -- Automatically detect other bootable kernel directories using a + -- heuristic. Any directory in /boot that contains an ordinary file + -- named "kernel" is considered eligible. + for file in lfs.dir("/boot") do + local fname = "/boot/" .. file; + + if (file == "." or file == "..") then + goto continue; + end + + if (lfs.attributes(fname, "mode") ~= "directory") then + goto continue; + end + + if (lfs.attributes(fname .. "/kernel", "mode") ~= "file") then + goto continue; + end + + if (unique[file] == nil) then + i = i + 1; + kernels[i] = file; + unique[file] = true; + end + + ::continue:: end return kernels; end From owner-svn-src-all@freebsd.org Sun Feb 18 01:21:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E43D9F25625; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96E7679290; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 919B324A16; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1Ls13091362; Sun, 18 Feb 2018 01:21:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1LsnP091359; Sun, 18 Feb 2018 01:21:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180121.w1I1LsnP091359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 01:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329502 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/... X-SVN-Commit-Revision: 329502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:21:55 -0000 Author: mav Date: Sun Feb 18 01:21:52 2018 New Revision: 329502 URL: https://svnweb.freebsd.org/changeset/base/329502 Log: 7614 zfs device evacuation/removal illumos/illumos-gate@5cabbc6b49070407fb9610cfe73d4c0e0dea3e77 https://www.illumos.org/issues/7614: This project allows top-level vdevs to be removed from the storage pool with “zpool removeâ€, reducing the total amount of storage in the pool. This operation copies all allocated regions of the device to be removed onto other devices, recording the mapping from old to new location. After the removal is complete, read and free operations to the removed (now “indirectâ€) vdev must be remapped and performed at the new location on disk. The indirect mapping table is kept in memory whenever the pool is loaded, so there is minimal performance overhead when doing operations on the indirect vdev. The size of the in-memory mapping table will be reduced when its entries become “obsolete†because they are no longer used by any block pointers in the pool. An entry becomes obsolete when all the blocks that use it are freed. An entry can also become obsolete when all the snapshots that reference it are deleted, and the block pointers that reference it have been “remapped†in all filesystems/zvols (and clones). Whenever an indirect block is written, all the block pointers in it will be “remapped†to their new (concrete) locations if possible. This process can be accelerated by using the “zfs remap†command to proactively rewrite all indirect blocks that reference indirect (removed) vdevs. Note that when a device is removed, we do not verify the checksum of the data that is copied. This makes the process much faster, but if it were used on redundant vdevs (i.e. mirror or raidz vdevs), it would be possible to copy the wrong data, when we have the correct data on e.g. the other side of the mirror. Therefore, mirror and raidz devices can not be removed. Reviewed by: Alex Reece Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: Richard Laager Reviewed by: Tim Chase Approved by: Garrett D'Amore Author: Prashanth Sreenivasa Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Changes in other areas also in this revision: Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_births.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_mapping.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_births.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/common/zfs/zfs_deleg.c vendor-sys/illumos/dist/common/zfs/zfs_deleg.h vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/bpobj.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deadlist.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_debug.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_priority.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor/illumos/dist/cmd/zdb/zdb.c Sun Feb 18 01:21:52 2018 (r329502) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. */ @@ -77,8 +77,10 @@ dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \ - (((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \ - DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES)) + (idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA ? \ + DMU_OT_ZAP_OTHER : \ + (idx) == DMU_OTN_UINT64_DATA || (idx) == DMU_OTN_UINT64_METADATA ? \ + DMU_OT_UINT64_OTHER : DMU_OT_NUMTYPES) #ifndef lint extern int reference_tracking_enable; @@ -667,8 +669,8 @@ get_metaslab_refcount(vdev_t *vd) { int refcount = 0; - if (vd->vdev_top == vd && !vd->vdev_removing) { - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + if (vd->vdev_top == vd) { + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -683,6 +685,45 @@ get_metaslab_refcount(vdev_t *vd) } static int +get_obsolete_refcount(vdev_t *vd) +{ + int refcount = 0; + + uint64_t obsolete_sm_obj = vdev_obsolete_sm_object(vd); + if (vd->vdev_top == vd && obsolete_sm_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(vd->vdev_spa->spa_meta_objset, + obsolete_sm_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + refcount++; + } + } else { + ASSERT3P(vd->vdev_obsolete_sm, ==, NULL); + ASSERT3U(obsolete_sm_obj, ==, 0); + } + for (unsigned c = 0; c < vd->vdev_children; c++) { + refcount += get_obsolete_refcount(vd->vdev_child[c]); + } + + return (refcount); +} + +static int +get_prev_obsolete_spacemap_refcount(spa_t *spa) +{ + uint64_t prev_obj = + spa->spa_condensing_indirect_phys.scip_prev_obsolete_sm_object; + if (prev_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(spa->spa_meta_objset, prev_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + return (1); + } + } + return (0); +} + +static int verify_spacemap_refcounts(spa_t *spa) { uint64_t expected_refcount = 0; @@ -693,6 +734,8 @@ verify_spacemap_refcounts(spa_t *spa) &expected_refcount); actual_refcount = get_dtl_refcount(spa->spa_root_vdev); actual_refcount += get_metaslab_refcount(spa->spa_root_vdev); + actual_refcount += get_obsolete_refcount(spa->spa_root_vdev); + actual_refcount += get_prev_obsolete_spacemap_refcount(spa); if (expected_refcount != actual_refcount) { (void) printf("space map refcount mismatch: expected %lld != " @@ -708,12 +751,19 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", - "INVALID", "INVALID", "INVALID", "INVALID" }; + char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) return; + (void) printf("space map object %llu:\n", + (longlong_t)sm->sm_phys->smp_object); + (void) printf(" smp_objsize = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_objsize); + (void) printf(" smp_alloc = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_alloc); + /* * Print out the freelist entries in both encoded and decoded form. */ @@ -818,9 +868,7 @@ dump_metaslab(metaslab_t *msp) if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); - mutex_enter(&msp->ms_lock); dump_spacemap(spa->spa_meta_objset, msp->ms_sm); - mutex_exit(&msp->ms_lock); } } @@ -878,6 +926,78 @@ dump_metaslab_groups(spa_t *spa) } static void +print_vdev_indirect(vdev_t *vd) +{ + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + vdev_indirect_births_t *vib = vd->vdev_indirect_births; + + if (vim == NULL) { + ASSERT3P(vib, ==, NULL); + return; + } + + ASSERT3U(vdev_indirect_mapping_object(vim), ==, + vic->vic_mapping_object); + ASSERT3U(vdev_indirect_births_object(vib), ==, + vic->vic_births_object); + + (void) printf("indirect births obj %llu:\n", + (longlong_t)vic->vic_births_object); + (void) printf(" vib_count = %llu\n", + (longlong_t)vdev_indirect_births_count(vib)); + for (uint64_t i = 0; i < vdev_indirect_births_count(vib); i++) { + vdev_indirect_birth_entry_phys_t *cur_vibe = + &vib->vib_entries[i]; + (void) printf("\toffset %llx -> txg %llu\n", + (longlong_t)cur_vibe->vibe_offset, + (longlong_t)cur_vibe->vibe_phys_birth_txg); + } + (void) printf("\n"); + + (void) printf("indirect mapping obj %llu:\n", + (longlong_t)vic->vic_mapping_object); + (void) printf(" vim_max_offset = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_max_offset(vim)); + (void) printf(" vim_bytes_mapped = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_bytes_mapped(vim)); + (void) printf(" vim_count = %llu\n", + (longlong_t)vdev_indirect_mapping_num_entries(vim)); + + if (dump_opt['d'] <= 5 && dump_opt['m'] <= 3) + return; + + uint32_t *counts = vdev_indirect_mapping_load_obsolete_counts(vim); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + (void) printf("\t<%llx:%llx:%llx> -> " + "<%llx:%llx:%llx> (%x obsolete)\n", + (longlong_t)vd->vdev_id, + (longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (longlong_t)DVA_GET_VDEV(&vimep->vimep_dst), + (longlong_t)DVA_GET_OFFSET(&vimep->vimep_dst), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + counts[i]); + } + (void) printf("\n"); + + uint64_t obsolete_sm_object = vdev_obsolete_sm_object(vd); + if (obsolete_sm_object != 0) { + objset_t *mos = vd->vdev_spa->spa_meta_objset; + (void) printf("obsolete space map object %llu:\n", + (u_longlong_t)obsolete_sm_object); + ASSERT(vd->vdev_obsolete_sm != NULL); + ASSERT3U(space_map_object(vd->vdev_obsolete_sm), ==, + obsolete_sm_object); + dump_spacemap(mos, vd->vdev_obsolete_sm); + (void) printf("\n"); + } +} + +static void dump_metaslabs(spa_t *spa) { vdev_t *vd, *rvd = spa->spa_root_vdev; @@ -913,6 +1033,8 @@ dump_metaslabs(spa_t *spa) vd = rvd->vdev_child[c]; print_vdev_metaslab_header(vd); + print_vdev_indirect(vd); + for (m = 0; m < vd->vdev_ms_count; m++) dump_metaslab(vd->vdev_ms[m]); (void) printf("\n"); @@ -1088,9 +1210,7 @@ dump_dtl(vdev_t *vd, int indent) continue; (void) snprintf(prefix, sizeof (prefix), "\t%*s%s", indent + 2, "", name[t]); - mutex_enter(rt->rt_lock); range_tree_walk(rt, dump_dtl_seg, prefix); - mutex_exit(rt->rt_lock); if (dump_opt['d'] > 5 && vd->vdev_children == 0) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } @@ -2082,9 +2202,16 @@ dump_dir(objset_t *os) if (dump_opt['i'] != 0 || verbosity >= 2) dump_intent_log(dmu_objset_zil(os)); - if (dmu_objset_ds(os) != NULL) - dump_deadlist(&dmu_objset_ds(os)->ds_deadlist); + if (dmu_objset_ds(os) != NULL) { + dsl_dataset_t *ds = dmu_objset_ds(os); + dump_deadlist(&ds->ds_deadlist); + if (dsl_dataset_remap_deadlist_exists(ds)) { + (void) printf("ds_remap_deadlist:\n"); + dump_deadlist(&ds->ds_remap_deadlist); + } + } + if (verbosity < 2) return; @@ -2427,6 +2554,7 @@ dump_label(const char *dev) } static uint64_t dataset_feature_count[SPA_FEATURES]; +static uint64_t remap_deadlist_count = 0; /*ARGSUSED*/ static int @@ -2447,6 +2575,10 @@ dump_one_dir(const char *dsname, void *arg) dataset_feature_count[f]++; } + if (dsl_dataset_remap_deadlist_exists(dmu_objset_ds(os))) { + remap_deadlist_count++; + } + dump_dir(os); close_objset(os, FTAG); fuid_table_destroy(); @@ -2486,6 +2618,7 @@ static const char *zdb_ot_extname[] = { typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; + uint64_t zcb_removing_size; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; uint64_t zcb_embedded_blocks[NUM_BP_EMBEDDED_TYPES]; @@ -2498,6 +2631,7 @@ typedef struct zdb_cb { int zcb_readfails; int zcb_haderrors; spa_t *zcb_spa; + uint32_t **zcb_vd_obsolete_counts; } zdb_cb_t; static void @@ -2770,12 +2904,208 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) ASSERT(error == ENOENT); } +/* ARGSUSED */ static void +claim_segment_impl_cb(uint64_t inner_offset, vdev_t *vd, uint64_t offset, + uint64_t size, void *arg) +{ + /* + * This callback was called through a remap from + * a device being removed. Therefore, the vdev that + * this callback is applied to is a concrete + * vdev. + */ + ASSERT(vdev_is_concrete(vd)); + + VERIFY0(metaslab_claim_impl(vd, offset, size, + spa_first_txg(vd->vdev_spa))); +} + +static void +claim_segment_cb(void *arg, uint64_t offset, uint64_t size) +{ + vdev_t *vd = arg; + + vdev_indirect_ops.vdev_op_remap(vd, offset, size, + claim_segment_impl_cb, NULL); +} + +/* + * After accounting for all allocated blocks that are directly referenced, + * we might have missed a reference to a block from a partially complete + * (and thus unused) indirect mapping object. We perform a secondary pass + * through the metaslabs we have already mapped and claim the destination + * blocks. + */ +static void +zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) +{ + if (spa->spa_vdev_removal == NULL) + return; + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + + spa_vdev_removal_t *svr = spa->spa_vdev_removal; + vdev_t *vd = svr->svr_vdev; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) { + metaslab_t *msp = vd->vdev_ms[msi]; + + if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim)) + break; + + ASSERT0(range_tree_space(svr->svr_allocd_segs)); + + if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, + svr->svr_allocd_segs, SM_ALLOC)); + + /* + * Clear everything past what has been synced, + * because we have not allocated mappings for it yet. + */ + range_tree_clear(svr->svr_allocd_segs, + vdev_indirect_mapping_max_offset(vim), + msp->ms_sm->sm_start + msp->ms_sm->sm_size - + vdev_indirect_mapping_max_offset(vim)); + } + + zcb->zcb_removing_size += + range_tree_space(svr->svr_allocd_segs); + range_tree_vacate(svr->svr_allocd_segs, claim_segment_cb, vd); + } + + spa_config_exit(spa, SCL_CONFIG, FTAG); +} + +/* + * vm_idxp is an in-out parameter which (for indirect vdevs) is the + * index in vim_entries that has the first entry in this metaslab. On + * return, it will be set to the first entry after this metaslab. + */ +static void +zdb_leak_init_ms(metaslab_t *msp, uint64_t *vim_idxp) +{ + metaslab_group_t *mg = msp->ms_group; + vdev_t *vd = mg->mg_vd; + vdev_t *rvd = vd->vdev_spa->spa_root_vdev; + + mutex_enter(&msp->ms_lock); + metaslab_unload(msp); + + /* + * We don't want to spend the CPU manipulating the size-ordered + * tree, so clear the range_tree ops. + */ + msp->ms_tree->rt_ops = NULL; + + (void) fprintf(stderr, + "\rloading vdev %llu of %llu, metaslab %llu of %llu ...", + (longlong_t)vd->vdev_id, + (longlong_t)rvd->vdev_children, + (longlong_t)msp->ms_id, + (longlong_t)vd->vdev_ms_count); + + /* + * For leak detection, we overload the metaslab ms_tree to + * contain allocated segments instead of free segments. As a + * result, we can't use the normal metaslab_load/unload + * interfaces. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + for (; *vim_idxp < vdev_indirect_mapping_num_entries(vim); + (*vim_idxp)++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[*vim_idxp]; + uint64_t ent_offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + uint64_t ent_len = DVA_GET_ASIZE(&vimep->vimep_dst); + ASSERT3U(ent_offset, >=, msp->ms_start); + if (ent_offset >= msp->ms_start + msp->ms_size) + break; + + /* + * Mappings do not cross metaslab boundaries, + * because we create them by walking the metaslabs. + */ + ASSERT3U(ent_offset + ent_len, <=, + msp->ms_start + msp->ms_size); + range_tree_add(msp->ms_tree, ent_offset, ent_len); + } + } else if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); + } + + if (!msp->ms_loaded) { + msp->ms_loaded = B_TRUE; + } + mutex_exit(&msp->ms_lock); +} + +/* ARGSUSED */ +static int +increment_indirect_mapping_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + zdb_cb_t *zcb = arg; + spa_t *spa = zcb->zcb_spa; + vdev_t *vd; + const dva_t *dva = &bp->blk_dva[0]; + + ASSERT(!dump_opt['L']); + ASSERT3U(BP_GET_NDVAS(bp), ==, 1); + + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + vd = vdev_lookup_top(zcb->zcb_spa, DVA_GET_VDEV(dva)); + ASSERT3P(vd, !=, NULL); + spa_config_exit(spa, SCL_VDEV, FTAG); + + ASSERT(vd->vdev_indirect_config.vic_mapping_object != 0); + ASSERT3P(zcb->zcb_vd_obsolete_counts[vd->vdev_id], !=, NULL); + + vdev_indirect_mapping_increment_obsolete_count( + vd->vdev_indirect_mapping, + DVA_GET_OFFSET(dva), DVA_GET_ASIZE(dva), + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + + return (0); +} + +static uint32_t * +zdb_load_obsolete_counts(vdev_t *vd) +{ + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + spa_t *spa = vd->vdev_spa; + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + uint32_t *counts; + + EQUIV(vdev_obsolete_sm_object(vd) != 0, vd->vdev_obsolete_sm != NULL); + counts = vdev_indirect_mapping_load_obsolete_counts(vim); + if (vd->vdev_obsolete_sm != NULL) { + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + vd->vdev_obsolete_sm); + } + if (scip->scip_vdev == vd->vdev_id && + scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + prev_obsolete_sm); + space_map_close(prev_obsolete_sm); + } + return (counts); +} + +static void zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) { zcb->zcb_spa = spa; if (!dump_opt['L']) { + dsl_pool_t *dp = spa->spa_dsl_pool; vdev_t *rvd = spa->spa_root_vdev; /* @@ -2786,50 +3116,51 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + zcb->zcb_vd_obsolete_counts = + umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), + UMEM_NOFAIL); + + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; - metaslab_group_t *mg = vd->vdev_mg; - for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - ASSERT3P(msp->ms_group, ==, mg); - mutex_enter(&msp->ms_lock); - metaslab_unload(msp); + uint64_t vim_idx = 0; + ASSERT3U(c, ==, vd->vdev_id); + + /* + * Note: we don't check for mapping leaks on + * removing vdevs because their ms_tree's are + * used to look for leaks in allocated space. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + zcb->zcb_vd_obsolete_counts[c] = + zdb_load_obsolete_counts(vd); + /* - * For leak detection, we overload the metaslab - * ms_tree to contain allocated segments - * instead of free segments. As a result, - * we can't use the normal metaslab_load/unload - * interfaces. + * Normally, indirect vdevs don't have any + * metaslabs. We want to set them up for + * zio_claim(). */ - if (msp->ms_sm != NULL) { - (void) fprintf(stderr, - "\rloading space map for " - "vdev %llu of %llu, " - "metaslab %llu of %llu ...", - (longlong_t)c, - (longlong_t)rvd->vdev_children, - (longlong_t)m, - (longlong_t)vd->vdev_ms_count); + VERIFY0(vdev_metaslab_init(vd, 0)); + } - /* - * We don't want to spend the CPU - * manipulating the size-ordered - * tree, so clear the range_tree - * ops. - */ - msp->ms_tree->rt_ops = NULL; - VERIFY0(space_map_load(msp->ms_sm, - msp->ms_tree, SM_ALLOC)); - - if (!msp->ms_loaded) { - msp->ms_loaded = B_TRUE; - } - } - mutex_exit(&msp->ms_lock); + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { + zdb_leak_init_ms(vd->vdev_ms[m], &vim_idx); } + if (vd->vdev_ops == &vdev_indirect_ops) { + ASSERT3U(vim_idx, ==, + vdev_indirect_mapping_num_entries( + vd->vdev_indirect_mapping)); + } } (void) fprintf(stderr, "\n"); + + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, + increment_indirect_mapping_cb, zcb, NULL); + } } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -2839,18 +3170,93 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa_config_exit(spa, SCL_CONFIG, FTAG); } -static void -zdb_leak_fini(spa_t *spa) +static boolean_t +zdb_check_for_obsolete_leaks(vdev_t *vd, zdb_cb_t *zcb) { + boolean_t leaks = B_FALSE; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + uint64_t total_leaked = 0; + + ASSERT(vim != NULL); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + uint64_t obsolete_bytes = 0; + uint64_t offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + metaslab_t *msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; + + /* + * This is not very efficient but it's easy to + * verify correctness. + */ + for (uint64_t inner_offset = 0; + inner_offset < DVA_GET_ASIZE(&vimep->vimep_dst); + inner_offset += 1 << vd->vdev_ashift) { + if (range_tree_contains(msp->ms_tree, + offset + inner_offset, 1 << vd->vdev_ashift)) { + obsolete_bytes += 1 << vd->vdev_ashift; + } + } + + int64_t bytes_leaked = obsolete_bytes - + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]; + ASSERT3U(DVA_GET_ASIZE(&vimep->vimep_dst), >=, + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]); + if (bytes_leaked != 0 && + (vdev_obsolete_counts_are_precise(vd) || + dump_opt['d'] >= 5)) { + (void) printf("obsolete indirect mapping count " + "mismatch on %llu:%llx:%llx : %llx bytes leaked\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (u_longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (u_longlong_t)bytes_leaked); + } + total_leaked += ABS(bytes_leaked); + } + + if (!vdev_obsolete_counts_are_precise(vd) && total_leaked > 0) { + int pct_leaked = total_leaked * 100 / + vdev_indirect_mapping_bytes_mapped(vim); + (void) printf("cannot verify obsolete indirect mapping " + "counts of vdev %llu because precise feature was not " + "enabled when it was removed: %d%% (%llx bytes) of mapping" + "unreferenced\n", + (u_longlong_t)vd->vdev_id, pct_leaked, + (u_longlong_t)total_leaked); + } else if (total_leaked > 0) { + (void) printf("obsolete indirect mapping count mismatch " + "for vdev %llu -- %llx total bytes mismatched\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)total_leaked); + leaks |= B_TRUE; + } + + vdev_indirect_mapping_free_obsolete_counts(vim, + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + zcb->zcb_vd_obsolete_counts[vd->vdev_id] = NULL; + + return (leaks); +} + +static boolean_t +zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) +{ + boolean_t leaks = B_FALSE; if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + + if (zcb->zcb_vd_obsolete_counts[c] != NULL) { + leaks |= zdb_check_for_obsolete_leaks(vd, zcb); + } + + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); - mutex_enter(&msp->ms_lock); /* * The ms_tree has been overloaded to @@ -2860,18 +3266,30 @@ zdb_leak_fini(spa_t *spa) * represents an allocated block that we * did not claim during the traversal. * Claimed blocks would have been removed - * from the ms_tree. + * from the ms_tree. For indirect vdevs, + * space remaining in the tree represents + * parts of the mapping that are not + * referenced, which is not a bug. */ - range_tree_vacate(msp->ms_tree, zdb_leak, vd); + if (vd->vdev_ops == &vdev_indirect_ops) { + range_tree_vacate(msp->ms_tree, + NULL, NULL); + } else { + range_tree_vacate(msp->ms_tree, + zdb_leak, vd); + } if (msp->ms_loaded) { msp->ms_loaded = B_FALSE; } - - mutex_exit(&msp->ms_lock); } } + + umem_free(zcb->zcb_vd_obsolete_counts, + rvd->vdev_children * sizeof (uint32_t *)); + zcb->zcb_vd_obsolete_counts = NULL; } + return (leaks); } /* ARGSUSED */ @@ -2922,10 +3340,14 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, count_block_cb, &zcb, NULL); } + + zdb_claim_removing(spa, &zcb); + if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, @@ -2967,7 +3389,7 @@ dump_block_stats(spa_t *spa) /* * Report any leaked segments. */ - zdb_leak_fini(spa); + leaks |= zdb_leak_fini(spa, &zcb); tzb = &zcb.zcb_type[ZB_TOTAL][ZDB_OT_TOTAL]; @@ -2975,7 +3397,8 @@ dump_block_stats(spa_t *spa) norm_space = metaslab_class_get_space(spa_normal_class(spa)); total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); - total_found = tzb->zb_asize - zcb.zcb_dedup_asize; + total_found = tzb->zb_asize - zcb.zcb_dedup_asize + + zcb.zcb_removing_size; if (total_found == total_alloc) { if (!dump_opt['L']) @@ -3042,6 +3465,24 @@ dump_block_stats(spa_t *spa) (longlong_t)tzb->zb_ditto_samevdev); } + for (uint64_t v = 0; v < spa->spa_root_vdev->vdev_children; v++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[v]; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + if (vim == NULL) { + continue; + } + + char mem[32]; + zdb_nicenum(vdev_indirect_mapping_num_entries(vim), + mem, vdev_indirect_mapping_size(vim)); + + (void) printf("\tindirect vdev id %llu has %llu segments " + "(%s in memory)\n", + (longlong_t)vd->vdev_id, + (longlong_t)vdev_indirect_mapping_num_entries(vim), mem); + } + if (dump_opt['b'] >= 2) { int l, t, level; (void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" @@ -3248,6 +3689,124 @@ dump_simulated_ddt(spa_t *spa) dump_dedup_ratio(&dds_total); } +static int +verify_device_removal_feature_counts(spa_t *spa) +{ + uint64_t dr_feature_refcount = 0; + uint64_t oc_feature_refcount = 0; + uint64_t indirect_vdev_count = 0; + uint64_t precise_vdev_count = 0; + uint64_t obsolete_counts_object_count = 0; + uint64_t obsolete_sm_count = 0; + uint64_t obsolete_counts_count = 0; + uint64_t scip_count = 0; + uint64_t obsolete_bpobj_count = 0; + int ret = 0; + + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + if (scip->scip_next_mapping_object != 0) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[scip->scip_vdev]; + ASSERT(scip->scip_prev_obsolete_sm_object != 0); + ASSERT3P(vd->vdev_ops, ==, &vdev_indirect_ops); + + (void) printf("Condensing indirect vdev %llu: new mapping " + "object %llu, prev obsolete sm %llu\n", + (u_longlong_t)scip->scip_vdev, + (u_longlong_t)scip->scip_next_mapping_object, + (u_longlong_t)scip->scip_prev_obsolete_sm_object); + if (scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, + spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, + 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + dump_spacemap(spa->spa_meta_objset, prev_obsolete_sm); + (void) printf("\n"); + space_map_close(prev_obsolete_sm); + } + + scip_count += 2; + } + + for (uint64_t i = 0; i < spa->spa_root_vdev->vdev_children; i++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[i]; + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + + if (vic->vic_mapping_object != 0) { + ASSERT(vd->vdev_ops == &vdev_indirect_ops || + vd->vdev_removing); + indirect_vdev_count++; + + if (vd->vdev_indirect_mapping->vim_havecounts) { + obsolete_counts_count++; + } + } + if (vdev_obsolete_counts_are_precise(vd)) { + ASSERT(vic->vic_mapping_object != 0); + precise_vdev_count++; + } + if (vdev_obsolete_sm_object(vd) != 0) { + ASSERT(vic->vic_mapping_object != 0); + obsolete_sm_count++; + } + } + + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_DEVICE_REMOVAL], + &dr_feature_refcount); + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_OBSOLETE_COUNTS], + &oc_feature_refcount); + + if (dr_feature_refcount != indirect_vdev_count) { + ret = 1; + (void) printf("Number of indirect vdevs (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)indirect_vdev_count, + (u_longlong_t)dr_feature_refcount); + } else { + (void) printf("Verified device_removal feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)dr_feature_refcount); + } + + if (zap_contains(spa_meta_objset(spa), DMU_POOL_DIRECTORY_OBJECT, + DMU_POOL_OBSOLETE_BPOBJ) == 0) { + obsolete_bpobj_count++; + } + + + obsolete_counts_object_count = precise_vdev_count; + obsolete_counts_object_count += obsolete_sm_count; + obsolete_counts_object_count += obsolete_counts_count; + obsolete_counts_object_count += scip_count; + obsolete_counts_object_count += obsolete_bpobj_count; + obsolete_counts_object_count += remap_deadlist_count; + + if (oc_feature_refcount != obsolete_counts_object_count) { + ret = 1; + (void) printf("Number of obsolete counts objects (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)obsolete_counts_object_count, + (u_longlong_t)oc_feature_refcount); + (void) printf("pv:%llu os:%llu oc:%llu sc:%llu " + "ob:%llu rd:%llu\n", + (u_longlong_t)precise_vdev_count, + (u_longlong_t)obsolete_sm_count, + (u_longlong_t)obsolete_counts_count, + (u_longlong_t)scip_count, + (u_longlong_t)obsolete_bpobj_count, + (u_longlong_t)remap_deadlist_count); + } else { + (void) printf("Verified indirect_refcount feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)oc_feature_refcount); + } + return (ret); +} + static void dump_zpool(spa_t *spa) { @@ -3281,18 +3840,24 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { + dsl_pool_t *dp = spa->spa_dsl_pool; dump_full_bpobj(&spa->spa_deferred_bpobj, "Deferred frees", 0); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { - dump_full_bpobj( - &spa->spa_dsl_pool->dp_free_bpobj, + dump_full_bpobj(&dp->dp_free_bpobj, "Pool snapshot frees", 0); } + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + dump_full_bpobj(&dp->dp_obsolete_bpobj, + "Pool obsolete blocks", 0); + } if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { dump_bptree(spa->spa_meta_objset, - spa->spa_dsl_pool->dp_bptree_obj, + dp->dp_bptree_obj, "Pool dataset frees"); } dump_dtl(spa->spa_root_vdev, 0); @@ -3324,6 +3889,10 @@ dump_zpool(spa_t *spa) (longlong_t)refcount); } } + + if (rc == 0) { + rc = verify_device_removal_feature_counts(spa); + } } if (rc == 0 && (dump_opt['b'] || dump_opt['c'])) rc = dump_block_stats(spa); @@ -3631,7 +4200,8 @@ zdb_read_block(char *thing, spa_t *spa) psize, ZIO_TYPE_READ, ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY | - ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL, NULL)); + ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW | ZIO_FLAG_OPTIONAL, + NULL, NULL)); } error = zio_wait(zio); Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Sun Feb 18 01:21:52 2018 (r329502) @@ -107,6 +107,7 @@ static int zfs_do_holds(int argc, char **argv); static int zfs_do_release(int argc, char **argv); static int zfs_do_diff(int argc, char **argv); static int zfs_do_bookmark(int argc, char **argv); +static int zfs_do_remap(int argc, char **argv); static int zfs_do_channel_program(int argc, char **argv); /* @@ -154,6 +155,7 @@ typedef enum { HELP_HOLDS, HELP_RELEASE, HELP_DIFF, + HELP_REMAP, HELP_BOOKMARK, HELP_CHANNEL_PROGRAM, } zfs_help_t; @@ -210,6 +212,7 @@ static zfs_command_t command_table[] = { { "holds", zfs_do_holds, HELP_HOLDS }, { "release", zfs_do_release, HELP_RELEASE }, { "diff", zfs_do_diff, HELP_DIFF }, + { "remap", zfs_do_remap, HELP_REMAP }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -326,6 +329,8 @@ get_usage(zfs_help_t idx) case HELP_DIFF: return (gettext("\tdiff [-FHt] " "[snapshot|filesystem]\n")); + case HELP_REMAP: + return (gettext("\tremap \n")); case HELP_BOOKMARK: return (gettext("\tbookmark \n")); case HELP_CHANNEL_PROGRAM: @@ -4104,6 +4109,7 @@ zfs_do_receive(int argc, char **argv) #define ZFS_DELEG_PERM_RELEASE "release" #define ZFS_DELEG_PERM_DIFF "diff" #define ZFS_DELEG_PERM_BOOKMARK "bookmark" +#define ZFS_DELEG_PERM_REMAP "remap" #define ZFS_NUM_DELEG_NOTES ZFS_DELEG_NOTE_NONE @@ -4124,6 +4130,7 @@ static zfs_deleg_perm_tab_t zfs_deleg_perm_tbl[] = { { ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE }, { ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT }, { ZFS_DELEG_PERM_BOOKMARK, ZFS_DELEG_NOTE_BOOKMARK }, + { ZFS_DELEG_PERM_REMAP, ZFS_DELEG_NOTE_REMAP }, { ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA }, { ZFS_DELEG_PERM_GROUPUSED, ZFS_DELEG_NOTE_GROUPUSED }, @@ -6829,7 +6836,7 @@ zfs_do_diff(int argc, char **argv) if (argc < 1) { (void) fprintf(stderr, - gettext("must provide at least one snapshot name\n")); + gettext("must provide at least one snapshot name\n")); usage(B_FALSE); } @@ -6868,6 +6875,22 @@ zfs_do_diff(int argc, char **argv) zfs_close(zhp); return (err != 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Feb 18 01:21:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9C77F25624; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D8F37928D; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3843624A15; Sun, 18 Feb 2018 01:21:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1LsCV091354; Sun, 18 Feb 2018 01:21:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1LqQd091337; Sun, 18 Feb 2018 01:21:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180121.w1I1LqQd091337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 01:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329502 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/... X-SVN-Commit-Revision: 329502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:21:55 -0000 Author: mav Date: Sun Feb 18 01:21:52 2018 New Revision: 329502 URL: https://svnweb.freebsd.org/changeset/base/329502 Log: 7614 zfs device evacuation/removal illumos/illumos-gate@5cabbc6b49070407fb9610cfe73d4c0e0dea3e77 https://www.illumos.org/issues/7614: This project allows top-level vdevs to be removed from the storage pool with “zpool removeâ€, reducing the total amount of storage in the pool. This operation copies all allocated regions of the device to be removed onto other devices, recording the mapping from old to new location. After the removal is complete, read and free operations to the removed (now “indirectâ€) vdev must be remapped and performed at the new location on disk. The indirect mapping table is kept in memory whenever the pool is loaded, so there is minimal performance overhead when doing operations on the indirect vdev. The size of the in-memory mapping table will be reduced when its entries become “obsolete†because they are no longer used by any block pointers in the pool. An entry becomes obsolete when all the blocks that use it are freed. An entry can also become obsolete when all the snapshots that reference it are deleted, and the block pointers that reference it have been “remapped†in all filesystems/zvols (and clones). Whenever an indirect block is written, all the block pointers in it will be “remapped†to their new (concrete) locations if possible. This process can be accelerated by using the “zfs remap†command to proactively rewrite all indirect blocks that reference indirect (removed) vdevs. Note that when a device is removed, we do not verify the checksum of the data that is copied. This makes the process much faster, but if it were used on redundant vdevs (i.e. mirror or raidz vdevs), it would be possible to copy the wrong data, when we have the correct data on e.g. the other side of the mirror. Therefore, mirror and raidz devices can not be removed. Reviewed by: Alex Reece Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: Richard Laager Reviewed by: Tim Chase Approved by: Garrett D'Amore Author: Prashanth Sreenivasa Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_births.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_mapping.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_births.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/common/zfs/zfs_deleg.c vendor-sys/illumos/dist/common/zfs/zfs_deleg.h vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_reftree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/bpobj.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deadlist.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_debug.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_priority.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.c Sun Feb 18 01:21:52 2018 (r329502) @@ -246,4 +246,20 @@ zpool_feature_init(void) "org.illumos:edonr", "edonr", "Edon-R hash algorithm.", ZFEATURE_FLAG_PER_DATASET, NULL); + + zfeature_register(SPA_FEATURE_DEVICE_REMOVAL, + "com.delphix:device_removal", "device_removal", + "Top-level vdevs can be removed, reducing logical pool size.", + ZFEATURE_FLAG_MOS, NULL); + + static const spa_feature_t obsolete_counts_deps[] = { + SPA_FEATURE_EXTENSIBLE_DATASET, + SPA_FEATURE_DEVICE_REMOVAL, + SPA_FEATURE_NONE + }; + zfeature_register(SPA_FEATURE_OBSOLETE_COUNTS, + "com.delphix:obsolete_counts", "obsolete_counts", + "Reduce memory used by removed devices when their blocks are " + "freed or remapped.", + ZFEATURE_FLAG_READONLY_COMPAT, obsolete_counts_deps); } Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.h Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.h Sun Feb 18 01:21:52 2018 (r329502) @@ -56,6 +56,8 @@ typedef enum spa_feature { SPA_FEATURE_SHA512, SPA_FEATURE_SKEIN, SPA_FEATURE_EDONR, + SPA_FEATURE_DEVICE_REMOVAL, + SPA_FEATURE_OBSOLETE_COUNTS, SPA_FEATURES } spa_feature_t; Modified: vendor-sys/illumos/dist/common/zfs/zfs_deleg.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_deleg.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/common/zfs/zfs_deleg.c Sun Feb 18 01:21:52 2018 (r329502) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov */ @@ -53,6 +53,7 @@ zfs_deleg_perm_tab_t zfs_deleg_perm_tab[] = { {ZFS_DELEG_PERM_MOUNT}, {ZFS_DELEG_PERM_PROMOTE}, {ZFS_DELEG_PERM_RECEIVE}, + {ZFS_DELEG_PERM_REMAP}, {ZFS_DELEG_PERM_RENAME}, {ZFS_DELEG_PERM_ROLLBACK}, {ZFS_DELEG_PERM_SNAPSHOT}, Modified: vendor-sys/illumos/dist/common/zfs/zfs_deleg.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_deleg.h Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/common/zfs/zfs_deleg.h Sun Feb 18 01:21:52 2018 (r329502) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. */ #ifndef _ZFS_DELEG_H @@ -67,6 +67,7 @@ typedef enum { ZFS_DELEG_NOTE_RELEASE, ZFS_DELEG_NOTE_DIFF, ZFS_DELEG_NOTE_BOOKMARK, + ZFS_DELEG_NOTE_REMAP, ZFS_DELEG_NOTE_NONE } zfs_deleg_note_t; Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_prop.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/common/zfs/zfs_prop.c Sun Feb 18 01:21:52 2018 (r329502) @@ -420,6 +420,8 @@ zfs_prop_init(void) /* hidden properties */ zprop_register_hidden(ZFS_PROP_CREATETXG, "createtxg", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK, "CREATETXG"); + zprop_register_hidden(ZFS_PROP_REMAPTXG, "remaptxg", PROP_TYPE_NUMBER, + PROP_READONLY, ZFS_TYPE_DATASET, "REMAPTXG"); zprop_register_hidden(ZFS_PROP_NUMCLONES, "numclones", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_SNAPSHOT, "NUMCLONES"); zprop_register_hidden(ZFS_PROP_NAME, "name", PROP_TYPE_STRING, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Sun Feb 18 01:21:52 2018 (r329502) @@ -5009,7 +5009,7 @@ top: devw = hdr->b_l2hdr.b_dev->l2ad_writing; addr = hdr->b_l2hdr.b_daddr; /* - * Lock out device removal. + * Lock out L2ARC device removal. */ if (vdev_is_dead(vd) || !spa_config_tryenter(spa, SCL_L2ARC, vd, RW_READER)) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c Sun Feb 18 01:21:52 2018 (r329502) @@ -176,6 +176,12 @@ bpobj_open(bpobj_t *bpo, objset_t *os, uint64_t object return (0); } +boolean_t +bpobj_is_open(const bpobj_t *bpo) +{ + return (bpo->bpo_object != 0); +} + void bpobj_close(bpobj_t *bpo) { @@ -194,11 +200,11 @@ bpobj_close(bpobj_t *bpo) mutex_destroy(&bpo->bpo_lock); } -static boolean_t -bpobj_hasentries(bpobj_t *bpo) +boolean_t +bpobj_is_empty(bpobj_t *bpo) { - return (bpo->bpo_phys->bpo_num_blkptrs != 0 || - (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_num_subobjs != 0)); + return (bpo->bpo_phys->bpo_num_blkptrs == 0 && + (!bpo->bpo_havesubobj || bpo->bpo_phys->bpo_num_subobjs == 0)); } static int @@ -211,11 +217,9 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, vo int err = 0; dmu_buf_t *dbuf = NULL; + ASSERT(bpobj_is_open(bpo)); mutex_enter(&bpo->bpo_lock); - if (!bpobj_hasentries(bpo)) - goto out; - if (free) dmu_buf_will_dirty(bpo->bpo_dbuf, tx); @@ -345,7 +349,7 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, vo out: /* If there are no entries, there should be no bytes. */ - if (!bpobj_hasentries(bpo)) { + if (bpobj_is_empty(bpo)) { ASSERT0(bpo->bpo_phys->bpo_bytes); ASSERT0(bpo->bpo_phys->bpo_comp); ASSERT0(bpo->bpo_phys->bpo_uncomp); @@ -380,6 +384,8 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dm bpobj_t subbpo; uint64_t used, comp, uncomp, subsubobjs; + ASSERT(bpobj_is_open(bpo)); + ASSERT(subobj != 0); ASSERT(bpo->bpo_havesubobj); ASSERT(bpo->bpo_havecomp); ASSERT(bpo->bpo_object != dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj); @@ -392,7 +398,7 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dm VERIFY3U(0, ==, bpobj_open(&subbpo, bpo->bpo_os, subobj)); VERIFY3U(0, ==, bpobj_space(&subbpo, &used, &comp, &uncomp)); - if (!bpobj_hasentries(&subbpo)) { + if (bpobj_is_empty(&subbpo)) { /* No point in having an empty subobj. */ bpobj_close(&subbpo); bpobj_free(bpo->bpo_os, subobj, tx); @@ -466,6 +472,7 @@ bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, dmu_tx int blkoff; blkptr_t *bparray; + ASSERT(bpobj_is_open(bpo)); ASSERT(!BP_IS_HOLE(bp)); ASSERT(bpo->bpo_object != dmu_objset_pool(bpo->bpo_os)->dp_empty_bpobj); @@ -551,6 +558,7 @@ space_range_cb(void *arg, const blkptr_t *bp, dmu_tx_t int bpobj_space(bpobj_t *bpo, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp) { + ASSERT(bpobj_is_open(bpo)); mutex_enter(&bpo->bpo_lock); *usedp = bpo->bpo_phys->bpo_bytes; @@ -576,6 +584,8 @@ bpobj_space_range(bpobj_t *bpo, uint64_t mintxg, uint6 { struct space_range_arg sra = { 0 }; int err; + + ASSERT(bpobj_is_open(bpo)); /* * As an optimization, if they want the whole txg range, just Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Sun Feb 18 01:21:52 2018 (r329502) @@ -47,6 +47,7 @@ #include #include #include +#include uint_t zfs_dbuf_evict_key; @@ -3007,6 +3008,7 @@ dbuf_sync_indirect(dbuf_dirty_record_t *dr, dmu_tx_t * db->db_data_pending = dr; mutex_exit(&db->db_mtx); + dbuf_write(dr, db->db_buf, tx); zio = dr->dr_zio; @@ -3478,6 +3480,141 @@ dbuf_write_override_done(zio_t *zio) abd_put(zio->io_abd); } +typedef struct dbuf_remap_impl_callback_arg { + objset_t *drica_os; + uint64_t drica_blk_birth; + dmu_tx_t *drica_tx; +} dbuf_remap_impl_callback_arg_t; + +static void +dbuf_remap_impl_callback(uint64_t vdev, uint64_t offset, uint64_t size, + void *arg) +{ + dbuf_remap_impl_callback_arg_t *drica = arg; + objset_t *os = drica->drica_os; + spa_t *spa = dmu_objset_spa(os); + dmu_tx_t *tx = drica->drica_tx; + + ASSERT(dsl_pool_sync_context(spa_get_dsl(spa))); + + if (os == spa_meta_objset(spa)) { + spa_vdev_indirect_mark_obsolete(spa, vdev, offset, size, tx); + } else { + dsl_dataset_block_remapped(dmu_objset_ds(os), vdev, offset, + size, drica->drica_blk_birth, tx); + } +} + +static void +dbuf_remap_impl(dnode_t *dn, blkptr_t *bp, dmu_tx_t *tx) +{ + blkptr_t bp_copy = *bp; + spa_t *spa = dmu_objset_spa(dn->dn_objset); + dbuf_remap_impl_callback_arg_t drica; + + ASSERT(dsl_pool_sync_context(spa_get_dsl(spa))); + + drica.drica_os = dn->dn_objset; + drica.drica_blk_birth = bp->blk_birth; + drica.drica_tx = tx; + if (spa_remap_blkptr(spa, &bp_copy, dbuf_remap_impl_callback, + &drica)) { + /* + * The struct_rwlock prevents dbuf_read_impl() from + * dereferencing the BP while we are changing it. To + * avoid lock contention, only grab it when we are actually + * changing the BP. + */ + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + *bp = bp_copy; + rw_exit(&dn->dn_struct_rwlock); + } +} + +/* + * Returns true if a dbuf_remap would modify the dbuf. We do this by attempting + * to remap a copy of every bp in the dbuf. + */ +boolean_t +dbuf_can_remap(const dmu_buf_impl_t *db) +{ + spa_t *spa = dmu_objset_spa(db->db_objset); + blkptr_t *bp = db->db.db_data; + boolean_t ret = B_FALSE; + + ASSERT3U(db->db_level, >, 0); + ASSERT3S(db->db_state, ==, DB_CACHED); + + ASSERT(spa_feature_is_active(spa, SPA_FEATURE_DEVICE_REMOVAL)); + + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + for (int i = 0; i < db->db.db_size >> SPA_BLKPTRSHIFT; i++) { + blkptr_t bp_copy = bp[i]; + if (spa_remap_blkptr(spa, &bp_copy, NULL, NULL)) { + ret = B_TRUE; + break; + } + } + spa_config_exit(spa, SCL_VDEV, FTAG); + + return (ret); +} + +boolean_t +dnode_needs_remap(const dnode_t *dn) +{ + spa_t *spa = dmu_objset_spa(dn->dn_objset); + boolean_t ret = B_FALSE; + + if (dn->dn_phys->dn_nlevels == 0) { + return (B_FALSE); + } + + ASSERT(spa_feature_is_active(spa, SPA_FEATURE_DEVICE_REMOVAL)); + + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + for (int j = 0; j < dn->dn_phys->dn_nblkptr; j++) { + blkptr_t bp_copy = dn->dn_phys->dn_blkptr[j]; + if (spa_remap_blkptr(spa, &bp_copy, NULL, NULL)) { + ret = B_TRUE; + break; + } + } + spa_config_exit(spa, SCL_VDEV, FTAG); + + return (ret); +} + +/* + * Remap any existing BP's to concrete vdevs, if possible. + */ +static void +dbuf_remap(dnode_t *dn, dmu_buf_impl_t *db, dmu_tx_t *tx) +{ + spa_t *spa = dmu_objset_spa(db->db_objset); + ASSERT(dsl_pool_sync_context(spa_get_dsl(spa))); + + if (!spa_feature_is_active(spa, SPA_FEATURE_DEVICE_REMOVAL)) + return; + + if (db->db_level > 0) { + blkptr_t *bp = db->db.db_data; + for (int i = 0; i < db->db.db_size >> SPA_BLKPTRSHIFT; i++) { + dbuf_remap_impl(dn, &bp[i], tx); + } + } else if (db->db.db_object == DMU_META_DNODE_OBJECT) { + dnode_phys_t *dnp = db->db.db_data; + ASSERT3U(db->db_dnode_handle->dnh_dnode->dn_type, ==, + DMU_OT_DNODE); + for (int i = 0; i < db->db.db_size >> DNODE_SHIFT; i++) { + for (int j = 0; j < dnp[i].dn_nblkptr; j++) { + dbuf_remap_impl(dn, &dnp[i].dn_blkptr[j], tx); + } + } + } +} + + /* Issue I/O to commit a dirty buffer to disk. */ static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx) @@ -3511,6 +3648,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, d } else { dbuf_release_bp(db); } + dbuf_remap(dn, db, tx); } } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Sun Feb 18 01:21:52 2018 (r329502) @@ -704,15 +704,15 @@ ddt_lookup(ddt_t *ddt, const blkptr_t *bp, boolean_t a for (type = 0; type < DDT_TYPES; type++) { for (class = 0; class < DDT_CLASSES; class++) { error = ddt_object_lookup(ddt, type, class, dde); - if (error != ENOENT) + if (error != ENOENT) { + ASSERT0(error); break; + } } if (error != ENOENT) break; } - ASSERT(error == 0 || error == ENOENT); - ddt_enter(ddt); ASSERT(dde->dde_loaded == B_FALSE); @@ -1099,7 +1099,7 @@ ddt_sync(spa_t *spa, uint64_t txg) { dmu_tx_t *tx; zio_t *rio = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); ASSERT(spa_syncing_txg(spa) == txg); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sun Feb 18 01:21:52 2018 (r329502) @@ -65,6 +65,13 @@ int zfs_nopwrite_enabled = 1; */ uint32_t zfs_per_txg_dirty_frees_percent = 30; +/* + * This can be used for testing, to ensure that certain actions happen + * while in the middle of a remap (which might otherwise complete too + * quickly). + */ +int zfs_object_remap_one_indirect_delay_ticks = 0; + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, "object directory" }, @@ -1012,6 +1019,123 @@ dmu_write_by_dnode(dnode_t *dn, uint64_t offset, uint6 FALSE, FTAG, &numbufs, &dbp, DMU_READ_PREFETCH)); dmu_write_impl(dbp, numbufs, offset, size, buf, tx); dmu_buf_rele_array(dbp, numbufs, FTAG); +} + +static int +dmu_object_remap_one_indirect(objset_t *os, dnode_t *dn, + uint64_t last_removal_txg, uint64_t offset) +{ + uint64_t l1blkid = dbuf_whichblock(dn, 1, offset); + int err = 0; + + rw_enter(&dn->dn_struct_rwlock, RW_READER); + dmu_buf_impl_t *dbuf = dbuf_hold_level(dn, 1, l1blkid, FTAG); + ASSERT3P(dbuf, !=, NULL); + + /* + * If the block hasn't been written yet, this default will ensure + * we don't try to remap it. + */ + uint64_t birth = UINT64_MAX; + ASSERT3U(last_removal_txg, !=, UINT64_MAX); + if (dbuf->db_blkptr != NULL) + birth = dbuf->db_blkptr->blk_birth; + rw_exit(&dn->dn_struct_rwlock); + + /* + * If this L1 was already written after the last removal, then we've + * already tried to remap it. + */ + if (birth <= last_removal_txg && + dbuf_read(dbuf, NULL, DB_RF_MUST_SUCCEED) == 0 && + dbuf_can_remap(dbuf)) { + dmu_tx_t *tx = dmu_tx_create(os); + dmu_tx_hold_remap_l1indirect(tx, dn->dn_object); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err == 0) { + (void) dbuf_dirty(dbuf, tx); + dmu_tx_commit(tx); + } else { + dmu_tx_abort(tx); + } + } + + dbuf_rele(dbuf, FTAG); + + delay(zfs_object_remap_one_indirect_delay_ticks); + + return (err); +} + +/* + * Remap all blockpointers in the object, if possible, so that they reference + * only concrete vdevs. + * + * To do this, iterate over the L0 blockpointers and remap any that reference + * an indirect vdev. Note that we only examine L0 blockpointers; since we + * cannot guarantee that we can remap all blockpointer anyways (due to split + * blocks), we do not want to make the code unnecessarily complicated to + * catch the unlikely case that there is an L1 block on an indirect vdev that + * contains no indirect blockpointers. + */ +int +dmu_object_remap_indirects(objset_t *os, uint64_t object, + uint64_t last_removal_txg) +{ + uint64_t offset, l1span; + int err; + dnode_t *dn; + + err = dnode_hold(os, object, FTAG, &dn); + if (err != 0) { + return (err); + } + + if (dn->dn_nlevels <= 1) { + if (issig(JUSTLOOKING) && issig(FORREAL)) { + err = SET_ERROR(EINTR); + } + + /* + * If the dnode has no indirect blocks, we cannot dirty them. + * We still want to remap the blkptr(s) in the dnode if + * appropriate, so mark it as dirty. + */ + if (err == 0 && dnode_needs_remap(dn)) { + dmu_tx_t *tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, dn->dn_object); + if ((err = dmu_tx_assign(tx, TXG_WAIT)) == 0) { + dnode_setdirty(dn, tx); + dmu_tx_commit(tx); + } else { + dmu_tx_abort(tx); + } + } + + dnode_rele(dn, FTAG); + return (err); + } + + offset = 0; + l1span = 1ULL << (dn->dn_indblkshift - SPA_BLKPTRSHIFT + + dn->dn_datablkshift); + /* + * Find the next L1 indirect that is not a hole. + */ + while (dnode_next_offset(dn, 0, &offset, 2, 1, 0) == 0) { + if (issig(JUSTLOOKING) && issig(FORREAL)) { + err = SET_ERROR(EINTR); + break; + } + if ((err = dmu_object_remap_one_indirect(os, dn, + last_removal_txg, offset)) != 0) { + break; + } + offset += l1span; + } + + dnode_rele(dn, FTAG); + return (err); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Sun Feb 18 01:21:52 2018 (r329502) @@ -53,6 +53,7 @@ #include #include #include +#include /* * Needed to close a window in dnode_move() that allows the objset to be freed @@ -348,6 +349,17 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl ASSERT(ds == NULL || MUTEX_HELD(&ds->ds_opening_lock)); + /* + * The $ORIGIN dataset (if it exists) doesn't have an associated + * objset, so there's no reason to open it. The $ORIGIN dataset + * will not exist on pools older than SPA_VERSION_ORIGIN. + */ + if (ds != NULL && spa_get_dsl(spa) != NULL && + spa_get_dsl(spa)->dp_origin_snap != NULL) { + ASSERT3P(ds->ds_dir, !=, + spa_get_dsl(spa)->dp_origin_snap->ds_dir); + } + os = kmem_zalloc(sizeof (objset_t), KM_SLEEP); os->os_dsl_dataset = ds; os->os_spa = spa; @@ -1050,6 +1062,101 @@ dmu_objset_clone(const char *clone, const char *origin return (dsl_sync_task(clone, dmu_objset_clone_check, dmu_objset_clone_sync, &doca, 5, ZFS_SPACE_CHECK_NORMAL)); +} + +static int +dmu_objset_remap_indirects_impl(objset_t *os, uint64_t last_removed_txg) +{ + int error = 0; + uint64_t object = 0; + while ((error = dmu_object_next(os, &object, B_FALSE, 0)) == 0) { + error = dmu_object_remap_indirects(os, object, + last_removed_txg); + /* + * If the ZPL removed the object before we managed to dnode_hold + * it, we would get an ENOENT. If the ZPL declares its intent + * to remove the object (dnode_free) before we manage to + * dnode_hold it, we would get an EEXIST. In either case, we + * want to continue remapping the other objects in the objset; + * in all other cases, we want to break early. + */ + if (error != 0 && error != ENOENT && error != EEXIST) { + break; + } + } + if (error == ESRCH) { + error = 0; + } + return (error); +} + +int +dmu_objset_remap_indirects(const char *fsname) +{ + int error = 0; + objset_t *os = NULL; + uint64_t last_removed_txg; + uint64_t remap_start_txg; + dsl_dir_t *dd; + + error = dmu_objset_hold(fsname, FTAG, &os); + if (error != 0) { + return (error); + } + dd = dmu_objset_ds(os)->ds_dir; + + if (!spa_feature_is_enabled(dmu_objset_spa(os), + SPA_FEATURE_OBSOLETE_COUNTS)) { + dmu_objset_rele(os, FTAG); + return (SET_ERROR(ENOTSUP)); + } + + if (dsl_dataset_is_snapshot(dmu_objset_ds(os))) { + dmu_objset_rele(os, FTAG); + return (SET_ERROR(EINVAL)); + } + + /* + * If there has not been a removal, we're done. + */ + last_removed_txg = spa_get_last_removal_txg(dmu_objset_spa(os)); + if (last_removed_txg == -1ULL) { + dmu_objset_rele(os, FTAG); + return (0); + } + + /* + * If we have remapped since the last removal, we're done. + */ + if (dsl_dir_is_zapified(dd)) { + uint64_t last_remap_txg; + if (zap_lookup(spa_meta_objset(dmu_objset_spa(os)), + dd->dd_object, DD_FIELD_LAST_REMAP_TXG, + sizeof (last_remap_txg), 1, &last_remap_txg) == 0 && + last_remap_txg > last_removed_txg) { + dmu_objset_rele(os, FTAG); + return (0); + } + } + + dsl_dataset_long_hold(dmu_objset_ds(os), FTAG); + dsl_pool_rele(dmu_objset_pool(os), FTAG); + + remap_start_txg = spa_last_synced_txg(dmu_objset_spa(os)); + error = dmu_objset_remap_indirects_impl(os, last_removed_txg); + if (error == 0) { + /* + * We update the last_remap_txg to be the start txg so that + * we can guarantee that every block older than last_remap_txg + * that can be remapped has been remapped. + */ + error = dsl_dir_update_last_remap_txg(dd, remap_start_txg); + } + + dsl_dataset_long_rele(dmu_objset_ds(os), FTAG); + dsl_dataset_rele(dmu_objset_ds(os), FTAG); + + return (error); } int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Sun Feb 18 01:21:52 2018 (r329502) @@ -301,6 +301,23 @@ dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint6 } void +dmu_tx_hold_remap_l1indirect(dmu_tx_t *tx, uint64_t object) +{ + dmu_tx_hold_t *txh; + + ASSERT(tx->tx_txg == 0); + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + object, THT_WRITE, 0, 0); + if (txh == NULL) + return; + + dnode_t *dn = txh->txh_dnode; + (void) refcount_add_many(&txh->txh_space_towrite, + 1ULL << dn->dn_indblkshift, FTAG); + dmu_tx_count_dnode(txh); +} + +void dmu_tx_hold_write_by_dnode(dmu_tx_t *tx, dnode_t *dn, uint64_t off, int len) { dmu_tx_hold_t *txh; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c Sun Feb 18 01:21:52 2018 (r329502) @@ -211,8 +211,19 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblk int64_t pf_ahead_blks, max_blks; int epbs, max_dist_blks, pf_nblks, ipf_nblks; uint64_t end_of_access_blkid = blkid + nblks; + spa_t *spa = zf->zf_dnode->dn_objset->os_spa; if (zfs_prefetch_disable) + return; + + /* + * If we haven't yet loaded the indirect vdevs' mappings, we + * can only read from blocks that we carefully ensure are on + * concrete vdevs (or previously-loaded indirect vdevs). So we + * can't allow the predictive prefetcher to attempt reads of other + * blocks (e.g. of the MOS's dnode obejct). + */ + if (!spa_indirect_vdevs_loaded(spa)) return; /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sun Feb 18 01:21:52 2018 (r329502) @@ -1690,8 +1690,7 @@ done: mutex_enter(&dn->dn_mtx); int txgoff = tx->tx_txg & TXG_MASK; if (dn->dn_free_ranges[txgoff] == NULL) { - dn->dn_free_ranges[txgoff] = - range_tree_create(NULL, NULL, &dn->dn_mtx); + dn->dn_free_ranges[txgoff] = range_tree_create(NULL, NULL); } range_tree_clear(dn->dn_free_ranges[txgoff], blkid, nblks); range_tree_add(dn->dn_free_ranges[txgoff], blkid, nblks); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Sun Feb 18 01:16:37 2018 (r329501) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Sun Feb 18 01:21:52 2018 (r329502) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,11 @@ int zfs_max_recordsize = 1 * 1024 * 1024; extern inline dsl_dataset_phys_t *dsl_dataset_phys(dsl_dataset_t *ds); +static void dsl_dataset_set_remap_deadlist_object(dsl_dataset_t *ds, + uint64_t obj, dmu_tx_t *tx); +static void dsl_dataset_unset_remap_deadlist_object(dsl_dataset_t *ds, + dmu_tx_t *tx); + extern int spa_asize_inflation; static zil_header_t zero_zil; @@ -154,6 +160,47 @@ dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr DD_USED_REFRSRV, DD_USED_HEAD, tx); } +/* + * Called when the specified segment has been remapped, and is thus no + * longer referenced in the head dataset. The vdev must be indirect. + * + * If the segment is referenced by a snapshot, put it on the remap deadlist. + * Otherwise, add this segment to the obsolete spacemap. + */ +void +dsl_dataset_block_remapped(dsl_dataset_t *ds, uint64_t vdev, uint64_t offset, + uint64_t size, uint64_t birth, dmu_tx_t *tx) +{ + spa_t *spa = ds->ds_dir->dd_pool->dp_spa; + + ASSERT(dmu_tx_is_syncing(tx)); + ASSERT(birth <= tx->tx_txg); + ASSERT(!ds->ds_is_snapshot); + + if (birth > dsl_dataset_phys(ds)->ds_prev_snap_txg) { + spa_vdev_indirect_mark_obsolete(spa, vdev, offset, size, tx); + } else { + blkptr_t fakebp; + dva_t *dva = &fakebp.blk_dva[0]; + + ASSERT(ds != NULL); + + mutex_enter(&ds->ds_remap_deadlist_lock); + if (!dsl_dataset_remap_deadlist_exists(ds)) { + dsl_dataset_create_remap_deadlist(ds, tx); + } + mutex_exit(&ds->ds_remap_deadlist_lock); + + BP_ZERO(&fakebp); + fakebp.blk_birth = birth; + DVA_SET_VDEV(dva, vdev); + DVA_SET_OFFSET(dva, offset); + DVA_SET_ASIZE(dva, size); + + dsl_deadlist_insert(&ds->ds_remap_deadlist, &fakebp, tx); + } +} + int dsl_dataset_block_kill(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx, boolean_t async) @@ -272,8 +319,10 @@ dsl_dataset_evict_async(void *dbu) } bplist_destroy(&ds->ds_pending_deadlist); - if (ds->ds_deadlist.dl_os != NULL) + if (dsl_deadlist_is_open(&ds->ds_deadlist)) dsl_deadlist_close(&ds->ds_deadlist); + if (dsl_deadlist_is_open(&ds->ds_remap_deadlist)) + dsl_deadlist_close(&ds->ds_remap_deadlist); if (ds->ds_dir) dsl_dir_async_rele(ds->ds_dir, ds); @@ -283,6 +332,7 @@ dsl_dataset_evict_async(void *dbu) mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); mutex_destroy(&ds->ds_sendstream_lock); + mutex_destroy(&ds->ds_remap_deadlist_lock); refcount_destroy(&ds->ds_longholds); rrw_destroy(&ds->ds_bp_rwlock); @@ -407,15 +457,23 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v ds->ds_object = dsobj; ds->ds_is_snapshot = dsl_dataset_phys(ds)->ds_num_children != 0; + err = dsl_dir_hold_obj(dp, dsl_dataset_phys(ds)->ds_dir_obj, + NULL, ds, &ds->ds_dir); + if (err != 0) { + kmem_free(ds, sizeof (dsl_dataset_t)); + dmu_buf_rele(dbuf, tag); + return (err); + } + mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&ds->ds_opening_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&ds->ds_sendstream_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&ds->ds_remap_deadlist_lock, + NULL, MUTEX_DEFAULT, NULL); rrw_init(&ds->ds_bp_rwlock, B_FALSE); refcount_create(&ds->ds_longholds); bplist_create(&ds->ds_pending_deadlist); - dsl_deadlist_open(&ds->ds_deadlist, - mos, dsl_dataset_phys(ds)->ds_deadlist_obj); list_create(&ds->ds_sendstreams, sizeof (dmu_sendarg_t), offsetof(dmu_sendarg_t, dsa_link)); @@ -439,20 +497,6 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v } } - err = dsl_dir_hold_obj(dp, - dsl_dataset_phys(ds)->ds_dir_obj, NULL, ds, &ds->ds_dir); - if (err != 0) { - mutex_destroy(&ds->ds_lock); - mutex_destroy(&ds->ds_opening_lock); - mutex_destroy(&ds->ds_sendstream_lock); - refcount_destroy(&ds->ds_longholds); - bplist_destroy(&ds->ds_pending_deadlist); - dsl_deadlist_close(&ds->ds_deadlist); - kmem_free(ds, sizeof (dsl_dataset_t)); - dmu_buf_rele(dbuf, tag); - return (err); - } - if (!ds->ds_is_snapshot) { ds->ds_snapname[0] = '\0'; if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) { @@ -493,6 +537,15 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v ds->ds_reserved = ds->ds_quota = 0; } + dsl_deadlist_open(&ds->ds_deadlist, + mos, dsl_dataset_phys(ds)->ds_deadlist_obj); + uint64_t remap_deadlist_obj = + dsl_dataset_get_remap_deadlist_object(ds); + if (remap_deadlist_obj != 0) { + dsl_deadlist_open(&ds->ds_remap_deadlist, mos, + remap_deadlist_obj); + } + dmu_buf_init_user(&ds->ds_dbu, dsl_dataset_evict_sync, dsl_dataset_evict_async, &ds->ds_dbuf); if (err == 0) @@ -501,6 +554,8 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v if (err != 0 || winner != NULL) { bplist_destroy(&ds->ds_pending_deadlist); dsl_deadlist_close(&ds->ds_deadlist); + if (dsl_deadlist_is_open(&ds->ds_remap_deadlist)) + dsl_deadlist_close(&ds->ds_remap_deadlist); if (ds->ds_prev) dsl_dataset_rele(ds->ds_prev, ds); dsl_dir_rele(ds->ds_dir, ds); @@ -1393,10 +1448,27 @@ dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, cons dsl_deadlist_add_key(&ds->ds_deadlist, dsl_dataset_phys(ds)->ds_prev_snap_txg, tx); + if (dsl_dataset_remap_deadlist_exists(ds)) { + uint64_t remap_deadlist_obj = + dsl_dataset_get_remap_deadlist_object(ds); + /* + * Move the remap_deadlist to the snapshot. The head + * will create a new remap deadlist on demand, from + * dsl_dataset_block_remapped(). + */ + dsl_dataset_unset_remap_deadlist_object(ds, tx); + dsl_deadlist_close(&ds->ds_remap_deadlist); + + dmu_object_zapify(mos, dsobj, DMU_OT_DSL_DATASET, tx); + VERIFY0(zap_add(mos, dsobj, DS_FIELD_REMAP_DEADLIST, + sizeof (remap_deadlist_obj), 1, &remap_deadlist_obj, tx)); + } + ASSERT3U(dsl_dataset_phys(ds)->ds_prev_snap_txg, <, tx->tx_txg); dsl_dataset_phys(ds)->ds_prev_snap_obj = dsobj; dsl_dataset_phys(ds)->ds_prev_snap_txg = crtxg; dsl_dataset_phys(ds)->ds_unique_bytes = 0; + if (spa_version(dp->dp_spa) >= SPA_VERSION_UNIQUE_ACCURATE) dsl_dataset_phys(ds)->ds_flags |= DS_FLAG_UNIQUE_ACCURATE; @@ -3233,6 +3305,41 @@ dsl_dataset_clone_swap_check_impl(dsl_dataset_t *clone return (0); } +static void +dsl_dataset_swap_remap_deadlists(dsl_dataset_t *clone, + dsl_dataset_t *origin, dmu_tx_t *tx) +{ + uint64_t clone_remap_dl_obj, origin_remap_dl_obj; + dsl_pool_t *dp = dmu_tx_pool(tx); + + ASSERT(dsl_pool_sync_context(dp)); + + clone_remap_dl_obj = dsl_dataset_get_remap_deadlist_object(clone); + origin_remap_dl_obj = dsl_dataset_get_remap_deadlist_object(origin); + + if (clone_remap_dl_obj != 0) { + dsl_deadlist_close(&clone->ds_remap_deadlist); + dsl_dataset_unset_remap_deadlist_object(clone, tx); + } + if (origin_remap_dl_obj != 0) { + dsl_deadlist_close(&origin->ds_remap_deadlist); + dsl_dataset_unset_remap_deadlist_object(origin, tx); + } + + if (clone_remap_dl_obj != 0) { + dsl_dataset_set_remap_deadlist_object(origin, + clone_remap_dl_obj, tx); + dsl_deadlist_open(&origin->ds_remap_deadlist, + dp->dp_meta_objset, clone_remap_dl_obj); + } + if (origin_remap_dl_obj != 0) { + dsl_dataset_set_remap_deadlist_object(clone, + origin_remap_dl_obj, tx); + dsl_deadlist_open(&clone->ds_remap_deadlist, + dp->dp_meta_objset, origin_remap_dl_obj); + } +} + void dsl_dataset_clone_swap_sync_impl(dsl_dataset_t *clone, dsl_dataset_t *origin_head, dmu_tx_t *tx) @@ -3402,6 +3509,7 @@ dsl_dataset_clone_swap_sync_impl(dsl_dataset_t *clone, dsl_dataset_phys(clone)->ds_deadlist_obj); dsl_deadlist_open(&origin_head->ds_deadlist, dp->dp_meta_objset, dsl_dataset_phys(origin_head)->ds_deadlist_obj); + dsl_dataset_swap_remap_deadlists(clone, origin_head, tx); dsl_scan_ds_clone_swapped(origin_head, clone, tx); @@ -3908,4 +4016,91 @@ dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds return (dsl_dataset_is_zapified(ds) && zap_contains(ds->ds_dir->dd_pool->dp_meta_objset, ds->ds_object, DS_FIELD_RESUME_TOGUID) == 0); +} + +uint64_t +dsl_dataset_get_remap_deadlist_object(dsl_dataset_t *ds) +{ + uint64_t remap_deadlist_obj; + int err; + + if (!dsl_dataset_is_zapified(ds)) + return (0); + + err = zap_lookup(ds->ds_dir->dd_pool->dp_meta_objset, ds->ds_object, + DS_FIELD_REMAP_DEADLIST, sizeof (remap_deadlist_obj), 1, + &remap_deadlist_obj); + + if (err != 0) { + VERIFY3S(err, ==, ENOENT); + return (0); + } + + ASSERT(remap_deadlist_obj != 0); + return (remap_deadlist_obj); +} + +boolean_t +dsl_dataset_remap_deadlist_exists(dsl_dataset_t *ds) +{ + EQUIV(dsl_deadlist_is_open(&ds->ds_remap_deadlist), + dsl_dataset_get_remap_deadlist_object(ds) != 0); + return (dsl_deadlist_is_open(&ds->ds_remap_deadlist)); +} + +static void +dsl_dataset_set_remap_deadlist_object(dsl_dataset_t *ds, uint64_t obj, + dmu_tx_t *tx) +{ + ASSERT(obj != 0); + dsl_dataset_zapify(ds, tx); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Feb 18 01:31:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1494FF0015E; Sun, 18 Feb 2018 01:31:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6EB6799C6; Sun, 18 Feb 2018 01:31:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1D2D24C85; Sun, 18 Feb 2018 01:31:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1VIpx096300; Sun, 18 Feb 2018 01:31:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1VI13096299; Sun, 18 Feb 2018 01:31:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180131.w1I1VI13096299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 01:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329503 - head/stand/liblua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/liblua X-SVN-Commit-Revision: 329503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:31:19 -0000 Author: kevans Date: Sun Feb 18 01:31:18 2018 New Revision: 329503 URL: https://svnweb.freebsd.org/changeset/base/329503 Log: liblua: Fix missing '}' in lutil.c after r329499 Modified: head/stand/liblua/lutils.c Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Sun Feb 18 01:21:52 2018 (r329502) +++ head/stand/liblua/lutils.c Sun Feb 18 01:31:18 2018 (r329503) @@ -245,3 +245,4 @@ luaopen_io(lua_State *L) { luaL_newlib(L, iolib); return 1; +} From owner-svn-src-all@freebsd.org Sun Feb 18 01:35:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52C0FF007D0; Sun, 18 Feb 2018 01:35:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 085C379D2D; Sun, 18 Feb 2018 01:35:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 033E024CEC; Sun, 18 Feb 2018 01:35:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1Zk2t097493; Sun, 18 Feb 2018 01:35:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1ZkcF097492; Sun, 18 Feb 2018 01:35:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802180135.w1I1ZkcF097492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Feb 2018 01:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329504 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:35:47 -0000 Author: kevans Date: Sun Feb 18 01:35:46 2018 New Revision: 329504 URL: https://svnweb.freebsd.org/changeset/base/329504 Log: stand/lua: More style nits, config.lua Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'not' for things that reasonably won't be returning a boolean. e.g. loader.getenv Eventually this will all get formalized somewhere. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Feb 18 01:31:18 2018 (r329503) +++ head/stand/lua/config.lua Sun Feb 18 01:35:46 2018 (r329504) @@ -31,7 +31,7 @@ local config = {}; local modules = {}; function config.setKey(k, n, v) - if modules[k] == nil then + if (modules[k] == nil) then modules[k] = {}; end modules[k][n] = v; @@ -54,7 +54,7 @@ local pattern_table = { [2] = { str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if modules[k] == nil then + if (modules[k] == nil) then modules[k] = {}; end modules[k].load = v:upper(); @@ -106,8 +106,8 @@ local pattern_table = { [9] = { str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if loader.perform(k) ~= 0 then - print("Failed to exec '"..k.."'"); + if (loader.perform(k) ~= 0) then + print("Failed to exec '" .. k .. "'"); end end }, @@ -115,8 +115,9 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if loader.setenv(k, v) ~= 0 then - print("Failed to set '"..k.."' with value: "..v..""); + if (loader.setenv(k, v) ~= 0) then + print("Failed to set '" .. k .. + "' with value: " .. v .. ""); end end }, @@ -124,20 +125,21 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if loader.setenv(k, v) ~= 0 then - print("Failed to set '"..k.."' with value: "..v..""); + if (loader.setenv(k, v) ~= 0) then + print("Failed to set '" .. k .. + "' with value: " .. v .. ""); end end } }; function config.isValidComment(c) - if c ~= nil then + if (c ~= nil) then local s = c:match("^%s*#.*"); - if s == nil then + if (s == nil) then s = c:match("^%s*$"); end - if s == nil then + if (s == nil) then return false; end end @@ -147,43 +149,50 @@ end function config.loadmod(mod, silent) local status = true; for k, v in pairs(mod) do - if v.load == "YES" then + if (v.load == "YES") then local str = "load "; - if v.flags ~= nil then + if (v.flags ~= nil) then str = str .. v.flags .. " "; end - if v.type ~= nil then + if (v.type ~= nil) then str = str .. "-t " .. v.type .. " "; end - if v.name ~= nil then + if (v.name ~= nil) then str = str .. v.name; else str = str .. k; end - if v.before ~= nil then - if loader.perform(v.before) ~= 0 then - if not silent then - print("Failed to execute '"..v.before.."' before loading '"..k.."'"); + if (v.before ~= nil) then + if (loader.perform(v.before) ~= 0) then + if (not silent) then + print("Failed to execute '" .. + v.before .. + "' before loading '".. k .. + "'"); end status = false; end end - if loader.perform(str) ~= 0 then - if not silent then - print("Failed to execute '" .. str .. "'"); + if (loader.perform(str) ~= 0) then + if (not silent) then + print("Failed to execute '" .. str .. + "'"); end - if v.error ~= nil then + if (v.error ~= nil) then loader.perform(v.error); end status = false; end - if v.after ~= nil then - if loader.perform(v.after) ~= 0 then - if not silent then - print("Failed to execute '"..v.after.."' after loading '"..k.."'"); + if (v.after ~= nil) then + if (loader.perform(v.after) ~= 0) then + if (not silent) then + print("Failed to execute '" .. + v.after .. + "' after loading '" .. k .. + "'"); end status = false; end @@ -199,9 +208,9 @@ end function config.parse(name, silent) local f = io.open(name); - if f == nil then - if not silent then - print("Failed to open config: '" .. name.."'"); + if (f == nil) then + if (not silent) then + print("Failed to open config: '" .. name .. "'"); end return false; end @@ -211,9 +220,9 @@ function config.parse(name, silent) text, r = io.read(f); - if text == nil then - if not silent then - print("Failed to read config: '" .. name.."'"); + if (text == nil) then + if (not silent) then + print("Failed to read config: '" .. name .. "'"); end return false; end @@ -222,19 +231,19 @@ function config.parse(name, silent) local status = true; for line in text:gmatch("([^\n]+)") do - - if line:match("^%s*$") == nil then + if (line:match("^%s*$") == nil) then local found = false; for i, val in ipairs(pattern_table) do local k, v, c = line:match(val.str); - if k ~= nil then + if (k ~= nil) then found = true; - if config.isValidComment(c) then + if (config.isValidComment(c)) then val.process(k, v); else - print("Malformed line ("..n.."):\n\t'"..line.."'"); + print("Malformed line (" .. n .. + "):\n\t'" .. line .. "'"); status = false; end @@ -242,8 +251,9 @@ function config.parse(name, silent) end end - if found == false then - print("Malformed line ("..n.."):\n\t'"..line.."'"); + if (found == false) then + print("Malformed line (" .. n .. "):\n\t'" .. + line .. "'"); status = false; end end @@ -261,8 +271,8 @@ function config.loadkernel(other_kernel) local try_load = function (names) for name in names:gmatch("([^;]+)%s*;?") do - r = loader.perform("load "..flags.." "..name); - if r == 0 then + r = loader.perform("load " .. flags .. " " .. name); + if (r == 0) then return name; end end @@ -273,20 +283,20 @@ function config.loadkernel(other_kernel) local bootfile = loader.getenv("bootfile"); -- append default kernel name - if not bootfile then + if (bootfile == nil) then bootfile = "kernel"; else - bootfile = bootfile..";kernel"; + bootfile = bootfile .. ";kernel"; end return try_load(bootfile); end -- kernel not set, try load from default module_path - if kernel == nil then + if (kernel == nil) then local res = load_bootfile(); - if res ~= nil then + if (res ~= nil) then return true; else print("No kernel set, failed to load from module_path"); @@ -298,22 +308,21 @@ function config.loadkernel(other_kernel) local module_path = config.module_path; local res = nil; - if other_kernel ~= nil then + if (other_kernel ~= nil) then kernel = other_kernel; end -- first try load kernel with module_path = /boot/${kernel} -- then try load with module_path=${kernel} - local paths = {"/boot/"..kernel, kernel}; + local paths = {"/boot/" .. kernel, kernel}; for k,v in pairs(paths) do - loader.setenv("module_path", v); res = load_bootfile(); -- succeeded, add path to module_path - if res ~= nil then + if (res ~= nil) then if (module_path ~= nil) then - loader.setenv("module_path", v..";".. + loader.setenv("module_path", v .. ";" .. module_path); end return true; @@ -323,10 +332,10 @@ function config.loadkernel(other_kernel) -- failed to load with ${kernel} as a directory -- try as a file res = try_load(kernel); - if res ~= nil then + if (res ~= nil) then return true; else - print("Failed to load kernel '"..kernel.."'"); + print("Failed to load kernel '" .. kernel .. "'"); return false; end end @@ -334,20 +343,20 @@ end function config.load(file) - - if not file then + if (not file) then file = "/boot/defaults/loader.conf"; end - if not config.parse(file) then --- print("Failed to parse configuration: '"..file.."'"); + if (not config.parse(file)) then +-- print("Failed to parse configuration: '" .. file .. "'"); end local f = loader.getenv("loader_conf_files"); - if f ~= nil then + if (f ~= nil) then for name in f:gmatch("([%w%p]+)%s*") do - if not config.parse(name) then --- print("Failed to parse configuration: '"..name.."'"); + if (not config.parse(name)) then +-- print("Failed to parse configuration: '" .. +-- name .. "'"); end end end @@ -359,7 +368,7 @@ function config.load(file) config.loadkernel(); print("Loading configured modules..."); - if not config.loadmod(modules) then + if (not config.loadmod(modules)) then print("Could not load one or more modules!"); end end @@ -375,7 +384,7 @@ function config.reload(kernel) print("Trying to load '" .. kernel .. "'") kernel_loaded = config.loadkernel(kernel); if (kernel_loaded) then - print("Kernel '"..kernel.."' loaded!"); + print("Kernel '" .. kernel .. "' loaded!"); end end From owner-svn-src-all@freebsd.org Sun Feb 18 01:42:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFAF7F0128A; Sun, 18 Feb 2018 01:42:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A9C97A4A7; Sun, 18 Feb 2018 01:42:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f54.google.com with SMTP id l191so8740430lfe.1; Sat, 17 Feb 2018 17:42:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f9M+9+EDUSIWRlrl1ZAXP7voQ0lZ7SVHO+cwMxC1x6c=; b=DCtPy+4757rfiJ2gYmONLNUv9siAVyHsCjenT4upEBzHGmIfKHZWrlAmJ4hC+u1PxY /gv6mQpL6edtu49wOey4GuQSHhn0AQm6mFgldRMFeAq7Fm1dD92xHScbVdLAy9iSzaRr 345TDKoVCeTYn84P+KKVhOKeXut4wfHmitUwi6FCpe/Sh3Su2tePUivyPsY/9Rbg49hA 8cmcAvUu2Shtjs5KFdvsQ81kUlXWr3TenBIdrfDNO0qBnuznzUBQJfML5Hw5dRASj2nl CQhKaoUX4ucUwXjATLBXPKgjBLd6tchS3inMDHJubIBu1CpraDjvZrs+iLw62djRb8oN OSJg== X-Gm-Message-State: APf1xPBOoOijIsv2uh5dy7DSv9eAolDmiPpaFBzJLQ6yzIw0tsknL7Lr AfdzW/dQe1dn4DoKyyDkQ5Vdv9eZ X-Google-Smtp-Source: AH8x2252941PPFF/m5jHJAJ3Zdwm/jwM3iNnsZPU8a7rRi/6e4+hP8ZdcgLRvBR2yOPSG3LzzfKgkQ== X-Received: by 10.25.18.208 with SMTP id 77mr6764888lfs.63.1518918121412; Sat, 17 Feb 2018 17:42:01 -0800 (PST) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com. [209.85.215.47]) by smtp.gmail.com with ESMTPSA id b13sm4372466lfb.27.2018.02.17.17.42.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 17:42:01 -0800 (PST) Received: by mail-lf0-f47.google.com with SMTP id f136so8725546lff.8; Sat, 17 Feb 2018 17:42:01 -0800 (PST) X-Received: by 10.25.154.205 with SMTP id c196mr6895370lfe.52.1518918121019; Sat, 17 Feb 2018 17:42:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Sat, 17 Feb 2018 17:41:40 -0800 (PST) In-Reply-To: <201802172305.w1HN5J6T021285@repo.freebsd.org> References: <201802172305.w1HN5J6T021285@repo.freebsd.org> From: Kyle Evans Date: Sat, 17 Feb 2018 19:41:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329478 - stable/11/cddl/contrib/opensolaris/cmd/zpool To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:42:09 -0000 On Sat, Feb 17, 2018 at 5:05 PM, Alexander Motin wrote: > Author: mav > Date: Sat Feb 17 23:05:19 2018 > New Revision: 329478 > URL: https://svnweb.freebsd.org/changeset/base/329478 > > Log: > MFC r319671: > SHA-512 and Skein have been supported by the boot loader for some time. > Whoops, sorry for missing that when I MFC'd the skein bits. Thanks! From owner-svn-src-all@freebsd.org Sun Feb 18 01:42:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC9FEF012DC; Sun, 18 Feb 2018 01:42:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D3997A5A3; Sun, 18 Feb 2018 01:42:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDD0C24E9C; Sun, 18 Feb 2018 01:42:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1gH2U000275; Sun, 18 Feb 2018 01:42:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1gH4v000274; Sun, 18 Feb 2018 01:42:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180142.w1I1gH4v000274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 01:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329505 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:42:19 -0000 Author: mav Date: Sun Feb 18 01:42:17 2018 New Revision: 329505 URL: https://svnweb.freebsd.org/changeset/base/329505 Log: MFV r323911: 8502 illumos#7955 broke delegated datasets when libshare is not present illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://www.illumos.org/issues/8502 The code in lib/libzfs/common/libzfs_mount.c already basically handles the case when libshare is not installed. We just need to not fail in zfs_init_libshare_impl. I tested this in lx and things work as expected. I also tested there trying to set sharenfs and sharesmb on the delegated dataset. Neither is allowed from within a zone. The spew of msgs from a native zone is not ZFS specific. I see the same spew simply running the share command. Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Jerry Jelinek Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun Feb 18 01:35:46 2018 (r329504) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Sun Feb 18 01:42:17 2018 (r329505) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. */ @@ -610,8 +611,14 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic int ret = SA_OK; #ifdef illumos + /* + * libshare is either not installed or we're in a branded zone. The + * rest of the wrapper functions around the libshare calls already + * handle NULL function pointers, but we don't want the callers of + * zfs_init_libshare() to fail prematurely if libshare is not available. + */ if (_sa_init == NULL) - ret = SA_CONFIG_ERR; + return (SA_OK); if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { /* From owner-svn-src-all@freebsd.org Sun Feb 18 02:01:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF84CF02EEB; Sun, 18 Feb 2018 02:01:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 924DD7B35B; Sun, 18 Feb 2018 02:01:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D62E251D7; Sun, 18 Feb 2018 02:01:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I21fJX009392; Sun, 18 Feb 2018 02:01:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I21fiD009391; Sun, 18 Feb 2018 02:01:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802180201.w1I21fiD009391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 02:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329506 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 329506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 02:01:42 -0000 Author: ian Date: Sun Feb 18 02:01:41 2018 New Revision: 329506 URL: https://svnweb.freebsd.org/changeset/base/329506 Log: Add a detach method so that this can be a kldunload-friendly module. Modified: head/sys/arm/freescale/imx/imx_i2c.c Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 01:42:17 2018 (r329505) +++ head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 02:01:41 2018 (r329506) @@ -154,6 +154,7 @@ struct i2c_softc { static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); +static int i2c_detach(device_t); static int i2c_repeated_start(device_t, u_char, int); static int i2c_start(device_t, u_char, int); @@ -165,6 +166,7 @@ static int i2c_write(device_t, const char *, int, int static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), DEVMETHOD(device_attach, i2c_attach), + DEVMETHOD(device_detach, i2c_detach), /* OFW methods */ DEVMETHOD(ofw_bus_get_node, i2c_get_node), @@ -445,6 +447,28 @@ no_recovery: /* Probe and attach the iicbus when interrupts are available. */ config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + return (0); +} + +static int +i2c_detach(device_t dev) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + if ((error = bus_generic_detach(sc->dev)) != 0) { + device_printf(sc->dev, "cannot detach child devices\n"); + return (error); + } + + if (sc->iicbus != NULL) + device_delete_child(dev, sc->iicbus); + + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + return (0); } From owner-svn-src-all@freebsd.org Sun Feb 18 02:48:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A1E8F06F4F; Sun, 18 Feb 2018 02:48:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EBBC7D254; Sun, 18 Feb 2018 02:48:27 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f170.google.com with SMTP id l12so2281739ioc.10; Sat, 17 Feb 2018 18:48:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=llwpb846VJyDhPnyl7n5i/dDBmwmp5dMvUgnNFkdvBs=; b=XkrjgtLRspwgXe/m8fqUlnu/UN6+T1PGcn0Peh9p5pVl7ok1AmeFDYPZ4PnZAr7txb 1n/EFr27wqQ27bWozw+J+Nm1ttnN0CYKcBdVW54LIFP1lnpw22AimJxLdYuXG9abovI2 UjXYytYH5Wt3BUIYGors71hSCVOZaMSP/nBQDoLHrXVch7LmN55M553Wvo4bNJL8/cKz VpYvAN6U0eB6vEhHl7MnH4+ZyyX68LCKf0Tr+MoK9Ai1vh2P3oWTL+tDy/bc77fbg1Cv dSmEbkjvpOXaUd4eucAbfWirvDtUeLjNCmVJs5Yhjk1cpPHuBrMUfueMgSqcWJNs2ts2 EwIw== X-Gm-Message-State: APf1xPBJJXOKF3zLrNa9/znD93pTfIwEjFGGBBV87AS4+PvTMJMc98vE ctXjdCqbaLa+Ji3co/XVNEGTvXNf X-Google-Smtp-Source: AH8x224rmdd9BQqWlz4pEx66TC8susCZ9H8qTzjF61dRmoiodFpIXFRItk6BSpxGwAUUVyp55SX3Rw== X-Received: by 10.107.8.2 with SMTP id 2mr14057760ioi.167.1518922101099; Sat, 17 Feb 2018 18:48:21 -0800 (PST) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id j2sm4030436iob.43.2018.02.17.18.48.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 18:48:20 -0800 (PST) Received: by mail-it0-f52.google.com with SMTP id q4so1059145itc.0; Sat, 17 Feb 2018 18:48:20 -0800 (PST) X-Received: by 10.36.29.81 with SMTP id 78mr14453772itj.53.1518922099961; Sat, 17 Feb 2018 18:48:19 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Sat, 17 Feb 2018 18:48:19 -0800 (PST) In-Reply-To: <201802180131.w1I1VI13096299@repo.freebsd.org> References: <201802180131.w1I1VI13096299@repo.freebsd.org> From: Conrad Meyer Date: Sat, 17 Feb 2018 18:48:19 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329503 - head/stand/liblua To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 02:48:28 -0000 Thanks! I must have mismerged a rebase conflict. On Sat, Feb 17, 2018 at 5:31 PM, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 18 01:31:18 2018 > New Revision: 329503 > URL: https://svnweb.freebsd.org/changeset/base/329503 > > Log: > liblua: Fix missing '}' in lutil.c after r329499 > > Modified: > head/stand/liblua/lutils.c > > Modified: head/stand/liblua/lutils.c > ============================================================================== > --- head/stand/liblua/lutils.c Sun Feb 18 01:21:52 2018 (r329502) > +++ head/stand/liblua/lutils.c Sun Feb 18 01:31:18 2018 (r329503) > @@ -245,3 +245,4 @@ luaopen_io(lua_State *L) > { > luaL_newlib(L, iolib); > return 1; > +} > From owner-svn-src-all@freebsd.org Sun Feb 18 02:48:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CF12F06FF8; Sun, 18 Feb 2018 02:48:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F16937D38D; Sun, 18 Feb 2018 02:48:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC59125900; Sun, 18 Feb 2018 02:48:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I2msl1032591; Sun, 18 Feb 2018 02:48:54 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I2msP3032586; Sun, 18 Feb 2018 02:48:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802180248.w1I2msP3032586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 02:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329507 - in head/sys: arm/conf modules modules/imx modules/imx/imx_i2c X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/conf modules modules/imx modules/imx/imx_i2c X-SVN-Commit-Revision: 329507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 02:48:55 -0000 Author: ian Date: Sun Feb 18 02:48:54 2018 New Revision: 329507 URL: https://svnweb.freebsd.org/changeset/base/329507 Log: Build modules specific to imx5/imx6 only when building those kernels. This adds sys/modules/imx with a SUBDIR makefile to make the whole collection of modules that are specific to these SoCs. Initially, that "whole collection" consists of the if_ffec and imx_i2c drivers. The if_ffec driver is referenced in its existing home in ../ffec rather than moving it into the imx directory, because it's used by powerpc too, but it is no longer built for all armv6/7 systems. The imx_i2c driver is newly added as a module. Added: head/sys/modules/imx/ head/sys/modules/imx/Makefile (contents, props changed) head/sys/modules/imx/imx_i2c/ head/sys/modules/imx/imx_i2c/Makefile (contents, props changed) Modified: head/sys/arm/conf/IMX53 head/sys/arm/conf/IMX6 head/sys/modules/Makefile Modified: head/sys/arm/conf/IMX53 ============================================================================== --- head/sys/arm/conf/IMX53 Sun Feb 18 02:01:41 2018 (r329506) +++ head/sys/arm/conf/IMX53 Sun Feb 18 02:48:54 2018 (r329507) @@ -117,6 +117,6 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx5 +makeoptions MODULES_EXTRA="dtb/imx5 imx" options INTRNG Modified: head/sys/arm/conf/IMX6 ============================================================================== --- head/sys/arm/conf/IMX6 Sun Feb 18 02:01:41 2018 (r329506) +++ head/sys/arm/conf/IMX6 Sun Feb 18 02:48:54 2018 (r329507) @@ -117,7 +117,7 @@ device hdmi # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx6 +makeoptions MODULES_EXTRA="dtb/imx6 imx" # SoC-specific devices device ffec # Freescale Fast Ethernet Controller Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Feb 18 02:01:41 2018 (r329506) +++ head/sys/modules/Makefile Sun Feb 18 02:48:54 2018 (r329507) @@ -813,10 +813,6 @@ _bcm283x_clkman= bcm283x_clkman _bcm283x_pwm= bcm283x_pwm .endif -.if ${MACHINE_ARCH:Marmv[67]*} != "" -_ffec= ffec -.endif - SUBDIR+=${MODULES_EXTRA} .for reject in ${WITHOUT_MODULES} Added: head/sys/modules/imx/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/Makefile Sun Feb 18 02:48:54 2018 (r329507) @@ -0,0 +1,8 @@ +# $FreeBSD$ +# Build modules specific to freescale/nxp imx-family SoCs. + +SUBDIR = \ + ../ffec \ + imx_i2c \ + +.include Added: head/sys/modules/imx/imx_i2c/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/imx_i2c/Makefile Sun Feb 18 02:48:54 2018 (r329507) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm/freescale/imx + +KMOD= imx_i2c +SRCS= imx_i2c.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + ofw_bus_if.h \ + opt_platform.h \ + +.include From owner-svn-src-all@freebsd.org Sun Feb 18 02:53:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07C7EF076C8; Sun, 18 Feb 2018 02:53:13 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 909FB7D8C9; Sun, 18 Feb 2018 02:53:12 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id u84so8033979iod.9; Sat, 17 Feb 2018 18:53:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=F0bca4ZXOXyDYcudNIM0qL20qBXAe/5IlRKq5/KtVwA=; b=dsdPggJK9GUQ9b7CFhNsDsu68m5DXnEoVKJT/y61KCY7NANdiZJMNqmaPS73lyQbyp eZIJeX9wRChSUc8TwTi64E/FfDxB+hI4PCgFMwAHfwjyK1LWNgvbNJrtE2/pQnLd9XKx 1rwrX5MOP6hr8+FbY4KJMewhX/1BCnv0AyyzutclN4DK3uWkrtsgXdngu43gwzGp6QV7 riG/VO7BlhWTQmulOESzNSKF33hgK1E+ldMr8Bd6S6tdtPLFbNEPFLsiaeOx3QD5GY/W 2lr8iL7rmHBJX1iSiFznbdYZL/hruJpj+3csLGmNNwLw0J+2olpebnQ2pSzpEZSNw1hi kZ5Q== X-Gm-Message-State: APf1xPB1CVLiF5H/9jrUO6h2bKPCLEZrPRfHefGhvWm/247hl/SN97sg 4l+kGq3AvUg/9g5kyUavfjjBfqQS X-Google-Smtp-Source: AH8x2261kBgJinCVRZ3e7gqcNXewFPUbXpAUNV7QLUW1CLl8ZEIcSlYMtGg51Pm07W5FJL+YwilczQ== X-Received: by 10.107.161.200 with SMTP id k191mr3027815ioe.270.1518922386160; Sat, 17 Feb 2018 18:53:06 -0800 (PST) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com. [209.85.214.43]) by smtp.gmail.com with ESMTPSA id j88sm805408iod.22.2018.02.17.18.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 18:53:06 -0800 (PST) Received: by mail-it0-f43.google.com with SMTP id w63so5815145ita.3; Sat, 17 Feb 2018 18:53:06 -0800 (PST) X-Received: by 10.36.243.7 with SMTP id t7mr8195630ith.61.1518922385891; Sat, 17 Feb 2018 18:53:05 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Sat, 17 Feb 2018 18:53:05 -0800 (PST) In-Reply-To: <201802180135.w1I1ZkcF097492@repo.freebsd.org> References: <201802180135.w1I1ZkcF097492@repo.freebsd.org> From: Conrad Meyer Date: Sat, 17 Feb 2018 18:53:05 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329504 - head/stand/lua To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 02:53:13 -0000 On Sat, Feb 17, 2018 at 5:35 PM, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 18 01:35:46 2018 > New Revision: 329504 > URL: https://svnweb.freebsd.org/changeset/base/329504 > > Log: > stand/lua: More style nits, config.lua > > Some other points I think we need to be consistent on: > - Spacing around string concatenation (always) +1. ".." is just another (infix) operator, and we put spaces around operat= ors. > - Test against 'nil' explicitly rather than relying on 'not' for things= that > reasonably won't be returning a boolean. e.g. loader.getenv > > Eventually this will all get formalized somewhere. +1. Ideally sooner rather than later. Maybe a luastyle.9? :-) One thing we've done so far I'm not sold on is parentheses around conditionals. Unlike C, this is not a language requirement, and it isn't common in other lua codebases, e.g., https://github.com/luarocks/lua-style-guide . (Take that guide with a grain of salt =E2=80=94 it suggests treating nil as boolean false, which I agree is probably wrong.) Best, Conrad From owner-svn-src-all@freebsd.org Sun Feb 18 03:04:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04164F086BB; Sun, 18 Feb 2018 03:04:05 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56CF87E49B; Sun, 18 Feb 2018 03:04:05 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f47.google.com with SMTP id 37so8824648lfs.7; Sat, 17 Feb 2018 19:04:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=kvMwVSvNKp17CVCnMcMYVYHj4Zs7ARODNMGXfAf/5+k=; b=flf7mDBLLpClGQhOcnTypriBpdLkFPL0TK2f9K0o8ENvouTxb3bYip7bIn0HKeQPp1 TZv5NiBOjHtxfv/CL9ch6AjjuOM/MP+7hHQqF43KEiC/GxzOLZ2wBOTdfSEJaZkCMBuh gnUdFZzQjp/yR3gXraiJy05bBm00hGkjiuHFpMUTFOAakuc4kXnB2ZmvMVUCk6k4rXiL fs+WUo3uPwJgaaTXnC6izf2zVXxuaa077G1JnkfgJQvDL52fOQESufdlHTgs5HeVq8iA Gpb2c3yc6CdSaPuorB91mCAu3qunr2QJgF89FbYus/aj3KCSIKrY4ZX8eLSqbfHl9YtC 3D3A== X-Gm-Message-State: APf1xPBxMOQJqKUGNtEiL3rrTSHv85Sc2PxNoTK7uWQWkb8IffIXTCIb FHRpDvKXcJP2I7naZhiiV7SXbP0i X-Google-Smtp-Source: AH8x226rXj6T2iKicbVs4IZH9T4uBL6BHOMIJZu8ywG8Ze68AJcgSP2MZkxhWY75vcE1wZcOZDvnNg== X-Received: by 10.25.92.1 with SMTP id q1mr7483962lfb.126.1518923037645; Sat, 17 Feb 2018 19:03:57 -0800 (PST) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com. [209.85.215.48]) by smtp.gmail.com with ESMTPSA id n2sm2573824lja.21.2018.02.17.19.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 19:03:57 -0800 (PST) Received: by mail-lf0-f48.google.com with SMTP id l191so8836028lfe.1; Sat, 17 Feb 2018 19:03:57 -0800 (PST) X-Received: by 10.46.64.203 with SMTP id r72mr7641272lje.38.1518923037300; Sat, 17 Feb 2018 19:03:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Sat, 17 Feb 2018 19:03:36 -0800 (PST) In-Reply-To: References: <201802180135.w1I1ZkcF097492@repo.freebsd.org> From: Kyle Evans Date: Sat, 17 Feb 2018 21:03:36 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329504 - head/stand/lua To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 03:04:06 -0000 On Sat, Feb 17, 2018 at 8:53 PM, Conrad Meyer wrote: > On Sat, Feb 17, 2018 at 5:35 PM, Kyle Evans wrote: >> Author: kevans >> Date: Sun Feb 18 01:35:46 2018 >> New Revision: 329504 >> URL: https://svnweb.freebsd.org/changeset/base/329504 >> >> Log: >> stand/lua: More style nits, config.lua >> >> Some other points I think we need to be consistent on: >> - Spacing around string concatenation (always) > > +1. ".." is just another (infix) operator, and we put spaces around oper= ators. > >> - Test against 'nil' explicitly rather than relying on 'not' for thing= s that >> reasonably won't be returning a boolean. e.g. loader.getenv >> >> Eventually this will all get formalized somewhere. > > +1. Ideally sooner rather than later. Maybe a luastyle.9? :-) > > One thing we've done so far I'm not sold on is parentheses around > conditionals. Unlike C, this is not a language requirement, and it > isn't common in other lua codebases, e.g., > https://github.com/luarocks/lua-style-guide . (Take that guide with a > grain of salt =E2=80=94 it suggests treating nil as boolean false, which = I > agree is probably wrong.) I'm definitely not stuck on the idea of parentheses around conditionals, but it was inconsistently done before and I wanted to make some effort to move one way or the other. I started learning lua here [1] and therefore hold no strong position or prior knowledge, so if no-parentheses is the Lua way then I'm all aboard. =3D) [1] https://svnweb.freebsd.org/base?view=3Drevision&revision=3D329274 From owner-svn-src-all@freebsd.org Sun Feb 18 04:00:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02AE7F0CF37; Sun, 18 Feb 2018 04:00:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D51C808D8; Sun, 18 Feb 2018 04:00:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9456A26588; Sun, 18 Feb 2018 04:00:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I40UkJ068167; Sun, 18 Feb 2018 04:00:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I40UH6068162; Sun, 18 Feb 2018 04:00:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802180400.w1I40UH6068162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Feb 2018 04:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329508 - in head/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Commit-Revision: 329508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 04:00:31 -0000 Author: mav Date: Sun Feb 18 04:00:29 2018 New Revision: 329508 URL: https://svnweb.freebsd.org/changeset/base/329508 Log: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Added: head/cddl/contrib/opensolaris/cmd/zdb/zdb.h - copied unchanged from r324198, vendor/illumos/dist/cmd/zdb/zdb.h Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 18 02:48:54 2018 (r329507) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 18 04:00:29 2018 (r329508) @@ -67,6 +67,8 @@ #undef verify #include +#include "zdb.h" + #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ zio_compress_table[(idx)].ci_name : "UNKNOWN") #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ @@ -90,14 +92,13 @@ uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; #endif -const char cmdname[] = "zdb"; +static const char cmdname[] = "zdb"; uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -extern void dump_intent_log(zilog_t *); static uint64_t *zopt_object = NULL; -static int zopt_objects = 0; +static unsigned zopt_objects = 0; static libzfs_handle_t *g_zfs; static uint64_t max_inflight = 1000; @@ -285,8 +286,8 @@ zdb_nicenum(uint64_t num, char *buf, size_t buflen) nicenum(num, buf, sizeof (buf)); } -const char histo_stars[] = "****************************************"; -const int histo_width = sizeof (histo_stars) - 1; +static const char histo_stars[] = "****************************************"; +static const uint64_t histo_width = sizeof (histo_stars) - 1; static void dump_histogram(const uint64_t *histo, int size, int offset) @@ -392,7 +393,7 @@ dump_unknown(objset_t *os, uint64_t object, void *data } /*ARGSUSED*/ -void +static void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { } @@ -410,7 +411,7 @@ dump_zap(objset_t *os, uint64_t object, void *data, si zap_cursor_t zc; zap_attribute_t attr; void *prop; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -573,7 +574,7 @@ dump_sa_layouts(objset_t *os, uint64_t object, void *d zap_cursor_t zc; zap_attribute_t attr; uint16_t *layout_attrs; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -642,7 +643,7 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, zap_cursor_fini(&zc); } -int +static int get_dtl_refcount(vdev_t *vd) { int refcount = 0; @@ -656,18 +657,18 @@ get_dtl_refcount(vdev_t *vd) return (0); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_dtl_refcount(vd->vdev_child[c]); return (refcount); } -int +static int get_metaslab_refcount(vdev_t *vd) { int refcount = 0; if (vd->vdev_top == vd && !vd->vdev_removing) { - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -675,7 +676,7 @@ get_metaslab_refcount(vdev_t *vd) refcount++; } } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_metaslab_refcount(vd->vdev_child[c]); return (refcount); @@ -707,7 +708,7 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) @@ -844,7 +845,7 @@ dump_metaslab_groups(spa_t *spa) metaslab_class_histogram_verify(mc); - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -923,7 +924,7 @@ dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uin { const ddt_phys_t *ddp = dde->dde_phys; const ddt_key_t *ddk = &dde->dde_key; - char *types[4] = { "ditto", "single", "double", "triple" }; + const char *types[4] = { "ditto", "single", "double", "triple" }; char blkbuf[BP_SPRINTF_LEN]; blkptr_t blk; @@ -1016,9 +1017,12 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_clas static void dump_all_ddts(spa_t *spa) { - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; for (enum ddt_type type = 0; type < DDT_TYPES; type++) { @@ -1064,7 +1068,8 @@ dump_dtl(vdev_t *vd, int indent) { spa_t *spa = vd->vdev_spa; boolean_t required; - char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; + const char *name[DTL_TYPES] = { "missing", "partial", "scrub", + "outage" }; char prefix[256]; spa_vdev_state_enter(spa, SCL_NONE); @@ -1092,7 +1097,7 @@ dump_dtl(vdev_t *vd, int indent) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) dump_dtl(vd->vdev_child[c], indent + 4); } @@ -1150,7 +1155,7 @@ dump_history(spa_t *spa) free(buf); (void) printf("\nHistory:\n"); - for (int i = 0; i < num; i++) { + for (unsigned i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; boolean_t printed = B_FALSE; @@ -1172,8 +1177,8 @@ dump_history(spa_t *spa) (void) snprintf(internalstr, sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, + "[internal %s txg:%ju] %s", + zfs_history_event_names[ievent], (uintmax_t)txg, intstr); cmd = internalstr; } @@ -1490,7 +1495,7 @@ dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_bptree(objset_t *os, uint64_t obj, char *name) +dump_bptree(objset_t *os, uint64_t obj, const char *name) { char bytes[32]; bptree_phys_t *bt; @@ -1530,7 +1535,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_full_bpobj(bpobj_t *bpo, char *name, int indent) +dump_full_bpobj(bpobj_t *bpo, const char *name, int indent) { char bytes[32]; char comp[32]; @@ -2034,7 +2039,7 @@ dump_object(objset_t *os, uint64_t object, int verbosi dmu_buf_rele(db, FTAG); } -static char *objset_types[DMU_OST_NUMTYPES] = { +static const char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; static void @@ -2046,10 +2051,11 @@ dump_dir(objset_t *os) char numbuf[32]; char blkbuf[BP_SPRINTF_LEN + 20]; char osname[ZFS_MAX_DATASET_NAME_LEN]; - char *type = "UNKNOWN"; + const char *type = "UNKNOWN"; int verbosity = dump_opt['d']; int print_header = 1; - int i, error; + unsigned i; + int error; /* make sure nicenum has enough space */ CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ); @@ -2139,7 +2145,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co { time_t timestamp = ub->ub_timestamp; - (void) printf(header ? header : ""); + (void) printf("%s", header ? header : ""); (void) printf("\tmagic = %016llx\n", (u_longlong_t)ub->ub_magic); (void) printf("\tversion = %llu\n", (u_longlong_t)ub->ub_version); (void) printf("\ttxg = %llu\n", (u_longlong_t)ub->ub_txg); @@ -2151,7 +2157,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } - (void) printf(footer ? footer : ""); + (void) printf("%s", footer ? footer : ""); } static void @@ -2494,7 +2500,7 @@ typedef struct zdb_blkstats { #define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) #define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) -static char *zdb_ot_extname[] = { +static const char *zdb_ot_extname[] = { "deferred free", "dedup ditto", "other", @@ -2511,7 +2517,7 @@ typedef struct zdb_cb { uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] [BPE_PAYLOAD_SIZE]; uint64_t zcb_start; - uint64_t zcb_lastprint; + hrtime_t zcb_lastprint; uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; @@ -2546,7 +2552,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b * SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last, * "other", bucket. */ - int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; + unsigned idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1); zb->zb_psize_histogram[idx]++; @@ -2753,10 +2759,11 @@ static metaslab_ops_t zdb_metaslab_ops = { static void zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) { - ddt_bookmark_t ddb = { 0 }; + ddt_bookmark_t ddb; ddt_entry_t dde; int error; + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; ddt_phys_t *ddp = dde.dde_phys; @@ -2864,10 +2871,10 @@ zdb_leak_fini(spa_t *spa) { if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); mutex_enter(&msp->ms_lock); @@ -2913,12 +2920,13 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t static int dump_block_stats(spa_t *spa) { - zdb_cb_t zcb = { 0 }; + zdb_cb_t zcb; zdb_blkstats_t *zb, *tzb; uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", @@ -3069,7 +3077,7 @@ dump_block_stats(spa_t *spa) for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; char avg[32], gang[32]; - char *typename; + const char *typename; /* make sure nicenum has enough space */ CTASSERT(sizeof (csize) >= NN_NUMBUF_SZ); @@ -3220,9 +3228,11 @@ dump_simulated_ddt(spa_t *spa) avl_tree_t t; void *cookie = NULL; zdb_ddt_entry_t *zdde; - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); avl_create(&t, ddt_entry_compare, sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node)); @@ -3369,7 +3379,7 @@ dump_zpool(spa_t *spa) #define ZDB_FLAG_RAW 0x0040 #define ZDB_FLAG_PRINT_BLKPTR 0x0080 -int flagbits[256]; +static int flagbits[256]; static void zdb_print_blkptr(blkptr_t *bp, int flags) @@ -3410,10 +3420,11 @@ static void zdb_dump_block(char *label, void *buf, uint64_t size, int flags) { uint64_t *d = (uint64_t *)buf; - int nwords = size / sizeof (uint64_t); + unsigned nwords = size / sizeof (uint64_t); int do_bswap = !!(flags & ZDB_FLAG_BSWAP); - int i, j; - char *hdr, *c; + unsigned i, j; + const char *hdr; + char *c; if (do_bswap) @@ -3446,19 +3457,19 @@ zdb_dump_block(char *label, void *buf, uint64_t size, * RAID-Zs, you can specify either RAID-Z vdev with 0.0 or 0.1 . */ static vdev_t * -zdb_vdev_lookup(vdev_t *vdev, char *path) +zdb_vdev_lookup(vdev_t *vdev, const char *path) { char *s, *p, *q; - int i; + unsigned i; if (vdev == NULL) return (NULL); /* First, assume the x.x.x.x format */ - i = (int)strtoul(path, &s, 10); + i = strtoul(path, &s, 10); if (s == path || (s && *s != '.' && *s != '\0')) goto name; - if (i < 0 || i >= vdev->vdev_children) + if (i >= vdev->vdev_children) return (NULL); vdev = vdev->vdev_child[i]; @@ -3533,7 +3544,8 @@ zdb_read_block(char *thing, spa_t *spa) vdev_t *vd; abd_t *pabd; void *lbuf, *buf; - char *s, *p, *dup, *vdev, *flagstr; + const char *s, *vdev; + char *p, *dup, *flagstr; int i, error; dup = strdup(thing); @@ -3544,7 +3556,10 @@ zdb_read_block(char *thing, spa_t *spa) s = strtok(NULL, ":"); size = strtoull(s ? s : "", NULL, 16); s = strtok(NULL, ":"); - flagstr = s ? s : ""; + if (s) + flagstr = strdup(s); + else + flagstr = strdup(""); s = NULL; if (size == 0) @@ -3586,6 +3601,7 @@ zdb_read_block(char *thing, spa_t *spa) i += p - &flagstr[i + 1]; /* skip over the number */ } } + free(flagstr); vd = zdb_vdev_lookup(spa->spa_root_vdev, vdev); if (vd == NULL) { @@ -3722,11 +3738,12 @@ out: static void zdb_embedded_block(char *thing) { - blkptr_t bp = { 0 }; + blkptr_t bp; unsigned long long *words = (void *)&bp; char *buf; int err; + bzero(&bp, sizeof (bp)); err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx", words + 0, words + 1, words + 2, words + 3, @@ -3779,8 +3796,9 @@ find_zpool(char **target, nvlist_t **configp, int dirc char *sepp = NULL; char sep = '\0'; int count = 0; - importargs_t args = { 0 }; + importargs_t args; + bzero(&args, sizeof (args)); args.paths = dirc; args.path = dirv; args.can_be_active = B_TRUE; @@ -3840,7 +3858,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc int main(int argc, char **argv) { - int i, c; + int c; struct rlimit rl = { 1024, 1024 }; spa_t *spa = NULL; objset_t *os = NULL; @@ -4121,7 +4139,7 @@ main(int argc, char **argv) if (argc > 0) { zopt_objects = argc; zopt_object = calloc(zopt_objects, sizeof (uint64_t)); - for (i = 0; i < zopt_objects; i++) { + for (unsigned i = 0; i < zopt_objects; i++) { errno = 0; zopt_object[i] = strtoull(argv[i], NULL, 0); if (zopt_object[i] == 0 && errno != 0) @@ -4146,7 +4164,7 @@ main(int argc, char **argv) flagbits['p'] = ZDB_FLAG_PHYS; flagbits['r'] = ZDB_FLAG_RAW; - for (i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) zdb_read_block(argv[i], spa); } Copied: head/cddl/contrib/opensolaris/cmd/zdb/zdb.h (from r324198, vendor/illumos/dist/cmd/zdb/zdb.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.h Sun Feb 18 04:00:29 2018 (r329508, copy of r324198, vendor/illumos/dist/cmd/zdb/zdb.h) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2017 Spectra Logic Corp Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _ZDB_H +#define _ZDB_H + +void dump_intent_log(zilog_t *); +extern uint8_t dump_opt[256]; + +#endif /* _ZDB_H */ Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Sun Feb 18 02:48:54 2018 (r329507) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Sun Feb 18 04:00:29 2018 (r329508) @@ -43,9 +43,11 @@ #include #include +#include "zdb.h" + extern uint8_t dump_opt[256]; -static char prefix[4] = "\t\t\t"; +static char tab_prefix[4] = "\t\t\t"; static void print_log_bp(const blkptr_t *bp, const char *prefix) @@ -58,8 +60,9 @@ print_log_bp(const blkptr_t *bp, const char *prefix) /* ARGSUSED */ static void -zil_prt_rec_create(zilog_t *zilog, int txtype, lr_create_t *lr) +zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) { + lr_create_t *lr = arg; time_t crtime = lr->lr_crtime[0]; char *name, *link; lr_attr_t *lrattr; @@ -74,47 +77,53 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, lr_crea if (txtype == TX_SYMLINK) { link = name + strlen(name) + 1; - (void) printf("%s%s -> %s\n", prefix, name, link); + (void) printf("%s%s -> %s\n", tab_prefix, name, link); } else if (txtype != TX_MKXATTR) { - (void) printf("%s%s\n", prefix, name); + (void) printf("%s%s\n", tab_prefix, name); } - (void) printf("%s%s", prefix, ctime(&crtime)); - (void) printf("%sdoid %llu, foid %llu, mode %llo\n", prefix, + (void) printf("%s%s", tab_prefix, ctime(&crtime)); + (void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_mode); - (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", prefix, + (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", + tab_prefix, (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid, (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev); } /* ARGSUSED */ static void -zil_prt_rec_remove(zilog_t *zilog, int txtype, lr_remove_t *lr) +zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, name %s\n", prefix, + lr_remove_t *lr = arg; + + (void) printf("%sdoid %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_link(zilog_t *zilog, int txtype, lr_link_t *lr) +zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, link_obj %llu, name %s\n", prefix, + lr_link_t *lr = arg; + + (void) printf("%sdoid %llu, link_obj %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rename_t *lr) +zil_prt_rec_rename(zilog_t *zilog, int txtype, void *arg) { + lr_rename_t *lr = arg; char *snm = (char *)(lr + 1); char *tnm = snm + strlen(snm) + 1; - (void) printf("%ssdoid %llu, tdoid %llu\n", prefix, + (void) printf("%ssdoid %llu, tdoid %llu\n", tab_prefix, (u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid); - (void) printf("%ssrc %s tgt %s\n", prefix, snm, tnm); + (void) printf("%ssrc %s tgt %s\n", tab_prefix, snm, tnm); } /* ARGSUSED */ @@ -122,7 +131,7 @@ static int zil_prt_rec_write_cb(void *data, size_t len, void *unused) { char *cdata = data; - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { if (isprint(*cdata)) (void) printf("%c ", *cdata); else @@ -134,15 +143,16 @@ zil_prt_rec_write_cb(void *data, size_t len, void *unu /* ARGSUSED */ static void -zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) +zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) { + lr_write_t *lr = arg; abd_t *data; blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; - (void) printf("%sfoid %llu, offset %llx, length %llx\n", prefix, + (void) printf("%sfoid %llu, offset %llx, length %llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); @@ -150,20 +160,21 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write return; if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { - (void) printf("%shas blkptr, %s\n", prefix, + (void) printf("%shas blkptr, %s\n", tab_prefix, !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); - print_log_bp(bp, prefix); + print_log_bp(bp, tab_prefix); if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - (void) printf("%s\n", prefix); + (void) printf("%s\n", tab_prefix); return; } if (bp->blk_birth < zilog->zl_header->zh_claim_txg) { - (void) printf("%s\n", prefix); + (void) printf("%s\n", + tab_prefix); return; } @@ -183,7 +194,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write abd_copy_from_buf(data, lr + 1, lr->lr_length); } - (void) printf("%s", prefix); + (void) printf("%s", tab_prefix); (void) abd_iterate_func(data, 0, MIN(lr->lr_length, (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)), zil_prt_rec_write_cb, NULL); @@ -195,52 +206,55 @@ out: /* ARGSUSED */ static void -zil_prt_rec_truncate(zilog_t *zilog, int txtype, lr_truncate_t *lr) +zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", prefix, + lr_truncate_t *lr = arg; + + (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); } /* ARGSUSED */ static void -zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_setattr_t *lr) +zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) { + lr_setattr_t *lr = arg; time_t atime = (time_t)lr->lr_atime[0]; time_t mtime = (time_t)lr->lr_mtime[0]; - (void) printf("%sfoid %llu, mask 0x%llx\n", prefix, + (void) printf("%sfoid %llu, mask 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_mask); if (lr->lr_mask & AT_MODE) { - (void) printf("%sAT_MODE %llo\n", prefix, + (void) printf("%sAT_MODE %llo\n", tab_prefix, (longlong_t)lr->lr_mode); } if (lr->lr_mask & AT_UID) { - (void) printf("%sAT_UID %llu\n", prefix, + (void) printf("%sAT_UID %llu\n", tab_prefix, (u_longlong_t)lr->lr_uid); } if (lr->lr_mask & AT_GID) { - (void) printf("%sAT_GID %llu\n", prefix, + (void) printf("%sAT_GID %llu\n", tab_prefix, (u_longlong_t)lr->lr_gid); } if (lr->lr_mask & AT_SIZE) { - (void) printf("%sAT_SIZE %llu\n", prefix, + (void) printf("%sAT_SIZE %llu\n", tab_prefix, (u_longlong_t)lr->lr_size); } if (lr->lr_mask & AT_ATIME) { - (void) printf("%sAT_ATIME %llu.%09llu %s", prefix, + (void) printf("%sAT_ATIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_atime[0], (u_longlong_t)lr->lr_atime[1], ctime(&atime)); } if (lr->lr_mask & AT_MTIME) { - (void) printf("%sAT_MTIME %llu.%09llu %s", prefix, + (void) printf("%sAT_MTIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_mtime[0], (u_longlong_t)lr->lr_mtime[1], ctime(&mtime)); @@ -249,41 +263,43 @@ zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_set /* ARGSUSED */ static void -zil_prt_rec_acl(zilog_t *zilog, int txtype, lr_acl_t *lr) +zil_prt_rec_acl(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, aclcnt %llu\n", prefix, + lr_acl_t *lr = arg; + + (void) printf("%sfoid %llu, aclcnt %llu\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt); } -typedef void (*zil_prt_rec_func_t)(); +typedef void (*zil_prt_rec_func_t)(zilog_t *, int, void *); typedef struct zil_rec_info { zil_prt_rec_func_t zri_print; - char *zri_name; + const char *zri_name; uint64_t zri_count; } zil_rec_info_t; static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = { - { NULL, "Total " }, - { zil_prt_rec_create, "TX_CREATE " }, - { zil_prt_rec_create, "TX_MKDIR " }, - { zil_prt_rec_create, "TX_MKXATTR " }, - { zil_prt_rec_create, "TX_SYMLINK " }, - { zil_prt_rec_remove, "TX_REMOVE " }, - { zil_prt_rec_remove, "TX_RMDIR " }, - { zil_prt_rec_link, "TX_LINK " }, - { zil_prt_rec_rename, "TX_RENAME " }, - { zil_prt_rec_write, "TX_WRITE " }, - { zil_prt_rec_truncate, "TX_TRUNCATE " }, - { zil_prt_rec_setattr, "TX_SETATTR " }, - { zil_prt_rec_acl, "TX_ACL_V0 " }, - { zil_prt_rec_acl, "TX_ACL_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ATTR " }, - { zil_prt_rec_create, "TX_CREATE_ACL_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL " }, - { zil_prt_rec_create, "TX_MKDIR_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL_ATTR " }, - { zil_prt_rec_write, "TX_WRITE2 " }, + {.zri_print = NULL, .zri_name = "Total "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKXATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_SYMLINK "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_REMOVE "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_RMDIR "}, + {.zri_print = zil_prt_rec_link, .zri_name = "TX_LINK "}, + {.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE "}, + {.zri_print = zil_prt_rec_truncate, .zri_name = "TX_TRUNCATE "}, + {.zri_print = zil_prt_rec_setattr, .zri_name = "TX_SETATTR "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_V0 "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL_ATTR "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE2 "}, }; /* ARGSUSED */ @@ -321,7 +337,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar { char blkbuf[BP_SPRINTF_LEN + 10]; int verbose = MAX(dump_opt['d'], dump_opt['i']); - char *claim; + const char *claim; if (verbose <= 3) return (0); @@ -350,7 +366,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar static void print_log_stats(int verbose) { - int i, w, p10; + unsigned i, w, p10; if (verbose > 3) (void) printf("\n"); Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Feb 18 02:48:54 2018 (r329507) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Feb 18 04:00:29 2018 (r329508) @@ -1425,8 +1425,10 @@ ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_set * ZIL replay ops */ static int -ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap) +ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_create_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; ztest_block_tag_t *bbt; @@ -1509,8 +1511,10 @@ ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, b } static int -ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap) +ztest_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_remove_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; dmu_object_info_t doi; @@ -1560,8 +1564,10 @@ ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, b } static int -ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap) +ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_write_t *lr = arg2; objset_t *os = zd->zd_os; void *data = lr + 1; /* data follows lr */ uint64_t offset, length; @@ -1685,8 +1691,10 @@ ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boo } static int -ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap) +ztest_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_truncate_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; uint64_t txg; @@ -1724,8 +1732,10 @@ ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *l } static int -ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) +ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_setattr_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; dmu_buf_t *db; Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sun Feb 18 02:48:54 2018 (r329507) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sun Feb 18 04:00:29 2018 (r329508) @@ -237,7 +237,7 @@ extern struct proc p0; #define PS_NONE -1 -extern kthread_t *zk_thread_create(void (*func)(), void *arg); +extern kthread_t *zk_thread_create(void (*func)(void*), void *arg); #define issig(why) (FALSE) #define ISSIG(thr, why) (FALSE) From owner-svn-src-all@freebsd.org Sun Feb 18 08:05:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEDBFF1DCA4; Sun, 18 Feb 2018 08:05:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C3F96A496; Sun, 18 Feb 2018 08:05:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57216F10; Sun, 18 Feb 2018 08:05:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I85f2W091641; Sun, 18 Feb 2018 08:05:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I85fdS091639; Sun, 18 Feb 2018 08:05:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180805.w1I85fdS091639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 08:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329509 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 329509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 08:05:42 -0000 Author: hselasky Date: Sun Feb 18 08:05:40 2018 New Revision: 329509 URL: https://svnweb.freebsd.org/changeset/base/329509 Log: Update the ktime type in the LinuxKPI to be a signed 64-bit integer similarly to Linux, to avoid compilation issues. Implement ktime_get_real_seconds(). MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/ktime.h Sun Feb 18 04:00:29 2018 (r329508) +++ head/sys/compat/linuxkpi/common/include/linux/ktime.h Sun Feb 18 08:05:40 2018 (r329509) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2014-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2018 Limelight Networks, Inc. + * Copyright (c) 2014-2018 Mellanox Technologies, Ltd. * Copyright (c) 2015 François Tigeot * All rights reserved. * @@ -34,104 +35,96 @@ #include #include -#define ktime_get_ts(x) getnanouptime(x) +#define ktime_get_ts(x) getnanouptime(x) /* time values in nanoseconds */ -union ktime { - int64_t tv64; -}; +typedef s64 ktime_t; -typedef union ktime ktime_t; +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) - static inline int64_t ktime_to_ns(ktime_t kt) { - return kt.tv64; + return (kt); } static inline ktime_t ns_to_ktime(uint64_t nsec) { - ktime_t kt; - - kt.tv64 = nsec; - return (kt); + return (nsec); } static inline int64_t ktime_divns(const ktime_t kt, int64_t div) { - return kt.tv64 / div; + return (kt / div); } static inline int64_t ktime_to_us(ktime_t kt) { - return ktime_divns(kt, NSEC_PER_USEC); + return (ktime_divns(kt, NSEC_PER_USEC)); } static inline int64_t ktime_to_ms(ktime_t kt) { - return ktime_divns(kt, NSEC_PER_MSEC); + return (ktime_divns(kt, NSEC_PER_MSEC)); } static inline struct timeval ktime_to_timeval(ktime_t kt) { - return ns_to_timeval(kt.tv64); + return (ns_to_timeval(kt)); } static inline ktime_t ktime_add_ns(ktime_t kt, int64_t ns) { - kt.tv64 += ns; - return kt; + return (kt + ns); } static inline ktime_t ktime_sub_ns(ktime_t kt, int64_t ns) { - kt.tv64 -= ns; - return kt; + return (kt - ns); } static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) { - ktime_t retval = { (s64)secs * NSEC_PER_SEC + (s64)nsecs }; + ktime_t retval = {(s64) secs * NSEC_PER_SEC + (s64) nsecs}; + return (retval); } static inline ktime_t ktime_sub(ktime_t lhs, ktime_t rhs) { - lhs.tv64 -= rhs.tv64; - return (lhs); + return (lhs - rhs); } static inline int64_t ktime_us_delta(ktime_t later, ktime_t earlier) { - ktime_t diff = ktime_sub(later, earlier); - return ktime_to_us(diff); + ktime_t diff = ktime_sub(later, earlier); + + return (ktime_to_us(diff)); } static inline int64_t ktime_ms_delta(ktime_t later, ktime_t earlier) { - ktime_t diff = ktime_sub(later, earlier); - return ktime_to_ms(diff); + ktime_t diff = ktime_sub(later, earlier); + + return (ktime_to_ms(diff)); } static inline ktime_t ktime_add(ktime_t lhs, ktime_t rhs) { - lhs.tv64 += rhs.tv64; - return (lhs); + return (lhs + rhs); } static inline ktime_t @@ -146,23 +139,20 @@ timeval_to_ktime(struct timeval tv) return (ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC)); } -#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) -#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) -#define ktime_to_ns(kt) ((kt).tv64) +#define ktime_to_timespec(kt) ns_to_timespec(kt) +#define ktime_to_timeval(kt) ns_to_timeval(kt) +#define ktime_to_ns(kt) (kt) static inline int64_t ktime_get_ns(void) { struct timespec ts; - ktime_t kt; ktime_get_ts(&ts); - kt = timespec_to_ktime(ts); - return (ktime_to_ns(kt)); + + return (ktime_to_ns(timespec_to_ktime(ts))); } -#define ktime_get_raw_ns() ktime_get_ns() - static inline ktime_t ktime_get(void) { @@ -188,6 +178,24 @@ ktime_get_real(void) nanotime(&ts); return (timespec_to_ktime(ts)); +} + +static inline ktime_t +ktime_get_real_seconds(void) +{ + struct timespec ts; + + nanotime(&ts); + return (ts.tv_sec); +} + +static inline u64 +ktime_get_raw_ns(void) +{ + struct timespec ts; + + nanouptime(&ts); + return (ktime_to_ns(timespec_to_ktime(ts))); } #endif /* _LINUX_KTIME_H */ Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Sun Feb 18 04:00:29 2018 (r329508) +++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Sun Feb 18 08:05:40 2018 (r329509) @@ -98,7 +98,7 @@ linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, { mtx_lock(&hrtimer->mtx); - callout_reset_sbt(&hrtimer->callout, nstosbt(time.tv64), nstosbt(nsec), + callout_reset_sbt(&hrtimer->callout, nstosbt(time), nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); mtx_unlock(&hrtimer->mtx); } From owner-svn-src-all@freebsd.org Sun Feb 18 08:40:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DF03F1F8DF; Sun, 18 Feb 2018 08:40:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE6B76B950; Sun, 18 Feb 2018 08:40:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80AC152D; Sun, 18 Feb 2018 08:40:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I8e7Jn006863; Sun, 18 Feb 2018 08:40:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I8e7Pm006862; Sun, 18 Feb 2018 08:40:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180840.w1I8e7Pm006862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 08:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329511 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 08:40:08 -0000 Author: hselasky Date: Sun Feb 18 08:40:07 2018 New Revision: 329511 URL: https://svnweb.freebsd.org/changeset/base/329511 Log: Implement file_inode() and call_mmap() helper functions in the LinuxKPI. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Feb 18 08:29:25 2018 (r329510) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Feb 18 08:40:07 2018 (r329511) @@ -284,6 +284,20 @@ noop_llseek(struct linux_file *file, loff_t offset, in return (file->_file->f_offset); } +static inline struct vnode * +file_inode(const struct linux_file *file) +{ + + return (file->f_vnode); +} + +static inline int +call_mmap(struct linux_file *file, struct vm_area_struct *vma) +{ + + return (file->f_op->mmap(file, vma)); +} + /* Shared memory support */ unsigned long linux_invalidate_mapping_pages(vm_object_t, pgoff_t, pgoff_t); struct page *linux_shmem_read_mapping_page_gfp(vm_object_t, int, gfp_t); From owner-svn-src-all@freebsd.org Sun Feb 18 08:29:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10172F1F122; Sun, 18 Feb 2018 08:29:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5A716B383; Sun, 18 Feb 2018 08:29:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B09A2134B; Sun, 18 Feb 2018 08:29:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I8TPkY001855; Sun, 18 Feb 2018 08:29:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I8TPAj001853; Sun, 18 Feb 2018 08:29:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180829.w1I8TPAj001853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 08:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329510 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 08:29:26 -0000 Author: hselasky Date: Sun Feb 18 08:29:25 2018 New Revision: 329510 URL: https://svnweb.freebsd.org/changeset/base/329510 Log: Refactor dentry structure into its own header file in the LinuxKPI similary to Linux. No functional change. Implement d_inode() helper function. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Added: head/sys/compat/linuxkpi/common/include/linux/dcache.h (contents, props changed) Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h Added: head/sys/compat/linuxkpi/common/include/linux/dcache.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/dcache.h Sun Feb 18 08:29:25 2018 (r329510) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2017 Limelight Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_DCACHE_H +#define __LINUX_DCACHE_H + +struct vnode; +struct pfs_node; + +struct dentry { + struct vnode *d_inode; + struct pfs_node *d_pfs_node; /* FreeBSD specific field */ +}; + +static inline struct vnode * +d_inode(const struct dentry *dentry) +{ + return (dentry->d_inode); +} + +#endif /* __LINUX_DCACHE_H */ Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Feb 18 08:05:40 2018 (r329509) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Sun Feb 18 08:29:25 2018 (r329510) @@ -42,6 +42,7 @@ #include #include #include +#include struct module; struct kiocb; @@ -64,11 +65,6 @@ struct pfs_node; typedef struct files_struct *fl_owner_t; - -struct dentry { - struct inode *d_inode; - struct pfs_node *d_pfs_node; -}; struct file_operations; From owner-svn-src-all@freebsd.org Sun Feb 18 08:47:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C42DF1FC8D; Sun, 18 Feb 2018 08:47:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16CA16BE15; Sun, 18 Feb 2018 08:47:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11A1316FC; Sun, 18 Feb 2018 08:47:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I8lF88012027; Sun, 18 Feb 2018 08:47:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I8lFqx012026; Sun, 18 Feb 2018 08:47:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180847.w1I8lFqx012026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 08:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329512 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 08:47:16 -0000 Author: hselasky Date: Sun Feb 18 08:47:15 2018 New Revision: 329512 URL: https://svnweb.freebsd.org/changeset/base/329512 Log: Implement __list_del_entry() helper functions in the LinuxKPI. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Sun Feb 18 08:40:07 2018 (r329511) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Sun Feb 18 08:47:15 2018 (r329512) @@ -117,6 +117,13 @@ __list_del(struct list_head *prev, struct list_head *n } static inline void +__list_del_entry(struct list_head *entry) +{ + + __list_del(entry->prev, entry->next); +} + +static inline void list_del(struct list_head *entry) { From owner-svn-src-all@freebsd.org Sun Feb 18 08:58:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B49A9F206A7; Sun, 18 Feb 2018 08:58:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 642C16C647; Sun, 18 Feb 2018 08:58:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0E618CD; Sun, 18 Feb 2018 08:58:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I8wKlA016910; Sun, 18 Feb 2018 08:58:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I8wKrC016909; Sun, 18 Feb 2018 08:58:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180858.w1I8wKrC016909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 08:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329513 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 08:58:20 -0000 Author: hselasky Date: Sun Feb 18 08:58:20 2018 New Revision: 329513 URL: https://svnweb.freebsd.org/changeset/base/329513 Log: Implement __GFP_BITS_SHIFT and __GFP_BITS_MASK macros in the LinuxKPI. Add compile time asserts to catch conflicts with native defines. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Feb 18 08:47:15 2018 (r329512) +++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Sun Feb 18 08:58:20 2018 (r329513) @@ -54,6 +54,8 @@ #define __GFP_NO_KSWAPD 0 #define __GFP_WAIT M_WAITOK #define __GFP_DMA32 (1U << 24) /* LinuxKPI only */ +#define __GFP_BITS_SHIFT 25 +#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) #define GFP_NOWAIT M_NOWAIT #define GFP_ATOMIC (M_NOWAIT | M_USE_RESERVE) @@ -66,6 +68,9 @@ #define GFP_DMA32 __GFP_DMA32 #define GFP_TEMPORARY M_NOWAIT #define GFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO) + +CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0); +CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK); /* * Resolve a page into a virtual address: From owner-svn-src-all@freebsd.org Sun Feb 18 09:10:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C88D1F20F21; Sun, 18 Feb 2018 09:10:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71C4B6CE25; Sun, 18 Feb 2018 09:10:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C96C1AA0; Sun, 18 Feb 2018 09:10:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I9AEG3022052; Sun, 18 Feb 2018 09:10:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I9AE6w022051; Sun, 18 Feb 2018 09:10:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180910.w1I9AE6w022051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 09:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329514 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 09:10:15 -0000 Author: hselasky Date: Sun Feb 18 09:10:14 2018 New Revision: 329514 URL: https://svnweb.freebsd.org/changeset/base/329514 Log: Implement the rcu_dereference_raw() function macro. Make sure all RCU dereferencing use the READ_ONCE() function macro. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/rcupdate.h Modified: head/sys/compat/linuxkpi/common/include/linux/rcupdate.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rcupdate.h Sun Feb 18 08:58:20 2018 (r329513) +++ head/sys/compat/linuxkpi/common/include/linux/rcupdate.h Sun Feb 18 09:10:14 2018 (r329514) @@ -74,13 +74,16 @@ } while (0) #define rcu_access_pointer(p) \ - ((__typeof(*p) *)(READ_ONCE(p))) + ((__typeof(*p) *)READ_ONCE(p)) #define rcu_dereference_protected(p, c) \ - ((__typeof(*p) *)(p)) + ((__typeof(*p) *)READ_ONCE(p)) #define rcu_dereference(p) \ rcu_dereference_protected(p, 0) + +#define rcu_dereference_raw(p) \ + ((__typeof(*p) *)READ_ONCE(p)) #define rcu_pointer_handoff(p) (p) From owner-svn-src-all@freebsd.org Sun Feb 18 09:52:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48A7AF22BFE; Sun, 18 Feb 2018 09:52:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEB936E986; Sun, 18 Feb 2018 09:52:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9A782353; Sun, 18 Feb 2018 09:52:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I9qU8W047346; Sun, 18 Feb 2018 09:52:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I9qU6a047336; Sun, 18 Feb 2018 09:52:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180952.w1I9qU6a047336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 09:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329516 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 09:52:31 -0000 Author: hselasky Date: Sun Feb 18 09:52:30 2018 New Revision: 329516 URL: https://svnweb.freebsd.org/changeset/base/329516 Log: Implement the KMEM_CACHE() function macro in the LinuxKPI. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Feb 18 09:31:01 2018 (r329515) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Feb 18 09:52:30 2018 (r329516) @@ -65,6 +65,10 @@ MALLOC_DECLARE(M_KMALLOC); #define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) #define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) +#define KMEM_CACHE(__struct, flags) \ + linux_kmem_cache_create(#__struct, sizeof(struct __struct), \ + __alignof(struct __struct), (flags), NULL) + typedef void linux_kmem_ctor_t (void *); struct linux_kmem_cache { From owner-svn-src-all@freebsd.org Sun Feb 18 09:31:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CFD6F21A47; Sun, 18 Feb 2018 09:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BB9B6D845; Sun, 18 Feb 2018 09:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 263111E72; Sun, 18 Feb 2018 09:31:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I9V28S033363; Sun, 18 Feb 2018 09:31:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I9V1bk033361; Sun, 18 Feb 2018 09:31:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802180931.w1I9V1bk033361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 09:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329515 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 329515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 09:31:02 -0000 Author: hselasky Date: Sun Feb 18 09:31:01 2018 New Revision: 329515 URL: https://svnweb.freebsd.org/changeset/base/329515 Log: Make the vm_fault structure in the LinuxKPI compatible with newer versions of the Linux kernel. No functional change. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mm.h Sun Feb 18 09:10:14 2018 (r329514) +++ head/sys/compat/linuxkpi/common/include/linux/mm.h Sun Feb 18 09:31:01 2018 (r329515) @@ -118,8 +118,13 @@ struct vm_area_struct { struct vm_fault { unsigned int flags; pgoff_t pgoff; - void *virtual_address; /* user-space address */ + union { + /* user-space address */ + void *virtual_address; + unsigned long address; + }; struct page *page; + struct vm_area_struct *vma; }; struct vm_operations_struct { Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Feb 18 09:10:14 2018 (r329514) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Sun Feb 18 09:31:01 2018 (r329515) @@ -538,6 +538,7 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pinde vmf.flags = (fault_type & VM_PROT_WRITE) ? FAULT_FLAG_WRITE : 0; vmf.pgoff = 0; vmf.page = NULL; + vmf.vma = vmap; vmap->vm_pfn_count = 0; vmap->vm_pfn_pcount = &vmap->vm_pfn_count; From owner-svn-src-all@freebsd.org Sun Feb 18 11:36:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6895F014FD; Sun, 18 Feb 2018 11:36:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 542407242B; Sun, 18 Feb 2018 11:36:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F0B033DF; Sun, 18 Feb 2018 11:36:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IBak40099183; Sun, 18 Feb 2018 11:36:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IBakgG099182; Sun, 18 Feb 2018 11:36:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802181136.w1IBakgG099182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 18 Feb 2018 11:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329518 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 329518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 11:36:46 -0000 Author: ae Date: Sun Feb 18 11:36:46 2018 New Revision: 329518 URL: https://svnweb.freebsd.org/changeset/base/329518 Log: MFC r329101: Reinitialize IP header length after checksum calculation. It is used later by TCP-MD5 code. This fixes the problem with broken TCP-MD5 over IPv4 when NIC has disabled TCP checksum offloading. PR: 223835 Modified: stable/11/sys/netinet/tcp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Feb 18 11:17:39 2018 (r329517) +++ stable/11/sys/netinet/tcp_input.c Sun Feb 18 11:36:46 2018 (r329518) @@ -706,6 +706,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto) ip->ip_tos = iptos; /* Re-initialization for later version check */ ip->ip_v = IPVERSION; + ip->ip_hl = off0 >> 2; } if (th->th_sum) { From owner-svn-src-all@freebsd.org Sun Feb 18 12:54:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91154F04B55; Sun, 18 Feb 2018 12:54:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3EABC74DCD; Sun, 18 Feb 2018 12:54:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37E4D458A; Sun, 18 Feb 2018 12:54:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1ICsMfx038897; Sun, 18 Feb 2018 12:54:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1ICsMvE038895; Sun, 18 Feb 2018 12:54:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802181254.w1ICsMvE038895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 12:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329519 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 329519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 12:54:22 -0000 Author: hselasky Date: Sun Feb 18 12:54:21 2018 New Revision: 329519 URL: https://svnweb.freebsd.org/changeset/base/329519 Log: Implement support for radix_tree_for_each_slot() and radix_tree_exception() in the LinuxKPI and use unsigned long type for the radix tree index. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/radix-tree.h head/sys/compat/linuxkpi/common/src/linux_radix.c Modified: head/sys/compat/linuxkpi/common/include/linux/radix-tree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/radix-tree.h Sun Feb 18 11:36:46 2018 (r329518) +++ head/sys/compat/linuxkpi/common/include/linux/radix-tree.h Sun Feb 18 12:54:21 2018 (r329519) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,11 +34,15 @@ #include #define RADIX_TREE_MAP_SHIFT 6 -#define RADIX_TREE_MAP_SIZE (1 << RADIX_TREE_MAP_SHIFT) -#define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE - 1) -#define RADIX_TREE_MAX_HEIGHT \ - DIV_ROUND_UP((sizeof(long) * NBBY), RADIX_TREE_MAP_SHIFT) +#define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT) +#define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE - 1UL) +#define RADIX_TREE_MAX_HEIGHT \ + howmany(sizeof(long) * NBBY, RADIX_TREE_MAP_SHIFT) +#define RADIX_TREE_ENTRY_MASK 3UL +#define RADIX_TREE_EXCEPTIONAL_ENTRY 2UL +#define RADIX_TREE_EXCEPTIONAL_SHIFT 2 + struct radix_tree_node { void *slots[RADIX_TREE_MAP_SIZE]; int count; @@ -50,6 +54,10 @@ struct radix_tree_root { int height; }; +struct radix_tree_iter { + unsigned long index; +}; + #define RADIX_TREE_INIT(mask) \ { .rnode = NULL, .gfp_mask = mask, .height = 0 }; #define INIT_RADIX_TREE(root, mask) \ @@ -57,8 +65,19 @@ struct radix_tree_root { #define RADIX_TREE(name, mask) \ struct radix_tree_root name = RADIX_TREE_INIT(mask) +#define radix_tree_for_each_slot(slot, root, iter, start) \ + for ((iter)->index = (start); \ + radix_tree_iter_find(root, iter, &(slot)); (iter)->index++) + +static inline int +radix_tree_exception(void *arg) +{ + return ((uintptr_t)arg & RADIX_TREE_ENTRY_MASK); +} + void *radix_tree_lookup(struct radix_tree_root *, unsigned long); void *radix_tree_delete(struct radix_tree_root *, unsigned long); int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); +bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***); #endif /* _LINUX_RADIX_TREE_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_radix.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_radix.c Sun Feb 18 11:36:46 2018 (r329518) +++ head/sys/compat/linuxkpi/common/src/linux_radix.c Sun Feb 18 12:54:21 2018 (r329519) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,10 +43,10 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_RADIX, "radix", "Linux radix compat"); -static inline int +static inline unsigned long radix_max(struct radix_tree_root *root) { - return (1 << (root->height * RADIX_TREE_MAP_SHIFT)) - 1; + return ((1UL << (root->height * RADIX_TREE_MAP_SHIFT)) - 1UL); } static inline int @@ -74,6 +74,44 @@ radix_tree_lookup(struct radix_tree_root *root, unsign out: return (item); +} + +bool +radix_tree_iter_find(struct radix_tree_root *root, struct radix_tree_iter *iter, + void ***pppslot) +{ + struct radix_tree_node *node; + unsigned long index = iter->index; + int height; + +restart: + node = root->rnode; + if (node == NULL) + return (false); + height = root->height - 1; + if (height == -1 || index > radix_max(root)) + return (false); + do { + unsigned long mask = RADIX_TREE_MAP_MASK << (RADIX_TREE_MAP_SHIFT * height); + unsigned long step = 1UL << (RADIX_TREE_MAP_SHIFT * height); + int pos = radix_pos(index, height); + struct radix_tree_node *next; + + /* track last slot */ + *pppslot = node->slots + pos; + + next = node->slots[pos]; + if (next == NULL) { + index += step; + if ((index & mask) == 0) + goto restart; + } else { + node = next; + height--; + } + } while (height != -1); + iter->index = index; + return (true); } void * From owner-svn-src-all@freebsd.org Sun Feb 18 11:17:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C19D7F00815; Sun, 18 Feb 2018 11:17:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F83F717CE; Sun, 18 Feb 2018 11:17:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A01C30AC; Sun, 18 Feb 2018 11:17:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IBHd2W089046; Sun, 18 Feb 2018 11:17:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IBHdP3089045; Sun, 18 Feb 2018 11:17:39 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201802181117.w1IBHdP3089045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 18 Feb 2018 11:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329517 - head/stand/efi/include X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/stand/efi/include X-SVN-Commit-Revision: 329517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 11:17:40 -0000 Author: manu Date: Sun Feb 18 11:17:39 2018 New Revision: 329517 URL: https://svnweb.freebsd.org/changeset/base/329517 Log: efi: Do not pad the efi devpath structure This solve problem when booting with efi on armv7 Reviewed by: imp, tsoome MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14415 Modified: head/stand/efi/include/efidevp.h Modified: head/stand/efi/include/efidevp.h ============================================================================== --- head/stand/efi/include/efidevp.h Sun Feb 18 09:52:30 2018 (r329516) +++ head/stand/efi/include/efidevp.h Sun Feb 18 11:17:39 2018 (r329517) @@ -31,6 +31,8 @@ Revision History // Device Path structures - Section C // +#pragma pack(1) + typedef struct _EFI_DEVICE_PATH { UINT8 Type; UINT8 SubType; @@ -450,5 +452,7 @@ typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL { EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; + +#pragma pack() #endif From owner-svn-src-all@freebsd.org Sun Feb 18 15:27:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01504F111CB; Sun, 18 Feb 2018 15:27:25 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A907A7C068; Sun, 18 Feb 2018 15:27:24 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A40B35DB9; Sun, 18 Feb 2018 15:27:24 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IFROGD016230; Sun, 18 Feb 2018 15:27:24 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IFRO3Y016229; Sun, 18 Feb 2018 15:27:24 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201802181527.w1IFRO3Y016229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Feb 2018 15:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329520 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 15:27:25 -0000 Author: oshogbo Date: Sun Feb 18 15:27:24 2018 New Revision: 329520 URL: https://svnweb.freebsd.org/changeset/base/329520 Log: Use the fdeget_locked function instead of the fget_locked in the sys_capability. Reviewed by: pjd@ (earlier version) Discussed with: mjg@ Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sun Feb 18 12:54:21 2018 (r329519) +++ head/sys/kern/sys_capability.c Sun Feb 18 15:27:24 2018 (r329520) @@ -205,10 +205,10 @@ cap_rights_to_vmprot(cap_rights_t *havep) */ cap_rights_t * -cap_rights_fde(struct filedescent *fde) +cap_rights_fde(struct filedescent *fdep) { - return (&fde->fde_rights); + return (&fdep->fde_rights); } cap_rights_t * @@ -222,24 +222,26 @@ int kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights) { struct filedesc *fdp; + struct filedescent *fdep; int error; fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); - if (fget_locked(fdp, fd) == NULL) { + fdep = fdeget_locked(fdp, fd); + if (fdep == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } error = _cap_check(cap_rights(fdp, fd), rights, CAPFAIL_INCREASE); if (error == 0) { - fdp->fd_ofiles[fd].fde_rights = *rights; + fdep->fde_rights = *rights; if (!cap_rights_is_set(rights, CAP_IOCTL)) { - free(fdp->fd_ofiles[fd].fde_ioctls, M_FILECAPS); - fdp->fd_ofiles[fd].fde_ioctls = NULL; - fdp->fd_ofiles[fd].fde_nioctls = 0; + free(fdep->fde_ioctls, M_FILECAPS); + fdep->fde_ioctls = NULL; + fdep->fde_nioctls = 0; } if (!cap_rights_is_set(rights, CAP_FCNTL)) - fdp->fd_ofiles[fd].fde_fcntls = 0; + fdep->fde_fcntls = 0; } FILEDESC_XUNLOCK(fdp); return (error); @@ -341,19 +343,23 @@ sys___cap_rights_get(struct thread *td, struct __cap_r int cap_ioctl_check(struct filedesc *fdp, int fd, u_long cmd) { + struct filedescent *fdep; u_long *cmds; ssize_t ncmds; long i; - FILEDESC_LOCK_ASSERT(fdp); KASSERT(fd >= 0 && fd < fdp->fd_nfiles, + ("%s: invalid fd=%d", __func__, fd)); + + fdep = fdeget_locked(fdp, fd); + KASSERT(fdep == NULL, ("%s: invalid fd=%d", __func__, fd)); - ncmds = fdp->fd_ofiles[fd].fde_nioctls; + ncmds = fdep->fde_nioctls; if (ncmds == -1) return (0); - cmds = fdp->fd_ofiles[fd].fde_ioctls; + cmds = fdep->fde_ioctls; for (i = 0; i < ncmds; i++) { if (cmds[i] == cmd) return (0); @@ -366,7 +372,7 @@ cap_ioctl_check(struct filedesc *fdp, int fd, u_long c * Check if the current ioctls list can be replaced by the new one. */ static int -cap_ioctl_limit_check(struct filedesc *fdp, int fd, const u_long *cmds, +cap_ioctl_limit_check(struct filedescent *fdep, const u_long *cmds, size_t ncmds) { u_long *ocmds; @@ -374,13 +380,13 @@ cap_ioctl_limit_check(struct filedesc *fdp, int fd, co u_long i; long j; - oncmds = fdp->fd_ofiles[fd].fde_nioctls; + oncmds = fdep->fde_nioctls; if (oncmds == -1) return (0); if (oncmds < (ssize_t)ncmds) return (ENOTCAPABLE); - ocmds = fdp->fd_ofiles[fd].fde_ioctls; + ocmds = fdep->fde_ioctls; for (i = 0; i < ncmds; i++) { for (j = 0; j < oncmds; j++) { if (cmds[i] == ocmds[j]) @@ -397,6 +403,7 @@ int kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds, size_t ncmds) { struct filedesc *fdp; + struct filedescent *fdep; u_long *ocmds; int error; @@ -410,18 +417,19 @@ kern_cap_ioctls_limit(struct thread *td, int fd, u_lon fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); - if (fget_locked(fdp, fd) == NULL) { + fdep = fdeget_locked(fdp, fd); + if (fdep == NULL) { error = EBADF; goto out; } - error = cap_ioctl_limit_check(fdp, fd, cmds, ncmds); + error = cap_ioctl_limit_check(fdep, cmds, ncmds); if (error != 0) goto out; - ocmds = fdp->fd_ofiles[fd].fde_ioctls; - fdp->fd_ofiles[fd].fde_ioctls = cmds; - fdp->fd_ofiles[fd].fde_nioctls = ncmds; + ocmds = fdep->fde_ioctls; + fdep->fde_ioctls = cmds; + fdep->fde_nioctls = ncmds; cmds = ocmds; error = 0; @@ -523,7 +531,7 @@ out: * Test whether a capability grants the given fcntl command. */ int -cap_fcntl_check_fde(struct filedescent *fde, int cmd) +cap_fcntl_check_fde(struct filedescent *fdep, int cmd) { uint32_t fcntlcap; @@ -531,7 +539,7 @@ cap_fcntl_check_fde(struct filedescent *fde, int cmd) KASSERT((CAP_FCNTL_ALL & fcntlcap) != 0, ("Unsupported fcntl=%d.", cmd)); - if ((fde->fde_fcntls & fcntlcap) != 0) + if ((fdep->fde_fcntls & fcntlcap) != 0) return (0); return (ENOTCAPABLE); @@ -551,6 +559,7 @@ int sys_cap_fcntls_limit(struct thread *td, struct cap_fcntls_limit_args *uap) { struct filedesc *fdp; + struct filedescent *fdep; uint32_t fcntlrights; int fd; @@ -566,17 +575,18 @@ sys_cap_fcntls_limit(struct thread *td, struct cap_fcn fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); - if (fget_locked(fdp, fd) == NULL) { + fdep = fdeget_locked(fdp, fd); + if (fdep == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } - if ((fcntlrights & ~fdp->fd_ofiles[fd].fde_fcntls) != 0) { + if ((fcntlrights & ~fdep->fde_fcntls) != 0) { FILEDESC_XUNLOCK(fdp); return (ENOTCAPABLE); } - fdp->fd_ofiles[fd].fde_fcntls = fcntlrights; + fdep->fde_fcntls = fcntlrights; FILEDESC_XUNLOCK(fdp); return (0); @@ -586,6 +596,7 @@ int sys_cap_fcntls_get(struct thread *td, struct cap_fcntls_get_args *uap) { struct filedesc *fdp; + struct filedescent *fdep; uint32_t rights; int fd; @@ -595,11 +606,12 @@ sys_cap_fcntls_get(struct thread *td, struct cap_fcntl fdp = td->td_proc->p_fd; FILEDESC_SLOCK(fdp); - if (fget_locked(fdp, fd) == NULL) { + fdep = fdeget_locked(fdp, fd); + if (fdep == NULL) { FILEDESC_SUNLOCK(fdp); return (EBADF); } - rights = fdp->fd_ofiles[fd].fde_fcntls; + rights = fdep->fde_fcntls; FILEDESC_SUNLOCK(fdp); return (copyout(&rights, uap->fcntlrightsp, sizeof(rights))); From owner-svn-src-all@freebsd.org Sun Feb 18 16:03:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64D14F1416B; Sun, 18 Feb 2018 16:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 173E67D9FA; Sun, 18 Feb 2018 16:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12149642A; Sun, 18 Feb 2018 16:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IG3op3035924; Sun, 18 Feb 2018 16:03:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IG3oYd035923; Sun, 18 Feb 2018 16:03:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802181603.w1IG3oYd035923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Feb 2018 16:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329521 - head/sys/x86/iommu X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/x86/iommu X-SVN-Commit-Revision: 329521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 16:03:51 -0000 Author: markj Date: Sun Feb 18 16:03:50 2018 New Revision: 329521 URL: https://svnweb.freebsd.org/changeset/base/329521 Log: Don't include DMAR map entry zone items in kernel dumps. Such items may be allocated in the I/O path used by the dumper, potentially causing the dump to fail. Since there is some precedent in the DMAR driver for avoiding this problem using _NODUMP, apply this workaround to the zone as well. Reported and tested by: mmacy Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14422 Modified: head/sys/x86/iommu/intel_gas.c Modified: head/sys/x86/iommu/intel_gas.c ============================================================================== --- head/sys/x86/iommu/intel_gas.c Sun Feb 18 15:27:24 2018 (r329520) +++ head/sys/x86/iommu/intel_gas.c Sun Feb 18 16:03:50 2018 (r329521) @@ -81,7 +81,7 @@ intel_gas_init(void) dmar_map_entry_zone = uma_zcreate("DMAR_MAP_ENTRY", sizeof(struct dmar_map_entry), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NODUMP); } SYSINIT(intel_gas, SI_SUB_DRIVERS, SI_ORDER_FIRST, intel_gas_init, NULL); From owner-svn-src-all@freebsd.org Sun Feb 18 16:41:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B624F16F38; Sun, 18 Feb 2018 16:41:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E8D27EF31; Sun, 18 Feb 2018 16:41:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20B556A50; Sun, 18 Feb 2018 16:41:35 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IGfYJd052122; Sun, 18 Feb 2018 16:41:34 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IGfYa4052116; Sun, 18 Feb 2018 16:41:34 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201802181641.w1IGfYa4052116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 18 Feb 2018 16:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329522 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 329522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 16:41:35 -0000 Author: scottl Date: Sun Feb 18 16:41:34 2018 New Revision: 329522 URL: https://svnweb.freebsd.org/changeset/base/329522 Log: Improve command lifecycle debugging and detection of problems. Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mpr/mpr.c Sun Feb 18 16:41:34 2018 (r329522) @@ -1135,6 +1135,9 @@ mpr_enqueue_request(struct mpr_softc *sc, struct mpr_c if (++sc->io_cmds_active > sc->io_cmds_highwater) sc->io_cmds_highwater++; + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("command not busy\n")); + cm->cm_state = MPR_CM_STATE_INQUEUE; + if (sc->atomic_desc_capable) { rd.u.low = cm->cm_desc.Words.Low; mpr_regwrite(sc, MPI26_ATOMIC_REQUEST_DESCRIPTOR_POST_OFFSET, @@ -1554,6 +1557,7 @@ mpr_alloc_requests(struct mpr_softc *sc) cm->cm_sense_busaddr = sc->sense_busaddr + i * MPR_SENSE_LEN; cm->cm_desc.Default.SMID = i; cm->cm_sc = sc; + cm->cm_state = MPR_CM_STATE_BUSY; TAILQ_INIT(&cm->cm_chain_list); TAILQ_INIT(&cm->cm_prp_page_list); callout_init_mtx(&cm->cm_callout, &sc->mpr_mtx, 0); @@ -2444,6 +2448,9 @@ mpr_intr_locked(void *data) case MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS: case MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS: cm = &sc->commands[le16toh(desc->SCSIIOSuccess.SMID)]; + KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE, + ("command not inqueue\n")); + cm->cm_state = MPR_CM_STATE_BUSY; cm->cm_reply = NULL; break; case MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY: @@ -2513,6 +2520,9 @@ mpr_intr_locked(void *data) } else { cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; + KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE, + ("command not inqueue\n")); + cm->cm_state = MPR_CM_STATE_BUSY; cm->cm_reply = reply; cm->cm_reply_data = le32toh(desc->AddressReply. @@ -2543,8 +2553,7 @@ mpr_intr_locked(void *data) } if (pq != sc->replypostindex) { - mpr_dprint(sc, MPR_TRACE, - "%s sc %p writing postindex %d\n", + mpr_dprint(sc, MPR_TRACE, "%s sc %p writing postindex %d\n", __func__, sc, sc->replypostindex); mpr_regwrite(sc, MPI2_REPLY_POST_HOST_INDEX_OFFSET, sc->replypostindex); Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mpr/mpr_sas.c Sun Feb 18 16:41:34 2018 (r329522) @@ -1161,6 +1161,10 @@ mprsas_complete_all_commands(struct mpr_softc *sc) /* complete all commands with a NULL reply */ for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; + if (cm->cm_state == MPR_CM_STATE_FREE) + continue; + + cm->cm_state = MPR_CM_STATE_BUSY; cm->cm_reply = NULL; completed = 0; @@ -1173,9 +1177,7 @@ mprsas_complete_all_commands(struct mpr_softc *sc) cm, cm->cm_state, cm->cm_ccb); cm->cm_complete(sc, cm); completed = 1; - } - - if (cm->cm_flags & MPR_CM_FLAGS_WAKEUP) { + } else if (cm->cm_flags & MPR_CM_FLAGS_WAKEUP) { mprsas_log_command(cm, MPR_RECOVERY, "waking up cm %p state %x ccb %p for diag reset\n", cm, cm->cm_state, cm->cm_ccb); @@ -1183,9 +1185,6 @@ mprsas_complete_all_commands(struct mpr_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) - cm->cm_sc->io_cmds_active--; - if ((completed == 0) && (cm->cm_state != MPR_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ mprsas_log_command(cm, MPR_RECOVERY, @@ -1194,6 +1193,8 @@ mprsas_complete_all_commands(struct mpr_softc *sc) cm->cm_ccb); } } + + sc->io_cmds_active = 0; } void @@ -1248,6 +1249,11 @@ mprsas_tm_timeout(void *data) mprsas_log_command(tm, MPR_INFO|MPR_RECOVERY, "task mgmt %p timed " "out\n", tm); + + KASSERT(tm->cm_state == MPR_CM_STATE_INQUEUE, + ("command not inqueue\n")); + + tm->cm_state = MPR_CM_STATE_BUSY; mpr_reinit(sc); } @@ -1657,7 +1663,7 @@ mprsas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mpr_intr_locked(sc); - if (cm->cm_state == MPR_CM_STATE_FREE) { + if (cm->cm_state != MPR_CM_STATE_INQUEUE) { mprsas_log_command(cm, MPR_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -2492,6 +2498,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp if (cm->cm_state == MPR_CM_STATE_TIMEDOUT) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); + cm->cm_state = MPR_CM_STATE_BUSY; if (cm->cm_reply != NULL) mprsas_log_command(cm, MPR_RECOVERY, "completed timedout cm %p ccb %p during recovery " Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mpr/mprvar.h Sun Feb 18 16:41:34 2018 (r329522) @@ -243,6 +243,7 @@ struct mpr_command { #define MPR_CM_STATE_FREE 0 #define MPR_CM_STATE_BUSY 1 #define MPR_CM_STATE_TIMEDOUT 2 +#define MPR_CM_STATE_INQUEUE 3 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; uint64_t *nvme_error_response; @@ -569,6 +570,8 @@ mpr_free_command(struct mpr_softc *sc, struct mpr_comm struct mpr_chain *chain, *chain_temp; struct mpr_prp_page *prp_page, *prp_page_temp; + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("state not busy\n")); + if (cm->cm_reply != NULL) mpr_free_reply(sc, cm->cm_reply_data); cm->cm_reply = NULL; @@ -607,9 +610,10 @@ mpr_alloc_command(struct mpr_softc *sc) if (cm == NULL) return (NULL); + KASSERT(cm->cm_state == MPR_CM_STATE_FREE, + ("mpr: Allocating busy command\n")); + TAILQ_REMOVE(&sc->req_list, cm, cm_link); - KASSERT(cm->cm_state == MPR_CM_STATE_FREE, ("mpr: Allocating busy " - "command\n")); cm->cm_state = MPR_CM_STATE_BUSY; return (cm); } @@ -619,6 +623,8 @@ mpr_free_high_priority_command(struct mpr_softc *sc, s { struct mpr_chain *chain, *chain_temp; + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("state not busy\n")); + if (cm->cm_reply != NULL) mpr_free_reply(sc, cm->cm_reply_data); cm->cm_reply = NULL; @@ -645,9 +651,10 @@ mpr_alloc_high_priority_command(struct mpr_softc *sc) if (cm == NULL) return (NULL); + KASSERT(cm->cm_state == MPR_CM_STATE_FREE, + ("mpr: Allocating busy command\n")); + TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); - KASSERT(cm->cm_state == MPR_CM_STATE_FREE, ("mpr: Allocating busy " - "command\n")); cm->cm_state = MPR_CM_STATE_BUSY; return (cm); } Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mps/mps.c Sun Feb 18 16:41:34 2018 (r329522) @@ -1102,6 +1102,10 @@ mps_enqueue_request(struct mps_softc *sc, struct mps_c rd.u.low = cm->cm_desc.Words.Low; rd.u.high = cm->cm_desc.Words.High; rd.word = htole64(rd.word); + + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("command not busy\n")); + cm->cm_state = MPS_CM_STATE_INQUEUE; + /* TODO-We may need to make below regwrite atomic */ mps_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET, rd.u.low); @@ -1502,6 +1506,7 @@ mps_alloc_requests(struct mps_softc *sc) cm->cm_sense_busaddr = sc->sense_busaddr + i * MPS_SENSE_LEN; cm->cm_desc.Default.SMID = i; cm->cm_sc = sc; + cm->cm_state = MPS_CM_STATE_BUSY; TAILQ_INIT(&cm->cm_chain_list); callout_init_mtx(&cm->cm_callout, &sc->mps_mtx, 0); @@ -2305,6 +2310,9 @@ mps_intr_locked(void *data) switch (flags) { case MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS: cm = &sc->commands[le16toh(desc->SCSIIOSuccess.SMID)]; + KASSERT(cm->cm_state == MPS_CM_STATE_INQUEUE, + ("command not inqueue\n")); + cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_reply = NULL; break; case MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY: @@ -2340,7 +2348,7 @@ mps_intr_locked(void *data) sc->reply_frames, sc->fqdepth, sc->replyframesz); printf("%s: baddr %#x,\n", __func__, baddr); - /* LSI-TODO. See Linux Code. Need Graceful exit*/ + /* LSI-TODO. See Linux Code for Graceful exit */ panic("Reply address out of range"); } if (le16toh(desc->AddressReply.SMID) == 0) { @@ -2372,10 +2380,14 @@ mps_intr_locked(void *data) (MPI2_EVENT_NOTIFICATION_REPLY *) reply); } else { - cm = &sc->commands[le16toh(desc->AddressReply.SMID)]; + cm = &sc->commands[ + le16toh(desc->AddressReply.SMID)]; + KASSERT(cm->cm_state == MPS_CM_STATE_INQUEUE, + ("command not inqueue\n")); + cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_reply = reply; - cm->cm_reply_data = - le32toh(desc->AddressReply.ReplyFrameAddress); + cm->cm_reply_data = le32toh( + desc->AddressReply.ReplyFrameAddress); } break; } @@ -2403,10 +2415,10 @@ mps_intr_locked(void *data) } if (pq != sc->replypostindex) { - mps_dprint(sc, MPS_TRACE, - "%s sc %p writing postindex %d\n", + mps_dprint(sc, MPS_TRACE, "%s sc %p writing postindex %d\n", __func__, sc, sc->replypostindex); - mps_regwrite(sc, MPI2_REPLY_POST_HOST_INDEX_OFFSET, sc->replypostindex); + mps_regwrite(sc, MPI2_REPLY_POST_HOST_INDEX_OFFSET, + sc->replypostindex); } return; Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mps/mps_sas.c Sun Feb 18 16:41:34 2018 (r329522) @@ -1101,6 +1101,10 @@ mpssas_complete_all_commands(struct mps_softc *sc) /* complete all commands with a NULL reply */ for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; + if (cm->cm_state == MPS_CM_STATE_FREE) + continue; + + cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_reply = NULL; completed = 0; @@ -1109,14 +1113,12 @@ mpssas_complete_all_commands(struct mps_softc *sc) if (cm->cm_complete != NULL) { mpssas_log_command(cm, MPS_RECOVERY, - "completing cm %p state %x ccb %p for diag reset\n", + "completing cm %p state %x ccb %p for diag reset\n", cm, cm->cm_state, cm->cm_ccb); cm->cm_complete(sc, cm); completed = 1; - } - - if (cm->cm_flags & MPS_CM_FLAGS_WAKEUP) { + } else if (cm->cm_flags & MPS_CM_FLAGS_WAKEUP) { mpssas_log_command(cm, MPS_RECOVERY, "waking up cm %p state %x ccb %p for diag reset\n", cm, cm->cm_state, cm->cm_ccb); @@ -1124,9 +1126,6 @@ mpssas_complete_all_commands(struct mps_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) - cm->cm_sc->io_cmds_active--; - if ((completed == 0) && (cm->cm_state != MPS_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ mpssas_log_command(cm, MPS_RECOVERY, @@ -1135,6 +1134,8 @@ mpssas_complete_all_commands(struct mps_softc *sc) cm->cm_ccb); } } + + sc->io_cmds_active = 0; } void @@ -1191,6 +1192,11 @@ mpssas_tm_timeout(void *data) mpssas_log_command(tm, MPS_INFO|MPS_RECOVERY, "task mgmt %p timed out\n", tm); + + KASSERT(tm->cm_state == MPS_CM_STATE_INQUEUE, + ("command not inqueue\n")); + + tm->cm_state = MPS_CM_STATE_BUSY; mps_reinit(sc); } @@ -1591,7 +1597,7 @@ mpssas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mps_intr_locked(sc); - if (cm->cm_state == MPS_CM_STATE_FREE) { + if (cm->cm_state != MPS_CM_STATE_INQUEUE) { mpssas_log_command(cm, MPS_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -2031,12 +2037,13 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); + cm->cm_state = MPS_CM_STATE_BUSY; if (cm->cm_reply != NULL) mpssas_log_command(cm, MPS_RECOVERY, "completed timedout cm %p ccb %p during recovery " "ioc %x scsi %x state %x xfer %u\n", - cm, cm->cm_ccb, - le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState, + cm, cm->cm_ccb, le16toh(rep->IOCStatus), + rep->SCSIStatus, rep->SCSIState, le32toh(rep->TransferCount)); else mpssas_log_command(cm, MPS_RECOVERY, @@ -2047,8 +2054,8 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp mpssas_log_command(cm, MPS_RECOVERY, "completed cm %p ccb %p during recovery " "ioc %x scsi %x state %x xfer %u\n", - cm, cm->cm_ccb, - le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState, + cm, cm->cm_ccb, le16toh(rep->IOCStatus), + rep->SCSIStatus, rep->SCSIState, le32toh(rep->TransferCount)); else mpssas_log_command(cm, MPS_RECOVERY, Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Sun Feb 18 16:03:50 2018 (r329521) +++ head/sys/dev/mps/mpsvar.h Sun Feb 18 16:41:34 2018 (r329522) @@ -243,6 +243,7 @@ struct mps_command { #define MPS_CM_STATE_FREE 0 #define MPS_CM_STATE_BUSY 1 #define MPS_CM_STATE_TIMEDOUT 2 +#define MPS_CM_STATE_INQUEUE 3 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; TAILQ_HEAD(, mps_chain) cm_chain_list; @@ -541,6 +542,8 @@ mps_free_command(struct mps_softc *sc, struct mps_comm { struct mps_chain *chain, *chain_temp; + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); cm->cm_reply = NULL; @@ -574,8 +577,10 @@ mps_alloc_command(struct mps_softc *sc) if (cm == NULL) return (NULL); + KASSERT(cm->cm_state == MPS_CM_STATE_FREE, + ("mps: Allocating busy command\n")); + TAILQ_REMOVE(&sc->req_list, cm, cm_link); - KASSERT(cm->cm_state == MPS_CM_STATE_FREE, ("mps: Allocating busy command\n")); cm->cm_state = MPS_CM_STATE_BUSY; return (cm); } @@ -585,6 +590,8 @@ mps_free_high_priority_command(struct mps_softc *sc, s { struct mps_chain *chain, *chain_temp; + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); cm->cm_reply = NULL; @@ -611,8 +618,10 @@ mps_alloc_high_priority_command(struct mps_softc *sc) if (cm == NULL) return (NULL); + KASSERT(cm->cm_state == MPS_CM_STATE_FREE, + ("mps: Allocating busy command\n")); + TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); - KASSERT(cm->cm_state == MPS_CM_STATE_FREE, ("mps: Allocating busy command\n")); cm->cm_state = MPS_CM_STATE_BUSY; return (cm); } From owner-svn-src-all@freebsd.org Sun Feb 18 17:37:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E36D2F1B259; Sun, 18 Feb 2018 17:37:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96B148172F; Sun, 18 Feb 2018 17:37:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 919B672A6; Sun, 18 Feb 2018 17:37:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IHbNFL081248; Sun, 18 Feb 2018 17:37:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IHbNW6081247; Sun, 18 Feb 2018 17:37:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802181737.w1IHbNW6081247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 17:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329523 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/asm X-SVN-Commit-Revision: 329523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 17:37:24 -0000 Author: hselasky Date: Sun Feb 18 17:37:23 2018 New Revision: 329523 URL: https://svnweb.freebsd.org/changeset/base/329523 Log: Fix implementation of xchg() function macro in the LinuxKPI. The exchange operation must be atomic. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic.h Sun Feb 18 16:41:34 2018 (r329522) +++ head/sys/compat/linuxkpi/common/include/asm/atomic.h Sun Feb 18 17:37:23 2018 (r329523) @@ -198,12 +198,41 @@ atomic_cmpxchg(atomic_t *v, int old, int new) #define cmpxchg_relaxed(...) cmpxchg(__VA_ARGS__) -#define xchg(ptr, v) ({ \ - __typeof(*(ptr)) __ret; \ - \ - __ret = *(ptr); \ - *(ptr) = v; \ - __ret; \ +#define xchg(ptr, new) ({ \ + union { \ + __typeof(*(ptr)) val; \ + u8 u8[0]; \ + u16 u16[0]; \ + u32 u32[0]; \ + u64 u64[0]; \ + } __ret = { .val = READ_ONCE(*ptr) }, __new = { .val = (new) }; \ + \ + CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 || \ + sizeof(__ret.val) == 4 || sizeof(__ret.val) == 8); \ + \ + switch (sizeof(__ret.val)) { \ + case 1: \ + while (!atomic_fcmpset_8((volatile u8 *)(ptr), \ + __ret.u8, __new.u8[0])) \ + ; \ + break; \ + case 2: \ + while (!atomic_fcmpset_16((volatile u16 *)(ptr), \ + __ret.u16, __new.u16[0])) \ + ; \ + break; \ + case 4: \ + while (!atomic_fcmpset_32((volatile u32 *)(ptr), \ + __ret.u32, __new.u32[0])) \ + ; \ + break; \ + case 8: \ + while (!atomic_fcmpset_64((volatile u64 *)(ptr), \ + __ret.u64, __new.u64[0])) \ + ; \ + break; \ + } \ + __ret.val; \ }) #define LINUX_ATOMIC_OP(op, c_op) \ From owner-svn-src-all@freebsd.org Sun Feb 18 18:46:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C06F5F20B74; Sun, 18 Feb 2018 18:46:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7228C8491E; Sun, 18 Feb 2018 18:46:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6898A7DBB; Sun, 18 Feb 2018 18:46:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IIkua2016426; Sun, 18 Feb 2018 18:46:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IIkush016425; Sun, 18 Feb 2018 18:46:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802181846.w1IIkush016425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Feb 2018 18:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329524 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/asm X-SVN-Commit-Revision: 329524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 18:46:56 -0000 Author: hselasky Date: Sun Feb 18 18:46:56 2018 New Revision: 329524 URL: https://svnweb.freebsd.org/changeset/base/329524 Log: Optimise xchg() to use atomic_swap_32() and atomic_swap_64(). Suggested by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic.h Sun Feb 18 17:37:23 2018 (r329523) +++ head/sys/compat/linuxkpi/common/include/asm/atomic.h Sun Feb 18 18:46:56 2018 (r329524) @@ -205,31 +205,31 @@ atomic_cmpxchg(atomic_t *v, int old, int new) u16 u16[0]; \ u32 u32[0]; \ u64 u64[0]; \ - } __ret = { .val = READ_ONCE(*ptr) }, __new = { .val = (new) }; \ + } __ret, __new = { .val = (new) }; \ \ CTASSERT(sizeof(__ret.val) == 1 || sizeof(__ret.val) == 2 || \ sizeof(__ret.val) == 4 || sizeof(__ret.val) == 8); \ \ switch (sizeof(__ret.val)) { \ case 1: \ + __ret.val = READ_ONCE(*ptr); \ while (!atomic_fcmpset_8((volatile u8 *)(ptr), \ __ret.u8, __new.u8[0])) \ ; \ break; \ case 2: \ + __ret.val = READ_ONCE(*ptr); \ while (!atomic_fcmpset_16((volatile u16 *)(ptr), \ __ret.u16, __new.u16[0])) \ ; \ break; \ case 4: \ - while (!atomic_fcmpset_32((volatile u32 *)(ptr), \ - __ret.u32, __new.u32[0])) \ - ; \ + __ret.u32[0] = atomic_swap_32((volatile u32 *)(ptr), \ + __new.u32[0]); \ break; \ case 8: \ - while (!atomic_fcmpset_64((volatile u64 *)(ptr), \ - __ret.u64, __new.u64[0])) \ - ; \ + __ret.u64[0] = atomic_swap_64((volatile u64 *)(ptr), \ + __new.u64[0]); \ break; \ } \ __ret.val; \ From owner-svn-src-all@freebsd.org Sun Feb 18 19:19:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21726F2302F; Sun, 18 Feb 2018 19:19:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6994863D9; Sun, 18 Feb 2018 19:19:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C17E9102A9; Sun, 18 Feb 2018 19:19:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IJJaAl031614; Sun, 18 Feb 2018 19:19:36 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IJJa85031610; Sun, 18 Feb 2018 19:19:36 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802181919.w1IJJa85031610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sun, 18 Feb 2018 19:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329525 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 19:19:37 -0000 Author: brooks Date: Sun Feb 18 19:19:36 2018 New Revision: 329525 URL: https://svnweb.freebsd.org/changeset/base/329525 Log: Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). The description of kern.ipc.shmsegs was wrong since 2005. I updated the others (which were more correct) to match. PR: 225933 Reviewed by: cem MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14391 Modified: head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Sun Feb 18 18:46:56 2018 (r329524) +++ head/sys/kern/sysv_msg.c Sun Feb 18 19:19:36 2018 (r329525) @@ -1494,7 +1494,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, "Number of message segments"); SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_msqids, "", "Message queue IDs"); + NULL, 0, sysctl_msqids, "", + "Array of struct msqid_kernel for each potential message queue"); static int msg_prison_check(void *obj, void *data) Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Sun Feb 18 18:46:56 2018 (r329524) +++ head/sys/kern/sysv_sem.c Sun Feb 18 19:19:36 2018 (r329525) @@ -230,7 +230,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RWTUN, "Adjust on exit max value"); SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_sema, "", "Semaphore id pool"); + NULL, 0, sysctl_sema, "", + "Array of struct semid_kernel for each potential semaphore"); static struct syscall_helper_data sem_syscalls[] = { SYSCALL_INIT_HELPER(__semctl), Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Sun Feb 18 18:46:56 2018 (r329524) +++ head/sys/kern/sysv_shm.c Sun Feb 18 19:19:36 2018 (r329525) @@ -200,7 +200,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shm_allow_removed, CTL "Enable/Disable attachment to attached segments marked for removal"); SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_shmsegs, "", - "Current number of shared memory segments allocated"); + "Array of struct shmid_kernel for each potential shared memory segment"); static struct sx sysvshmsx; #define SYSVSHM_LOCK() sx_xlock(&sysvshmsx) From owner-svn-src-all@freebsd.org Sun Feb 18 19:33:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 796EDF240B2; Sun, 18 Feb 2018 19:33:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C45C87058; Sun, 18 Feb 2018 19:33:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27229105E3; Sun, 18 Feb 2018 19:33:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IJXSBe041323; Sun, 18 Feb 2018 19:33:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IJXSAW041321; Sun, 18 Feb 2018 19:33:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802181933.w1IJXSAW041321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 19:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329526 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 329526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 19:33:29 -0000 Author: ian Date: Sun Feb 18 19:33:28 2018 New Revision: 329526 URL: https://svnweb.freebsd.org/changeset/base/329526 Log: Allow i2c hardware drivers to declare their own relationships to ofw_iicbus rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in the ofw_iicbus source. This means hw drivers will no longer be required to use one of a few predefined driver names. They will also now be able to decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE and to set which pass to attach on for early modules. Mainly, this adds extern declarations for the driver and devclass variables. It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant with the way we use ofw_ prefixes on this stuff. Modified: head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/ofw_iicbus.c Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Sun Feb 18 19:19:36 2018 (r329525) +++ head/sys/dev/iicbus/iicbus.h Sun Feb 18 19:33:28 2018 (r329526) @@ -77,5 +77,7 @@ void iicbus_init_frequency(device_t dev, u_int bus_fre extern driver_t iicbus_driver; extern devclass_t iicbus_devclass; +extern driver_t ofw_iicbus_driver; +extern devclass_t ofw_iicbus_devclass; #endif Modified: head/sys/dev/iicbus/ofw_iicbus.c ============================================================================== --- head/sys/dev/iicbus/ofw_iicbus.c Sun Feb 18 19:19:36 2018 (r329525) +++ head/sys/dev/iicbus/ofw_iicbus.c Sun Feb 18 19:33:28 2018 (r329526) @@ -76,15 +76,15 @@ struct ofw_iicbus_devinfo { struct ofw_bus_devinfo opd_obdinfo; }; -devclass_t ofwiicbus_devclass; +devclass_t ofw_iicbus_devclass; DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, sizeof(struct iicbus_softc), iicbus_driver); -EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); -EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); -EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_iicbus, 1); MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); From owner-svn-src-all@freebsd.org Sun Feb 18 19:46:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80044F24D0C; Sun, 18 Feb 2018 19:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B7A387748; Sun, 18 Feb 2018 19:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E74C1077E; Sun, 18 Feb 2018 19:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IJkvpE046439; Sun, 18 Feb 2018 19:46:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IJkvnq046436; Sun, 18 Feb 2018 19:46:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802181946.w1IJkvnq046436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Feb 2018 19:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329527 - in stable/11/sys: dev/agp modules/agp X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: dev/agp modules/agp X-SVN-Commit-Revision: 329527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 19:46:58 -0000 Author: markj Date: Sun Feb 18 19:46:57 2018 New Revision: 329527 URL: https://svnweb.freebsd.org/changeset/base/329527 Log: MFC r320851: Add a helper function to agp(4) which installs a single GTT entry. Modified: stable/11/sys/dev/agp/agp_i810.c stable/11/sys/dev/agp/agp_i810.h stable/11/sys/modules/agp/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/agp/agp_i810.c ============================================================================== --- stable/11/sys/dev/agp/agp_i810.c Sun Feb 18 19:33:28 2018 (r329526) +++ stable/11/sys/dev/agp/agp_i810.c Sun Feb 18 19:46:57 2018 (r329527) @@ -2244,6 +2244,16 @@ agp_intel_gtt_map_memory(device_t dev, vm_page_t *page return (0); } +static void +agp_intel_gtt_install_pte(device_t dev, u_int index, vm_paddr_t addr, + u_int flags) +{ + struct agp_i810_softc *sc; + + sc = device_get_softc(dev); + sc->match->driver->install_gtt_pte(dev, index, addr, flags); +} + void agp_intel_gtt_insert_sg_entries(device_t dev, struct sglist *sg_list, u_int first_entry, u_int flags) @@ -2320,6 +2330,13 @@ intel_gtt_insert_sg_entries(struct sglist *sg_list, u_ { agp_intel_gtt_insert_sg_entries(intel_agp, sg_list, first_entry, flags); +} + +void +intel_gtt_install_pte(u_int index, vm_paddr_t addr, u_int flags) +{ + + agp_intel_gtt_install_pte(intel_agp, index, addr, flags); } device_t Modified: stable/11/sys/dev/agp/agp_i810.h ============================================================================== --- stable/11/sys/dev/agp/agp_i810.h Sun Feb 18 19:33:28 2018 (r329526) +++ stable/11/sys/dev/agp/agp_i810.h Sun Feb 18 19:46:57 2018 (r329527) @@ -87,6 +87,7 @@ struct intel_gtt *intel_gtt_get(void); int intel_gtt_chipset_flush(void); void intel_gtt_unmap_memory(struct sglist *sg_list); void intel_gtt_clear_range(u_int first_entry, u_int num_entries); +void intel_gtt_install_pte(u_int index, vm_paddr_t addr, u_int flags); int intel_gtt_map_memory(vm_page_t *pages, u_int num_entries, struct sglist **sg_list); void intel_gtt_insert_sg_entries(struct sglist *sg_list, u_int pg_start, Modified: stable/11/sys/modules/agp/Makefile ============================================================================== --- stable/11/sys/modules/agp/Makefile Sun Feb 18 19:33:28 2018 (r329526) +++ stable/11/sys/modules/agp/Makefile Sun Feb 18 19:46:57 2018 (r329527) @@ -35,6 +35,7 @@ EXPORT_SYMS= agp_find_device \ .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" EXPORT_SYMS+= intel_gtt_clear_range \ intel_gtt_insert_pages \ + intel_gtt_install_pte \ intel_gtt_get \ intel_gtt_chipset_flush \ intel_gtt_unmap_memory \ From owner-svn-src-all@freebsd.org Sun Feb 18 20:04:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8297EF26076; Sun, 18 Feb 2018 20:04:40 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3203E68535; Sun, 18 Feb 2018 20:04:40 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CE7B10AC5; Sun, 18 Feb 2018 20:04:40 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IK4ecE056330; Sun, 18 Feb 2018 20:04:40 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IK4ecR056329; Sun, 18 Feb 2018 20:04:40 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201802182004.w1IK4ecR056329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 18 Feb 2018 20:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329528 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 20:04:40 -0000 Author: oshogbo Date: Sun Feb 18 20:04:39 2018 New Revision: 329528 URL: https://svnweb.freebsd.org/changeset/base/329528 Log: Fix broken assertion in r329520. Reported by: pho@ lwhsu@ Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sun Feb 18 19:46:57 2018 (r329527) +++ head/sys/kern/sys_capability.c Sun Feb 18 20:04:39 2018 (r329528) @@ -352,7 +352,7 @@ cap_ioctl_check(struct filedesc *fdp, int fd, u_long c ("%s: invalid fd=%d", __func__, fd)); fdep = fdeget_locked(fdp, fd); - KASSERT(fdep == NULL, + KASSERT(fdep != NULL, ("%s: invalid fd=%d", __func__, fd)); ncmds = fdep->fde_nioctls; From owner-svn-src-all@freebsd.org Sun Feb 18 20:08:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 090C1F2645C; Sun, 18 Feb 2018 20:08:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B36C768750; Sun, 18 Feb 2018 20:08:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE54B10AC7; Sun, 18 Feb 2018 20:08:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IK8ZAI056493; Sun, 18 Feb 2018 20:08:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IK8ZVf056492; Sun, 18 Feb 2018 20:08:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182008.w1IK8ZVf056492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 20:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329529 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 329529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 20:08:36 -0000 Author: ian Date: Sun Feb 18 20:08:35 2018 New Revision: 329529 URL: https://svnweb.freebsd.org/changeset/base/329529 Log: Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus. Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE declaration in ofw_iicbus.c. Modified: head/sys/arm/freescale/imx/imx_i2c.c Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 20:04:39 2018 (r329528) +++ head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 20:08:35 2018 (r329529) @@ -184,14 +184,14 @@ static device_method_t i2c_methods[] = { }; static driver_t i2c_driver = { - "iichb", + "imx_i2c", i2c_methods, sizeof(struct i2c_softc), }; static devclass_t i2c_devclass; -DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); -DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); +DRIVER_MODULE(imx_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +DRIVER_MODULE(ofw_iicbus, imx_i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); static phandle_t i2c_get_node(device_t bus, device_t dev) From owner-svn-src-all@freebsd.org Sun Feb 18 20:46:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B99A4F02A0C; Sun, 18 Feb 2018 20:46:40 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56D1D6AA32; Sun, 18 Feb 2018 20:46:40 +0000 (UTC) (envelope-from pho@holm.cc) Received: from x2.osted.lan (87-58-223-204-dynamic.dk.customer.tdc.net [87.58.223.204]) by relay01.pair.com (Postfix) with ESMTP id 06337D00350; Sun, 18 Feb 2018 15:46:38 -0500 (EST) Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.9/8.14.9) with ESMTP id w1IKkbrf016985 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 18 Feb 2018 21:46:37 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.9/8.14.9/Submit) id w1IKkbR5016984; Sun, 18 Feb 2018 21:46:37 +0100 (CET) (envelope-from pho) Date: Sun, 18 Feb 2018 21:46:37 +0100 From: Peter Holm To: Mateusz Guzik Cc: Konstantin Belousov , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329448 - head/sys/kern Message-ID: <20180218204637.GA16922@x2.osted.lan> References: <201802170848.w1H8mkfb081764@repo.freebsd.org> <20180217112738.GO94212@kib.kiev.ua> <20180217162632.GQ94212@kib.kiev.ua> <20180217163822.GA81555@x2.osted.lan> <20180217184259.GA84054@x2.osted.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 20:46:41 -0000 On Sat, Feb 17, 2018 at 07:47:38PM +0100, Mateusz Guzik wrote: > On Sat, Feb 17, 2018 at 7:42 PM, Peter Holm wrote: > > > On Sat, Feb 17, 2018 at 06:34:34PM +0100, Mateusz Guzik wrote: > > > On Sat, Feb 17, 2018 at 5:38 PM, Peter Holm wrote: > > > > > > > On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov wrote: > > > > > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > > > > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov > > wrote: > > > > > > > On Sat, Feb 17, 2018 at 08:48:46AM +0000, Mateusz Guzik wrote: > > > > > > > > Author: mjg > > > > > > > > Date: Sat Feb 17 08:48:45 2018 > > > > > > > > New Revision: 329448 > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > > > > > > > > > Log: > > > > > > > > exit: get rid of PROC_SLOCK when checking a process to report > > > > > > > Was this tested ? > > > > > > > > > > > > > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > > > > > > > > > In particular, are you aware of r309539 ? > > > > > > > > > > > > > > > > > > > So it looks like I misread the code - I have grepped > > > > > > thread_suspend_switch operating with the proc locked and misread > > > > > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > > > > > > > > > That said, I think this is harmless. Regardless of the lock the > > > > > > inspecting thread can race and check "too soon". Even for a case > > where > > > > > > it decides to report, I don't see anything which would depend on > > the > > > > > > suspending thread to finish. > > > > > It was definitely not harmless when I tried to avoid the spin lock > > there, > > > > > but I do not remember exact failure mode. Most likely, it was a > > missed > > > > > report of the traced child indeed, but I am not sure that truss > > triggered > > > > > it. Most likely, Peter Holm was the reporter, since he is listed in > > > > > the commit. > > > > > > > > > > > > > I ran a truss(1) test on r329456 and it fails. I have not had a > > > > chance to look closer at this, but this is what I see: > > > > > > > > [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp > > > > UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND > > > > 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss > > > > /tmp/ttruss 10 > > > > 0 41151 41149 0 52 0 13156 2300 - TX 0 0:00.98 > > /tmp/ttruss > > > > 10 > > > > 0 41151 41149 0 52 0 13156 2300 - TX 0 0:00.00 > > /tmp/ttruss > > > > 10 > > > > [root@mercat1 /home/pho]# procstat -k 41151 > > > > PID TID COMM TDNAME KSTACK > > > > 41151 100211 ttruss - mi_switch > > > > thread_suspend_switch ptracestop amd64_syscall fast_syscall_common > > > > 41151 100765 ttruss - mi_switch > > > > thread_suspend_check ast doreti_ast > > > > [root@mercat1 /home/pho]# > > > > > > > > > > > Ok, I reproduced the bug with your script. I reverted the change. > > > > > > The patch I mailed in this thread fixes it for me. Below is a variant > > > which can be applied on top of fresh head: > > > > > > https://people.freebsd.org/~mjg/wait6_slock.diff > > > > > > > Yes, this also works for me with the truss(1) test scenario. > > Would you like me to run the full set of test? > > > > > If you have free cycles I don't see why not, thanks. > I ran all of the tests in stress2 on amd64. No problems found. - Peter From owner-svn-src-all@freebsd.org Sun Feb 18 20:49:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B3F2F02E93; Sun, 18 Feb 2018 20:49:44 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D27316AD01; Sun, 18 Feb 2018 20:49:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8FCC1114E; Sun, 18 Feb 2018 20:49:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IKnhgG076403; Sun, 18 Feb 2018 20:49:43 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IKnhLv076402; Sun, 18 Feb 2018 20:49:43 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802182049.w1IKnhLv076402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sun, 18 Feb 2018 20:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329530 - stable/11/bin/df X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/bin/df X-SVN-Commit-Revision: 329530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 20:49:44 -0000 Author: brooks Date: Sun Feb 18 20:49:43 2018 New Revision: 329530 URL: https://svnweb.freebsd.org/changeset/base/329530 Log: MFC r329092: Add a deprecation warning when using the feature which mounts devices to see how much space it on them. Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted devices to be displayed and report an appropriate error if the device isn't mounted. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8801 Modified: stable/11/bin/df/df.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/df/df.c ============================================================================== --- stable/11/bin/df/df.c Sun Feb 18 20:08:35 2018 (r329529) +++ stable/11/bin/df/df.c Sun Feb 18 20:49:43 2018 (r329530) @@ -249,9 +249,11 @@ main(int argc, char *argv[]) rv = 1; continue; } -#ifdef MOUNT_CHAR_DEVS } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { +#ifdef MOUNT_CHAR_DEVS + xo_warnx( + "df on unmounted devices is deprecated"); mdev.fspec = *argv; mntpath = strdup("/tmp/df.XXXXXX"); if (mntpath == NULL) { @@ -300,8 +302,12 @@ main(int argc, char *argv[]) (void)rmdir(mntpt); free(mntpath); continue; - } +#else + xo_warnx("%s: not mounted", *argv); + rv = 1; + continue; #endif + } } else mntpt = *argv; From owner-svn-src-all@freebsd.org Sun Feb 18 21:07:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5421EF04216; Sun, 18 Feb 2018 21:07:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6BAB6B8E4; Sun, 18 Feb 2018 21:07:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C20261146F; Sun, 18 Feb 2018 21:07:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IL7FbE086538; Sun, 18 Feb 2018 21:07:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IL7F1j086537; Sun, 18 Feb 2018 21:07:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802182107.w1IL7F1j086537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 18 Feb 2018 21:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329531 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 21:07:16 -0000 Author: mjg Date: Sun Feb 18 21:07:15 2018 New Revision: 329531 URL: https://svnweb.freebsd.org/changeset/base/329531 Log: exit: get rid of PROC_SLOCK when checking a process to report, take #2 The suspension counter needs synchronisation through slock, but we don't need it to check if inspecting the counter is necessary to begin with. In the common case it is not, thus avoid the lock if possible. Reviewed by: kib Tested by: pho Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sun Feb 18 20:49:43 2018 (r329530) +++ head/sys/kern/kern_exit.c Sun Feb 18 21:07:15 2018 (r329531) @@ -1174,6 +1174,7 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t id struct proc *p, *q; pid_t pid; int error, nfound, ret; + bool report; AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */ AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */ @@ -1225,36 +1226,38 @@ loop_locked: nfound++; PROC_LOCK_ASSERT(p, MA_OWNED); - if ((options & (WTRAPPED | WUNTRACED)) != 0) - PROC_SLOCK(p); - if ((options & WTRAPPED) != 0 && - (p->p_flag & P_TRACED) != 0 && - (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 && - p->p_suspcount == p->p_numthreads && - (p->p_flag & P_WAITED) == 0) { + (p->p_flag & P_TRACED) != 0) { + PROC_SLOCK(p); + report = + ((p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) && + p->p_suspcount == p->p_numthreads && + (p->p_flag & P_WAITED) == 0); PROC_SUNLOCK(p); + if (report) { CTR4(KTR_PTRACE, "wait: returning trapped pid %d status %#x " "(xstat %d) xthread %d", p->p_pid, W_STOPCODE(p->p_xsig), p->p_xsig, p->p_xthread != NULL ? p->p_xthread->td_tid : -1); - report_alive_proc(td, p, siginfo, status, options, - CLD_TRAPPED); - return (0); + report_alive_proc(td, p, siginfo, status, + options, CLD_TRAPPED); + return (0); + } } if ((options & WUNTRACED) != 0 && - (p->p_flag & P_STOPPED_SIG) != 0 && - p->p_suspcount == p->p_numthreads && - (p->p_flag & P_WAITED) == 0) { + (p->p_flag & P_STOPPED_SIG) != 0) { + PROC_SLOCK(p); + report = (p->p_suspcount == p->p_numthreads && + ((p->p_flag & P_WAITED) == 0)); PROC_SUNLOCK(p); - report_alive_proc(td, p, siginfo, status, options, - CLD_STOPPED); - return (0); + if (report) { + report_alive_proc(td, p, siginfo, status, + options, CLD_STOPPED); + return (0); + } } - if ((options & (WTRAPPED | WUNTRACED)) != 0) - PROC_SUNLOCK(p); if ((options & WCONTINUED) != 0 && (p->p_flag & P_CONTINUED) != 0) { report_alive_proc(td, p, siginfo, status, options, From owner-svn-src-all@freebsd.org Sun Feb 18 21:08:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B8BF043E2; Sun, 18 Feb 2018 21:08:28 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 481FD6BA8D; Sun, 18 Feb 2018 21:08:28 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id d26so10023186qtk.10; Sun, 18 Feb 2018 13:08:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qVypv9QH8tHzHYobluDLZaWYO0r65SHaEZex0UgfIOI=; b=ABbAuxwCipxjsyLIrhlm2aojH8tAy6lXEjt+5coYsynx6/pDm+JHLCh98eTHp1yeux CXbAk3zpVcIjFfb+s3byXyB4DJShzNbueHhpwOnQdeh0hlcKzn6FDg47UR2tJ8SzI4AL qWmbDD/jJwVb0Suwy/JEOmz4+C2priJ2s+dBtPN5O/7r6RclCRcSqLzLoU1UMWvL5wqn MJAWIhdIxiB7q48zwglAavr0N1rqM6mib+1fENjhwpTo78Y+8E9F5WulhJrU6tpWVzWw 2y6x0AxjWkELS3LCTTv3JrST0JNJCrNygiTJwwVhA6h46crGPhtJGMvmFrYR0Q6jdQGX joNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qVypv9QH8tHzHYobluDLZaWYO0r65SHaEZex0UgfIOI=; b=PxQy8qEz4UiLakakjS0Sev7KYTmhzyJpXYrxxagPZRHbF1lDrhfbsOa5TG8t3dJRRD zYRPluYoLu0Gf3abRttHOhcGw91MA+3jlseeXQbFbWIbA/Gf3f+ZWaUrXAGCygh5SFPW kpNJQsIAh7+seL/jQVpwLiF+L6715zJlzDvqbHKDocJfZSszgDGmKIIKhNbmXRLU2unW Hxkhmeeh2xCMwN27jStOJ63tNFc6FcVOIMH+8ob0gT6PnbjphHvr5uaYfR7z+akzaByb 79lOvcQS0IVq7nl6jGu7VOejlPhZXFAaFPF5m7+RvFmuPm0sCIeK39VZOoPQ/HLpaSiX X+sg== X-Gm-Message-State: APf1xPC4sOdVum4MiIaSyQ8V3R/SaS/aNPkzMhbzKDUrpO5GlWRPI3cK z0OkV4wqkozpBe+iDTBnQdfmVb1rs7LuJ4FRK+BF4A== X-Google-Smtp-Source: AH8x2248uQ2gyPvjkRdwAiGf4fZZaIRXTIUJg11mfBOjq43IN4iwLkknGxSJLsan6eCDrC0zH5+iFOgLqj9pCGgJ3cc= X-Received: by 10.237.62.233 with SMTP id o38mr20406335qtf.3.1518988107945; Sun, 18 Feb 2018 13:08:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.58.99 with HTTP; Sun, 18 Feb 2018 13:08:27 -0800 (PST) In-Reply-To: <20180218204637.GA16922@x2.osted.lan> References: <201802170848.w1H8mkfb081764@repo.freebsd.org> <20180217112738.GO94212@kib.kiev.ua> <20180217162632.GQ94212@kib.kiev.ua> <20180217163822.GA81555@x2.osted.lan> <20180217184259.GA84054@x2.osted.lan> <20180218204637.GA16922@x2.osted.lan> From: Mateusz Guzik Date: Sun, 18 Feb 2018 22:08:27 +0100 Message-ID: Subject: Re: svn commit: r329448 - head/sys/kern To: Peter Holm Cc: Konstantin Belousov , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 21:08:29 -0000 Thanks, committed in r329531. On Sun, Feb 18, 2018 at 9:46 PM, Peter Holm wrote: > On Sat, Feb 17, 2018 at 07:47:38PM +0100, Mateusz Guzik wrote: > > On Sat, Feb 17, 2018 at 7:42 PM, Peter Holm wrote: > > > > > On Sat, Feb 17, 2018 at 06:34:34PM +0100, Mateusz Guzik wrote: > > > > On Sat, Feb 17, 2018 at 5:38 PM, Peter Holm wrote: > > > > > > > > > On Sat, Feb 17, 2018 at 06:26:32PM +0200, Konstantin Belousov > wrote: > > > > > > On Sat, Feb 17, 2018 at 05:07:07PM +0100, Mateusz Guzik wrote: > > > > > > > On Sat, Feb 17, 2018 at 01:27:38PM +0200, Konstantin Belousov > > > wrote: > > > > > > > > On Sat, Feb 17, 2018 at 08:48:46AM +0000, Mateusz Guzik > wrote: > > > > > > > > > Author: mjg > > > > > > > > > Date: Sat Feb 17 08:48:45 2018 > > > > > > > > > New Revision: 329448 > > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/329448 > > > > > > > > > > > > > > > > > > Log: > > > > > > > > > exit: get rid of PROC_SLOCK when checking a process to > report > > > > > > > > Was this tested ? > > > > > > > > > > > > > > > > > > > > > > I was trussing multithreaded microbenchmarks, no issues. > > > > > > > > > > > > > > > In particular, are you aware of r309539 ? > > > > > > > > > > > > > > > > > > > > > > So it looks like I misread the code - I have grepped > > > > > > > thread_suspend_switch operating with the proc locked and > misread > > > > > > > thread_suspend_one's assert as PROC_LOCK_ASSERT. > > > > > > > > > > > > > > That said, I think this is harmless. Regardless of the lock the > > > > > > > inspecting thread can race and check "too soon". Even for a > case > > > where > > > > > > > it decides to report, I don't see anything which would depend > on > > > the > > > > > > > suspending thread to finish. > > > > > > It was definitely not harmless when I tried to avoid the spin > lock > > > there, > > > > > > but I do not remember exact failure mode. Most likely, it was a > > > missed > > > > > > report of the traced child indeed, but I am not sure that truss > > > triggered > > > > > > it. Most likely, Peter Holm was the reporter, since he is > listed in > > > > > > the commit. > > > > > > > > > > > > > > > > I ran a truss(1) test on r329456 and it fails. I have not had a > > > > > chance to look closer at this, but this is what I see: > > > > > > > > > > [root@mercat1 /home/pho]# pgrep truss | xargs ps -Hlp > > > > > UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME > COMMAND > > > > > 0 41149 41118 0 52 0 11532 2588 wait I 0 0:01.38 truss > > > > > /tmp/ttruss 10 > > > > > 0 41151 41149 0 52 0 13156 2300 - TX 0 0:00.98 > > > /tmp/ttruss > > > > > 10 > > > > > 0 41151 41149 0 52 0 13156 2300 - TX 0 0:00.00 > > > /tmp/ttruss > > > > > 10 > > > > > [root@mercat1 /home/pho]# procstat -k 41151 > > > > > PID TID COMM TDNAME KSTACK > > > > > 41151 100211 ttruss - mi_switch > > > > > thread_suspend_switch ptracestop amd64_syscall fast_syscall_common > > > > > 41151 100765 ttruss - mi_switch > > > > > thread_suspend_check ast doreti_ast > > > > > [root@mercat1 /home/pho]# > > > > > > > > > > > > > > Ok, I reproduced the bug with your script. I reverted the change. > > > > > > > > The patch I mailed in this thread fixes it for me. Below is a variant > > > > which can be applied on top of fresh head: > > > > > > > > https://people.freebsd.org/~mjg/wait6_slock.diff > > > > > > > > > > Yes, this also works for me with the truss(1) test scenario. > > > Would you like me to run the full set of test? > > > > > > > > If you have free cycles I don't see why not, thanks. > > > > I ran all of the tests in stress2 on amd64. > No problems found. > > - Peter > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Sun Feb 18 22:04:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BC4DF0937C; Sun, 18 Feb 2018 22:04:43 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B240D6E8CC; Sun, 18 Feb 2018 22:04:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD01511DFE; Sun, 18 Feb 2018 22:04:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IM4gYO016025; Sun, 18 Feb 2018 22:04:42 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IM4gsP016024; Sun, 18 Feb 2018 22:04:42 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201802182204.w1IM4gsP016024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 18 Feb 2018 22:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329532 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 329532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 22:04:43 -0000 Author: wulf Date: Sun Feb 18 22:04:42 2018 New Revision: 329532 URL: https://svnweb.freebsd.org/changeset/base/329532 Log: MFC r328864: psm(4): Fix panic occuring soon after PS/2 packet has been rejected by synaptics or elantech sanity checker. After packet has been rejected contents of packet buffer is not cleared with setting of inputbytes counter to 0. So when this packet buffer is filled again being an element of circular queue, new data appends to old data rather than overwrites it. This leads to packet buffer overflow after 10 rounds. Fix it with setting of packet's inputbytes counter to 0 after rejection. While here add extra logging of rejected packets. PR: 222667 (for reference) Reported by: Neel Chauhan Tested by: Neel Chauhan Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sun Feb 18 21:07:15 2018 (r329531) +++ stable/11/sys/dev/atkbdc/psm.c Sun Feb 18 22:04:42 2018 (r329532) @@ -4891,13 +4891,19 @@ psmsoftintr(void *arg) break; case MOUSE_MODEL_SYNAPTICS: - if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) + if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) { + VLOG(3, (LOG_DEBUG, "synaptics: " + "packet rejected\n")); goto next; + } break; case MOUSE_MODEL_ELANTECH: - if (proc_elantech(sc, pb, &ms, &x, &y, &z) != 0) + if (proc_elantech(sc, pb, &ms, &x, &y, &z) != 0) { + VLOG(3, (LOG_DEBUG, "elantech: " + "packet rejected\n")); goto next; + } break; case MOUSE_MODEL_TRACKPOINT: @@ -4993,9 +4999,9 @@ next_native: sizeof(sc->queue.buf); sc->queue.count += pb->inputbytes; } - pb->inputbytes = 0; next: + pb->inputbytes = 0; if (++sc->pqueue_start >= PSM_PACKETQUEUE) sc->pqueue_start = 0; } while (sc->pqueue_start != sc->pqueue_end); From owner-svn-src-all@freebsd.org Sun Feb 18 22:12:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8686AF09D0E; Sun, 18 Feb 2018 22:12:21 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F90C6EE50; Sun, 18 Feb 2018 22:12:21 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A36E11F7C; Sun, 18 Feb 2018 22:12:21 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IMCKk4020549; Sun, 18 Feb 2018 22:12:20 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IMCKxh020548; Sun, 18 Feb 2018 22:12:20 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201802182212.w1IMCKxh020548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 18 Feb 2018 22:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329533 - stable/10/sys/dev/atkbdc X-SVN-Group: stable-10 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/10/sys/dev/atkbdc X-SVN-Commit-Revision: 329533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 22:12:21 -0000 Author: wulf Date: Sun Feb 18 22:12:20 2018 New Revision: 329533 URL: https://svnweb.freebsd.org/changeset/base/329533 Log: MFC r328864 (Synaptics part only): psm(4): Fix panic occuring soon after PS/2 packet has been rejected by synaptics sanity checker. After packet has been rejected contents of packet buffer is not cleared with setting of inputbytes counter to 0. So when this packet buffer is filled again being an element of circular queue, new data appends to old data rather than overwrites it. This leads to packet buffer overflow after 10 rounds. Fix it with setting of packet's inputbytes counter to 0 after rejection. While here add extra logging of rejected packets. PR: 222667 (for reference) Reported by: Neel Chauhan Tested by: Neel Chauhan Modified: stable/10/sys/dev/atkbdc/psm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/atkbdc/psm.c ============================================================================== --- stable/10/sys/dev/atkbdc/psm.c Sun Feb 18 22:04:42 2018 (r329532) +++ stable/10/sys/dev/atkbdc/psm.c Sun Feb 18 22:12:20 2018 (r329533) @@ -3576,8 +3576,11 @@ psmsoftintr(void *arg) break; case MOUSE_MODEL_SYNAPTICS: - if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) + if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0) { + VLOG(3, (LOG_DEBUG, "synaptics: " + "packet rejected\n")); goto next; + } break; case MOUSE_MODEL_TRACKPOINT: @@ -3634,9 +3637,9 @@ next_native: sizeof(sc->queue.buf); sc->queue.count += pb->inputbytes; } - pb->inputbytes = 0; next: + pb->inputbytes = 0; if (++sc->pqueue_start >= PSM_PACKETQUEUE) sc->pqueue_start = 0; } while (sc->pqueue_start != sc->pqueue_end); From owner-svn-src-all@freebsd.org Sun Feb 18 22:54:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22334F0D63A; Sun, 18 Feb 2018 22:54:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C47C970E77; Sun, 18 Feb 2018 22:54:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF5CE125EF; Sun, 18 Feb 2018 22:54:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IMsJw4041036; Sun, 18 Feb 2018 22:54:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IMsJwd041035; Sun, 18 Feb 2018 22:54:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182254.w1IMsJwd041035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 22:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329534 - head/sys/modules/i2c/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/i2c/iicbus X-SVN-Commit-Revision: 329534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 22:54:20 -0000 Author: ian Date: Sun Feb 18 22:54:19 2018 New Revision: 329534 URL: https://svnweb.freebsd.org/changeset/base/329534 Log: Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain. Whitespace only, no functional changes. Modified: head/sys/modules/i2c/iicbus/Makefile Modified: head/sys/modules/i2c/iicbus/Makefile ============================================================================== --- head/sys/modules/i2c/iicbus/Makefile Sun Feb 18 22:12:20 2018 (r329533) +++ head/sys/modules/i2c/iicbus/Makefile Sun Feb 18 22:54:19 2018 (r329534) @@ -1,8 +1,16 @@ # $FreeBSD$ -.PATH: ${SRCTOP}/sys/dev/iicbus -KMOD = iicbus -SRCS = device_if.h bus_if.h iicbus_if.h iicbus_if.c \ - iiconf.h iiconf.c iicbus.h iicbus.c +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD= iicbus +SRCS= \ + bus_if.h \ + device_if.h \ + iicbus.c \ + iicbus.h \ + iicbus_if.c \ + iicbus_if.h \ + iiconf.c \ + iiconf.h \ .include From owner-svn-src-all@freebsd.org Sun Feb 18 22:57:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DFEBF0DB0D; Sun, 18 Feb 2018 22:57:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4A4E711F4; Sun, 18 Feb 2018 22:57:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B913125F0; Sun, 18 Feb 2018 22:57:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IMv4lg041196; Sun, 18 Feb 2018 22:57:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IMv4NB041195; Sun, 18 Feb 2018 22:57:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182257.w1IMv4NB041195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 22:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329535 - head/sys/modules/i2c/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/i2c/iicbus X-SVN-Commit-Revision: 329535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 22:57:05 -0000 Author: ian Date: Sun Feb 18 22:57:04 2018 New Revision: 329535 URL: https://svnweb.freebsd.org/changeset/base/329535 Log: Add iic_recover_bus.c, now part of iicbus. This should have been added as part of r320463. Modified: head/sys/modules/i2c/iicbus/Makefile Modified: head/sys/modules/i2c/iicbus/Makefile ============================================================================== --- head/sys/modules/i2c/iicbus/Makefile Sun Feb 18 22:54:19 2018 (r329534) +++ head/sys/modules/i2c/iicbus/Makefile Sun Feb 18 22:57:04 2018 (r329535) @@ -6,6 +6,7 @@ KMOD= iicbus SRCS= \ bus_if.h \ device_if.h \ + iic_recover_bus.c \ iicbus.c \ iicbus.h \ iicbus_if.c \ From owner-svn-src-all@freebsd.org Sun Feb 18 23:01:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BFB4F0E28C; Sun, 18 Feb 2018 23:01:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 528677163C; Sun, 18 Feb 2018 23:01:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D92212641; Sun, 18 Feb 2018 23:01:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IN1XVt042806; Sun, 18 Feb 2018 23:01:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IN1Xp4042805; Sun, 18 Feb 2018 23:01:33 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182301.w1IN1Xp4042805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 23:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329536 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 329536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 23:01:33 -0000 Author: ian Date: Sun Feb 18 23:01:33 2018 New Revision: 329536 URL: https://svnweb.freebsd.org/changeset/base/329536 Log: Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all the symbols at load time when iicbus is not compiled into the kernel. Modified: head/sys/arm/freescale/imx/imx_i2c.c Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 22:57:04 2018 (r329535) +++ head/sys/arm/freescale/imx/imx_i2c.c Sun Feb 18 23:01:33 2018 (r329536) @@ -192,6 +192,8 @@ static devclass_t i2c_devclass; DRIVER_MODULE(imx_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, imx_i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); +MODULE_DEPEND(imx_i2c, iicbus, 1, 1, 1); +MODULE_DEPEND(imx_i2c, ofw_iicbus, 1, 1, 1); static phandle_t i2c_get_node(device_t bus, device_t dev) From owner-svn-src-all@freebsd.org Sun Feb 18 23:08:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F085BF0E952; Sun, 18 Feb 2018 23:08:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F5C871B11; Sun, 18 Feb 2018 23:08:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E475127BD; Sun, 18 Feb 2018 23:08:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1IN8hUp046127; Sun, 18 Feb 2018 23:08:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1IN8hia046125; Sun, 18 Feb 2018 23:08:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182308.w1IN8hia046125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 23:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329537 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 329537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 23:08:44 -0000 Author: ian Date: Sun Feb 18 23:08:43 2018 New Revision: 329537 URL: https://svnweb.freebsd.org/changeset/base/329537 Log: Provide a public function to acquire a gpio pin by giving the property name and index. A private function to do exactly that already existed, so this renames gpio_pin_get_by_ofw_impl() to gpio_pin_get_by_ofw_propidx() and provides a declaration for it in a public header. Previously there were functions to get a pin by property name (assuming there would only be one pin defined for the name), or by index (asuming the property has the standard name "gpios"). It turns out there are devicetree bindings that describe properties with names other than "gpios" which can describe multiple pins. Hence the need to retrieve the Nth item from a named property. Modified: head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Sun Feb 18 23:01:33 2018 (r329536) +++ head/sys/dev/gpio/gpiobusvar.h Sun Feb 18 23:08:43 2018 (r329537) @@ -136,6 +136,8 @@ int gpio_pin_get_by_ofw_idx(device_t consumer, phandle int idx, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_property(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); +int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, + char *name, int idx, gpio_pin_t *gpio); void gpio_pin_release(gpio_pin_t gpio); int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Sun Feb 18 23:01:33 2018 (r329536) +++ head/sys/dev/gpio/ofw_gpiobus.c Sun Feb 18 23:08:43 2018 (r329537) @@ -59,8 +59,8 @@ static int ofw_gpiobus_parse_gpios_impl(device_t, phan * tree consumers. * */ -static int -gpio_pin_get_by_ofw_impl(device_t consumer, phandle_t cnode, +int +gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t cnode, char *prop_name, int idx, gpio_pin_t *out_pin) { phandle_t xref; @@ -114,7 +114,7 @@ gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t n int idx, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, "gpios", idx, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, "gpios", idx, pin)); } int @@ -122,7 +122,7 @@ gpio_pin_get_by_ofw_property(device_t consumer, phandl char *name, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, name, 0, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, name, 0, pin)); } int From owner-svn-src-all@freebsd.org Sun Feb 18 23:16:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19793F0F2E4; Sun, 18 Feb 2018 23:16:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD5407222F; Sun, 18 Feb 2018 23:16:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B39161294C; Sun, 18 Feb 2018 23:16:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1INGGmf050802; Sun, 18 Feb 2018 23:16:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1INGGXE050801; Sun, 18 Feb 2018 23:16:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802182316.w1INGGXE050801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Feb 2018 23:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329538 - head/sbin/devmatch X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/devmatch X-SVN-Commit-Revision: 329538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 23:16:17 -0000 Author: imp Date: Sun Feb 18 23:16:16 2018 New Revision: 329538 URL: https://svnweb.freebsd.org/changeset/base/329538 Log: Print more info for -v runs and temp hack for usb vs uhub Despite best efforts to regularize, there's a few tables in the system that still report they are for bus usb when they are really for bus uhub (where usb devices attach). Add a temporary workaround for this until these places have been eliminated (likely my fault). Second, when running verbose, describe what we're doing when searching. This output can be quite long, but says exactly what's going on (this output is to stdout, so it's useless for scripting). Modified: head/sbin/devmatch/devmatch.c Modified: head/sbin/devmatch/devmatch.c ============================================================================== --- head/sbin/devmatch/devmatch.c Sun Feb 18 23:08:43 2018 (r329537) +++ head/sbin/devmatch/devmatch.c Sun Feb 18 23:16:16 2018 (r329538) @@ -284,6 +284,9 @@ search_hints(const char *bus, const char *dev, const c walker = hints; getint(&walker); found = 0; + if (verbose_flag) + printf("Searching bus %s dev %s for pnpinfo %s\n", + bus, dev, pnpinfo); while (walker < hints_end) { len = getint(&walker); ival = getint(&walker); @@ -293,7 +296,7 @@ search_hints(const char *bus, const char *dev, const c getstr(&ptr, val1); ival = getint(&ptr); getstr(&ptr, val2); - if (dump_flag) + if (dump_flag || verbose_flag) printf("Version: if %s.%d kmod %s\n", val1, ival, val2); break; case MDT_MODULE: @@ -302,7 +305,7 @@ search_hints(const char *bus, const char *dev, const c if (lastmod) free(lastmod); lastmod = strdup(val2); - if (dump_flag) + if (dump_flag || verbose_flag) printf("Module %s in %s\n", val1, val2); break; case MDT_PNP_INFO: @@ -311,12 +314,23 @@ search_hints(const char *bus, const char *dev, const c getstr(&ptr, val1); getstr(&ptr, val2); ents = getint(&ptr); - if (bus && strcmp(val1, bus) != 0) - break; - if (dump_flag) + if (dump_flag || verbose_flag) printf("PNP info for bus %s format %s %d entries (%s)\n", val1, val2, ents, lastmod); + if (strcmp(val1, "usb") == 0) { + if (verbose_flag) + printf("Treating usb as uhub -- bug in source table still?\n"); + strcpy(val1, "uhub"); + } + if (bus && strcmp(val1, bus) != 0) { + if (verbose_flag) + printf("Skipped because table for bus %s, looking for %s\n", + val1, bus); + break; + } for (i = 0; i < ents; i++) { + if (verbose_flag) + printf("---------- Entry %d ----------\n", i); if (dump_flag) printf(" "); cp = val2; @@ -339,6 +353,9 @@ search_hints(const char *bus, const char *dev, const c if (bit >= 0 && ((1 << bit) & mask) == 0) break; v = pnpval_as_int(cp + 2, pnpinfo); + if (verbose_flag) + printf("Matching %s (%c) table=%#x tomatch=%#x\n", + cp + 2, *cp, v, ival); switch (*cp) { case 'J': if (ival == -1) From owner-svn-src-all@freebsd.org Sun Feb 18 23:35:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30C69F10B02; Sun, 18 Feb 2018 23:35:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB2B1731DA; Sun, 18 Feb 2018 23:35:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D619512C6C; Sun, 18 Feb 2018 23:35:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1INZNnr060835; Sun, 18 Feb 2018 23:35:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1INZNuM060833; Sun, 18 Feb 2018 23:35:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802182335.w1INZNuM060833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Feb 2018 23:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329539 - head/sys/dev/spibus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/spibus X-SVN-Commit-Revision: 329539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 23:35:24 -0000 Author: ian Date: Sun Feb 18 23:35:23 2018 New Revision: 329539 URL: https://svnweb.freebsd.org/changeset/base/329539 Log: Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass so other drivers can refer to them in DRIVER_MODULE() decls. Modified: head/sys/dev/spibus/ofw_spibus.c head/sys/dev/spibus/spibusvar.h Modified: head/sys/dev/spibus/ofw_spibus.c ============================================================================== --- head/sys/dev/spibus/ofw_spibus.c Sun Feb 18 23:16:16 2018 (r329538) +++ head/sys/dev/spibus/ofw_spibus.c Sun Feb 18 23:35:23 2018 (r329539) @@ -214,10 +214,10 @@ static device_method_t ofw_spibus_methods[] = { DEVMETHOD_END }; -static devclass_t ofwspibus_devclass; +devclass_t ofw_spibus_devclass; DEFINE_CLASS_1(spibus, ofw_spibus_driver, ofw_spibus_methods, sizeof(struct spibus_softc), spibus_driver); -DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofwspibus_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); MODULE_VERSION(ofw_spibus, 1); MODULE_DEPEND(ofw_spibus, spibus, 1, 1, 1); Modified: head/sys/dev/spibus/spibusvar.h ============================================================================== --- head/sys/dev/spibus/spibusvar.h Sun Feb 18 23:16:16 2018 (r329538) +++ head/sys/dev/spibus/spibusvar.h Sun Feb 18 23:35:23 2018 (r329539) @@ -68,3 +68,5 @@ SPIBUS_ACCESSOR(clock, CLOCK, uint32_t) extern driver_t spibus_driver; extern devclass_t spibus_devclass; +extern driver_t ofw_spibus_driver; +extern devclass_t ofw_spibus_devclass; From owner-svn-src-all@freebsd.org Mon Feb 19 00:38:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 192ECF157D1; Mon, 19 Feb 2018 00:38:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C003B7543D; Mon, 19 Feb 2018 00:38:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B66AE13611; Mon, 19 Feb 2018 00:38:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J0cElw090404; Mon, 19 Feb 2018 00:38:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J0cE7U090402; Mon, 19 Feb 2018 00:38:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802190038.w1J0cE7U090402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Feb 2018 00:38:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329540 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 329540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 00:38:15 -0000 Author: mjg Date: Mon Feb 19 00:38:14 2018 New Revision: 329540 URL: https://svnweb.freebsd.org/changeset/base/329540 Log: mtx: add mtx_spin_wait_unlocked The primitive can be used to wait for the lock to be released. Intended usage is for locks in structures which are about to be freed. The benefit is the avoided interrupt enable/disable trip + atomic op to grab the lock and shorter wait if the lock is held (since there is no worry someone will contend on the lock, re-reads can be more aggressive). Briefly discussed with: kib Modified: head/sys/kern/kern_mutex.c head/sys/sys/mutex.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sun Feb 18 23:35:23 2018 (r329539) +++ head/sys/kern/kern_mutex.c Mon Feb 19 00:38:14 2018 (r329540) @@ -1226,6 +1226,23 @@ _mtx_lock_indefinite_check(struct mtx *m, struct lock_ cpu_spinwait(); } +void +mtx_spin_wait_unlocked(struct mtx *m) +{ + struct lock_delay_arg lda; + + lda.spin_cnt = 0; + + while (atomic_load_acq_ptr(&m->mtx_lock) != MTX_UNOWNED) { + if (__predict_true(lda.spin_cnt < 10000000)) { + cpu_spinwait(); + lda.spin_cnt++; + } else { + _mtx_lock_indefinite_check(m, &lda); + } + } +} + #ifdef DDB void db_show_mtx(const struct lock_object *lock) Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Sun Feb 18 23:35:23 2018 (r329539) +++ head/sys/sys/mutex.h Mon Feb 19 00:38:14 2018 (r329540) @@ -125,6 +125,8 @@ int __mtx_trylock_spin_flags(volatile uintptr_t *c, in const char *file, int line); void __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts, const char *file, int line); +void mtx_spin_wait_unlocked(struct mtx *m); + #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) void __mtx_assert(const volatile uintptr_t *c, int what, const char *file, int line); From owner-svn-src-all@freebsd.org Mon Feb 19 00:47:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB705F16251; Mon, 19 Feb 2018 00:47:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DD8D759EA; Mon, 19 Feb 2018 00:47:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 747AF137B6; Mon, 19 Feb 2018 00:47:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J0l4x7095116; Mon, 19 Feb 2018 00:47:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J0l4tt095114; Mon, 19 Feb 2018 00:47:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802190047.w1J0l4tt095114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 19 Feb 2018 00:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329541 - in head/sys/modules/i2c: . ofw_iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules/i2c: . ofw_iicbus X-SVN-Commit-Revision: 329541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 00:47:05 -0000 Author: ian Date: Mon Feb 19 00:47:03 2018 New Revision: 329541 URL: https://svnweb.freebsd.org/changeset/base/329541 Log: Build ofw_iicbus as a module if OPT_FDT is defined. Added: head/sys/modules/i2c/ofw_iicbus/ head/sys/modules/i2c/ofw_iicbus/Makefile (contents, props changed) Modified: head/sys/modules/i2c/Makefile Modified: head/sys/modules/i2c/Makefile ============================================================================== --- head/sys/modules/i2c/Makefile Mon Feb 19 00:38:14 2018 (r329540) +++ head/sys/modules/i2c/Makefile Mon Feb 19 00:47:03 2018 (r329541) @@ -20,4 +20,8 @@ SUBDIR = \ smb \ smbus \ +.if !empty(OPT_FDT) +SUBDIR += ofw_iicbus +.endif + .include Added: head/sys/modules/i2c/ofw_iicbus/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/i2c/ofw_iicbus/Makefile Mon Feb 19 00:47:03 2018 (r329541) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD= ofw_iicbus +SRCS= ofw_iicbus.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + ofw_bus_if.h \ + opt_platform.h \ + +.include From owner-svn-src-all@freebsd.org Mon Feb 19 00:54:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80F5DF16BC5; Mon, 19 Feb 2018 00:54:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36FDB76030; Mon, 19 Feb 2018 00:54:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31FA613945; Mon, 19 Feb 2018 00:54:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J0s9h6000152; Mon, 19 Feb 2018 00:54:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J0s9gd000151; Mon, 19 Feb 2018 00:54:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802190054.w1J0s9gd000151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Feb 2018 00:54:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329542 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 00:54:09 -0000 Author: mjg Date: Mon Feb 19 00:54:08 2018 New Revision: 329542 URL: https://svnweb.freebsd.org/changeset/base/329542 Log: Fix process exit vs reap race introduced in r329449 The race manifested itself mostly in terms of crashes with "spin lock held too long". Relevant parts of respective code paths: exit: reap: PROC_LOCK(p); PROC_SLOCK(p); p->p_state == PRS_ZOMBIE PROC_UNLOCK(p); PROC_LOCK(p); /* exit work */ if (p->p_state == PRS_ZOMBIE) /* true */ proc_reap() free proc /* more exit work */ PROC_SUNLOCK(p); Thus a still exiting process is reaped. Prior to the change the zombie check was followed by slock/sunlock trip which prevented the problem. Even code prior to this commit has a bug: the proc is still accessed for statistic collection purposes. However, the severity is rather small and the bug may be fixed in a future commit. Reported by: many Tested by: allanjude Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Feb 19 00:47:03 2018 (r329541) +++ head/sys/kern/kern_exit.c Mon Feb 19 00:54:08 2018 (r329542) @@ -819,6 +819,8 @@ proc_reap(struct thread *td, struct proc *p, int *stat PROC_LOCK_ASSERT(p, MA_OWNED); KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE")); + mtx_spin_wait_unlocked(&p->p_slock); + q = td->td_proc; if (status) From owner-svn-src-all@freebsd.org Mon Feb 19 01:25:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33E0CF19110; Mon, 19 Feb 2018 01:25:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D81527737E; Mon, 19 Feb 2018 01:25:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCDB613E09; Mon, 19 Feb 2018 01:25:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J1PqpJ015027; Mon, 19 Feb 2018 01:25:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J1PqSm015025; Mon, 19 Feb 2018 01:25:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190125.w1J1PqSm015025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 01:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329543 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 329543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 01:25:53 -0000 Author: kevans Date: Mon Feb 19 01:25:52 2018 New Revision: 329543 URL: https://svnweb.freebsd.org/changeset/base/329543 Log: Create style.lua(9) This covers the lua style guidelines we've generally agreed on so far. It will be revised as work continues and we run into more scenarios that need specified. Discussed with: cem, jilles Differential Revision: https://reviews.freebsd.org/D14423 Added: head/share/man/man9/style.lua.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Feb 19 00:54:08 2018 (r329542) +++ head/share/man/man9/Makefile Mon Feb 19 01:25:52 2018 (r329543) @@ -284,6 +284,7 @@ MAN= accept_filter.9 \ stack.9 \ store.9 \ style.9 \ + style.lua.9 \ swi.9 \ sx.9 \ syscall_helper_register.9 \ Added: head/share/man/man9/style.lua.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/style.lua.9 Mon Feb 19 01:25:52 2018 (r329543) @@ -0,0 +1,105 @@ +.\"- +.\" Copyright (c) 2018 Kyle Evans +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 18, 2018 +.Dt STYLE.LUA 9 +.Os +.Sh NAME +.Nm style.lua +.Nd +.Fx +lua file style guide +.Sh DESCRIPTION +This file specifies the preferred style for lua source files in the +.Fx +source tree. +Many of the style rules are implicit in the examples. +Be careful to check the examples before assuming that +.Nm +is silent on an issue. +.Pp +The copyright header should be a series of single-line comments. +Use the single-line comment style for every line in a multi-line comment. +.Pp +After any copyright header, there is a blank line, and the +.Li $\&FreeBSD$ +comment for non-C/C++ source files. +.Pp +The preferred method of including other files and modules is with +.Fn require name , +such as: +.Bd -literal +-- $FreeBSD$ + +config = require("config"); +menu = require("menu"); +password = require("password"); +-- One blank line following the module require block +.Ed +.Pp +.Fn include +is generally avoided. +.Pp +Indentation and wrapping should match the guidelines provided by +.Xr style 9 . +.Pp +Statements should be terminated with a semicolon. +.Ic end +should not be terminated with a semicolon. +.Pp +Where possible, +.Fn s:method ... +is preferred to +.Fn method s ... . +This is applicable to objects with methods. +String are a commonly-used example of objects with methods. +.Pp +Testing for +.Va nil +should be done explicitly, rather than as a boolean expression. +Single-line conditional statements and loops should be avoided. +.Pp +.Ic local +variables should be preferred to module scope variables. +.Pp +Multiple local variables should not be declared +.Sy and +initialized on a single line. +Lines containing multiple variable declarations without initialization are ok. +Lines containing multiple variable declarations initialized to a single function +call returning a tuple with the same number of values is also ok. +.Pp +Initialization +.Sy should +be done at declaration time as appropriate. +.Sh SEE ALSO +.Xr style 9 +.Sh HISTORY +This manual page is inspired from the same source as +.Xr style 9 +manual page in +.Fx . From owner-svn-src-all@freebsd.org Mon Feb 19 01:32:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48C98F1989C; Mon, 19 Feb 2018 01:32:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECBDB77963; Mon, 19 Feb 2018 01:32:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7C1313FA7; Mon, 19 Feb 2018 01:32:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J1WR2p020121; Mon, 19 Feb 2018 01:32:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J1WR82020118; Mon, 19 Feb 2018 01:32:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802190132.w1J1WR82020118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 19 Feb 2018 01:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329544 - in head/sys/modules: . spi spi/spibus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules: . spi spi/spibus X-SVN-Commit-Revision: 329544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 01:32:28 -0000 Author: ian Date: Mon Feb 19 01:32:27 2018 New Revision: 329544 URL: https://svnweb.freebsd.org/changeset/base/329544 Log: Add modules/spi as a gathering point for SPI-related modules, analagous to modules/i2c for i2c/iicbus modules. Build spibus as a module. Added: head/sys/modules/spi/ head/sys/modules/spi/Makefile (contents, props changed) head/sys/modules/spi/spibus/ head/sys/modules/spi/spibus/Makefile (contents, props changed) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Feb 19 01:25:52 2018 (r329543) +++ head/sys/modules/Makefile Mon Feb 19 01:32:27 2018 (r329544) @@ -360,7 +360,7 @@ SUBDIR= \ snp \ sound \ ${_speaker} \ - spigen \ + spi \ ${_splash} \ ${_sppp} \ ste \ Added: head/sys/modules/spi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/spi/Makefile Mon Feb 19 01:32:27 2018 (r329544) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +SUBDIR = \ + ../spigen \ + spibus \ + +.include Added: head/sys/modules/spi/spibus/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/spi/spibus/Makefile Mon Feb 19 01:32:27 2018 (r329544) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/spibus + +KMOD= spibus +SRCS= spibus.c + +.if !empty(OPT_FDT) +SRCS+= ofw_spibus.c +.endif + +# Generated files... +SRCS+= \ + bus_if.h \ + device_if.h \ + spibus_if.c \ + spibus_if.h \ + +.include From owner-svn-src-all@freebsd.org Mon Feb 19 01:39:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D41F0F19F08; Mon, 19 Feb 2018 01:39:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8716B77C14; Mon, 19 Feb 2018 01:39:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 820CB13FAF; Mon, 19 Feb 2018 01:39:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J1d2ia020389; Mon, 19 Feb 2018 01:39:02 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J1d2tD020388; Mon, 19 Feb 2018 01:39:02 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802190139.w1J1d2tD020388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 19 Feb 2018 01:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329545 - head/sys/modules/spi/spibus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/spi/spibus X-SVN-Commit-Revision: 329545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 01:39:03 -0000 Author: ian Date: Mon Feb 19 01:39:02 2018 New Revision: 329545 URL: https://svnweb.freebsd.org/changeset/base/329545 Log: Add ofw_bus_if.h to SRCS. Modified: head/sys/modules/spi/spibus/Makefile Modified: head/sys/modules/spi/spibus/Makefile ============================================================================== --- head/sys/modules/spi/spibus/Makefile Mon Feb 19 01:32:27 2018 (r329544) +++ head/sys/modules/spi/spibus/Makefile Mon Feb 19 01:39:02 2018 (r329545) @@ -6,7 +6,7 @@ KMOD= spibus SRCS= spibus.c .if !empty(OPT_FDT) -SRCS+= ofw_spibus.c +SRCS+= ofw_spibus.c ofw_bus_if.h .endif # Generated files... From owner-svn-src-all@freebsd.org Mon Feb 19 01:49:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14FCDF1AA72; Mon, 19 Feb 2018 01:49:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B13BE7833D; Mon, 19 Feb 2018 01:49:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1B441413E; Mon, 19 Feb 2018 01:49:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J1nJ0t025347; Mon, 19 Feb 2018 01:49:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J1nJEg025343; Mon, 19 Feb 2018 01:49:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802190149.w1J1nJEg025343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 19 Feb 2018 01:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329546 - in head/sys/modules/spi: . at45d mx25l X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules/spi: . at45d mx25l X-SVN-Commit-Revision: 329546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 01:49:20 -0000 Author: ian Date: Mon Feb 19 01:49:19 2018 New Revision: 329546 URL: https://svnweb.freebsd.org/changeset/base/329546 Log: Build at45d and mx25l SPI flash drivers as modules. Added: head/sys/modules/spi/at45d/ head/sys/modules/spi/at45d/Makefile (contents, props changed) head/sys/modules/spi/mx25l/ head/sys/modules/spi/mx25l/Makefile (contents, props changed) Modified: head/sys/modules/spi/Makefile Modified: head/sys/modules/spi/Makefile ============================================================================== --- head/sys/modules/spi/Makefile Mon Feb 19 01:39:02 2018 (r329545) +++ head/sys/modules/spi/Makefile Mon Feb 19 01:49:19 2018 (r329546) @@ -2,6 +2,8 @@ SUBDIR = \ ../spigen \ + at45d \ + mx25l \ spibus \ .include Added: head/sys/modules/spi/at45d/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/spi/at45d/Makefile Mon Feb 19 01:49:19 2018 (r329546) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/flash + +KMOD= at45d +SRCS= at45d.c + +# Generated files... +SRCS+= \ + bus_if.h \ + device_if.h \ + spibus_if.c \ + spibus_if.h \ + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include Added: head/sys/modules/spi/mx25l/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/spi/mx25l/Makefile Mon Feb 19 01:49:19 2018 (r329546) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/flash + +KMOD= mx25l +SRCS= mx25l.c + +# Generated files... +SRCS+= \ + bus_if.h \ + device_if.h \ + spibus_if.c \ + spibus_if.h \ + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From owner-svn-src-all@freebsd.org Mon Feb 19 01:59:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C27A6F1B9A8; Mon, 19 Feb 2018 01:59:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 670BF78C9B; Mon, 19 Feb 2018 01:59:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E58C14304; Mon, 19 Feb 2018 01:59:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J1xfRJ030092; Mon, 19 Feb 2018 01:59:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J1xfaN030091; Mon, 19 Feb 2018 01:59:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190159.w1J1xfaN030091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 01:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329547 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 01:59:41 -0000 Author: kevans Date: Mon Feb 19 01:59:41 2018 New Revision: 329547 URL: https://svnweb.freebsd.org/changeset/base/329547 Log: stand/lua: Allow menu items to be conditionally (in)visible This will be used to conditionally show/hide the boot environment menu. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 01:49:19 2018 (r329546) +++ head/stand/lua/drawer.lua Mon Feb 19 01:59:41 2018 (r329547) @@ -167,6 +167,11 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; for line_num, e in ipairs(m) do + -- Allow menu items to be conditionally visible by specifying + -- a visible function. + if (e.visible ~= nil) and (not e.visible()) then + goto continue + end if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; screen.setcursor(x, y + line_num); @@ -197,6 +202,7 @@ function drawer.drawmenu(m) screen.setcursor(x, y + line_num); print(e.name()); end + ::continue:: end return alias_table; end From owner-svn-src-all@freebsd.org Mon Feb 19 02:01:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E293F1BD98; Mon, 19 Feb 2018 02:01:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE9D578F79; Mon, 19 Feb 2018 02:01:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B90EA14365; Mon, 19 Feb 2018 02:01:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J21nYs034805; Mon, 19 Feb 2018 02:01:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J21ndq034804; Mon, 19 Feb 2018 02:01:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190201.w1J21ndq034804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 02:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329548 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 02:01:50 -0000 Author: kevans Date: Mon Feb 19 02:01:49 2018 New Revision: 329548 URL: https://svnweb.freebsd.org/changeset/base/329548 Log: stand/lua: Addres style.lua(9) concern Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 01:59:41 2018 (r329547) +++ head/stand/lua/drawer.lua Mon Feb 19 02:01:49 2018 (r329548) @@ -170,7 +170,7 @@ function drawer.drawmenu(m) -- Allow menu items to be conditionally visible by specifying -- a visible function. if (e.visible ~= nil) and (not e.visible()) then - goto continue + goto continue; end if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; From owner-svn-src-all@freebsd.org Mon Feb 19 02:09:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59051F1C42A; Mon, 19 Feb 2018 02:09:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0816579402; Mon, 19 Feb 2018 02:09:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF1B114495; Mon, 19 Feb 2018 02:09:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J29ApL035081; Mon, 19 Feb 2018 02:09:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J29AjC035080; Mon, 19 Feb 2018 02:09:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190209.w1J29AjC035080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 02:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329549 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 02:09:11 -0000 Author: kevans Date: Mon Feb 19 02:09:10 2018 New Revision: 329549 URL: https://svnweb.freebsd.org/changeset/base/329549 Log: stand/lua: Clear the screen before prompting for passwords In the worst case scenario, we have no passwords to prompt for and we end up just clearing the screen twice before we draw the menu or proceed with boot. In the best case scenario, we don't try drawing password prompts amidst a bunch of kernel/module loading. Modified: head/stand/lua/password.lua Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Mon Feb 19 02:01:49 2018 (r329548) +++ head/stand/lua/password.lua Mon Feb 19 02:09:10 2018 (r329549) @@ -58,6 +58,7 @@ function password.read() end function password.check() + screen.clear(); screen.defcursor(); -- pwd is optionally supplied if we want to check it local function do_prompt(prompt, pwd) From owner-svn-src-all@freebsd.org Mon Feb 19 03:07:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AF90F20D27; Mon, 19 Feb 2018 03:07:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5FF57BCBC; Mon, 19 Feb 2018 03:07:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f48.google.com with SMTP id p204so7594283itc.4; Sun, 18 Feb 2018 19:07:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=TVtEdH61V0K7H0IBq+rTUibULhSPssBXk4+H+nN1gK8=; b=IWELJtFX9K4+BStTy4Ijvcf+Yz6A5zWp1XWSfVPa0zTI5zxf8CB7Hrz7MVgYm5wgZl nxlqKL3leR8JZeA4cKy7B4THuJ5moPP4l9dTUQo8rgdmuyVSlzCW5lubC6t/5O4Gddef ih83w1OBK6wbBQqnSW1amcq+pbppUBE647Q4UersvHqXc/o5hVj9rnrotmiDeeuLWYMd G7cv85Wb7+UP89FxVXZ19Zi5XNEo8/y/XpMWvpSPT9fFQeQ2SK6Wh253MXd4xjA9mOIm RZPoX5EU8C3ScRZxIXdGhMahe6RrB2EN7vmYm4N8NnHISN0z7TxKRU9RpVsgZxc2HqXw y9cA== X-Gm-Message-State: APf1xPBtcyZOE2N4/8Fj4njRaLfxlt0sURhq7YUSvdiKfU2saHglbpgo uN/grAiw7W+JeRyw/0pOQMoL3UAN X-Google-Smtp-Source: AH8x224mikQHz4MjjTC2xst526qRD2vsTlIYlKD9LSqIJHZHC354B1NsfkK0qLhTIM9gg7XFoP4YQg== X-Received: by 10.36.170.77 with SMTP id y13mr3471508iti.9.1519009623266; Sun, 18 Feb 2018 19:07:03 -0800 (PST) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com. [209.85.223.177]) by smtp.gmail.com with ESMTPSA id u15sm6765290iou.17.2018.02.18.19.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 19:07:02 -0800 (PST) Received: by mail-io0-f177.google.com with SMTP id u84so9849363iod.9; Sun, 18 Feb 2018 19:07:02 -0800 (PST) X-Received: by 10.107.149.135 with SMTP id x129mr2435481iod.143.1519009622755; Sun, 18 Feb 2018 19:07:02 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Sun, 18 Feb 2018 19:07:02 -0800 (PST) In-Reply-To: <201802190125.w1J1PqSm015025@repo.freebsd.org> References: <201802190125.w1J1PqSm015025@repo.freebsd.org> From: Conrad Meyer Date: Sun, 18 Feb 2018 19:07:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329543 - head/share/man/man9 To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 03:07:10 -0000 On Sun, Feb 18, 2018 at 5:25 PM, Kyle Evans wrote: > Author: kevans > Date: Mon Feb 19 01:25:52 2018 > New Revision: 329543 > URL: https://svnweb.freebsd.org/changeset/base/329543 > > Log: > Create style.lua(9) > > This covers the lua style guidelines we've generally agreed on so far. It > will be revised as work continues and we run into more scenarios that need > specified. > > Discussed with: cem, jilles > Differential Revision: https://reviews.freebsd.org/D14423 For anyone digging in mailing list history, might as well consider this Reviewed/Approved by me as well. (I meant to mark it approved in phab but neglected to do so before the commit.) Best, Conrad From owner-svn-src-all@freebsd.org Mon Feb 19 03:52:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68475F23678; Mon, 19 Feb 2018 03:52:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 859DD7D893; Mon, 19 Feb 2018 03:52:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 808A1156A3; Mon, 19 Feb 2018 03:52:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J3q2uh087325; Mon, 19 Feb 2018 03:52:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J3q2Vb087324; Mon, 19 Feb 2018 03:52:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190352.w1J3q2Vb087324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 03:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329550 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 03:52:04 -0000 Author: kevans Date: Mon Feb 19 03:52:02 2018 New Revision: 329550 URL: https://svnweb.freebsd.org/changeset/base/329550 Log: stand/lua: Store the loaded kernel as config.kernel_loaded 'nil' means the 'first kernel found in module_path', which is the same interpretation as passing 'nil' to loadkernel. Otherwise, it denotes the name of a kernel that we've successfully loaded. When reloaded later, we will still need to do the full search again to locate the actual kernel in case things have changed, so just the name is good enough. This is in support of upcoming boot environment support. vfs.root.mountfrom and currdev will be changed, then we will reload configuration and attempt to reload the currently chosen kernel unless we shouldn't. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 02:09:10 2018 (r329549) +++ head/stand/lua/config.lua Mon Feb 19 03:52:02 2018 (r329550) @@ -297,6 +297,8 @@ function config.loadkernel(other_kernel) local res = load_bootfile(); if (res ~= nil) then + -- Default kernel is loaded + config.kernel_loaded = nil; return true; else print("No kernel set, failed to load from module_path"); @@ -321,6 +323,7 @@ function config.loadkernel(other_kernel) -- succeeded, add path to module_path if (res ~= nil) then + config.kernel_loaded = kernel; if (module_path ~= nil) then loader.setenv("module_path", v .. ";" .. module_path); @@ -333,6 +336,7 @@ function config.loadkernel(other_kernel) -- try as a file res = try_load(kernel); if (res ~= nil) then + config.kernel_loaded = kernel; return true; else print("Failed to load kernel '" .. kernel .. "'"); From owner-svn-src-all@freebsd.org Mon Feb 19 03:59:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F9BEF23D66; Mon, 19 Feb 2018 03:59:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35A9D7DCD6; Mon, 19 Feb 2018 03:59:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 309AE156D0; Mon, 19 Feb 2018 03:59:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J3xRXb090728; Mon, 19 Feb 2018 03:59:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J3xRSs090727; Mon, 19 Feb 2018 03:59:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802190359.w1J3xRSs090727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 03:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329551 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 03:59:27 -0000 Author: kevans Date: Mon Feb 19 03:59:26 2018 New Revision: 329551 URL: https://svnweb.freebsd.org/changeset/base/329551 Log: stand/lua: reload previously loaded kernel at config-load/reload r329550 introduced config.kernel_loaded. config.load() doesn't provide a means of overriding the kernel to load, but that likely isn't necessary as it will not be a common case. When loading the kernel, just attempt to load the kernel previously loaded and specified in config.kernel_loaded. If we haven't loaded a kernel yet, config.kernel_loaded will be unset/nil and the "default"/first kernel found will be loaded. If we've loaded a kernel, we'll try to load that same kernel again and fallback to the default kernel if we need to. This in also in support of upcoming boot environment support. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 03:52:02 2018 (r329550) +++ head/stand/lua/config.lua Mon Feb 19 03:59:26 2018 (r329551) @@ -369,7 +369,7 @@ function config.load(file) config.module_path = loader.getenv("module_path"); print("Loading kernel..."); - config.loadkernel(); + config.loadkernel(config.kernel_loaded); print("Loading configured modules..."); if (not config.loadmod(modules)) then From owner-svn-src-all@freebsd.org Mon Feb 19 04:47:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDBF2F008AF; Mon, 19 Feb 2018 04:47:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 669B87F833; Mon, 19 Feb 2018 04:47:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5648B15EB2; Mon, 19 Feb 2018 04:47:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J4lXEW015783; Mon, 19 Feb 2018 04:47:33 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J4lWto015772; Mon, 19 Feb 2018 04:47:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201802190447.w1J4lWto015772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Feb 2018 04:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329552 - vendor/less/dist X-SVN-Group: vendor X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: vendor/less/dist X-SVN-Commit-Revision: 329552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 04:47:34 -0000 Author: delphij Date: Mon Feb 19 04:47:31 2018 New Revision: 329552 URL: https://svnweb.freebsd.org/changeset/base/329552 Log: Vendor import of less v530. Modified: vendor/less/dist/NEWS vendor/less/dist/README vendor/less/dist/command.c vendor/less/dist/help.c vendor/less/dist/less.man vendor/less/dist/less.nro vendor/less/dist/lessecho.man vendor/less/dist/lessecho.nro vendor/less/dist/lesskey.man vendor/less/dist/lesskey.nro vendor/less/dist/version.c Modified: vendor/less/dist/NEWS ============================================================================== --- vendor/less/dist/NEWS Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/NEWS Mon Feb 19 04:47:31 2018 (r329552) @@ -11,7 +11,7 @@ ====================================================================== - Major changes between "less" versions 487 and 529 + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: vendor/less/dist/README ============================================================================== --- vendor/less/dist/README Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/README Mon Feb 19 04:47:31 2018 (r329552) @@ -1,7 +1,7 @@ - Less, version 529 + Less, version 530 - This is the distribution of less, version 529, released 13 Nov 2017. + This is the distribution of less, version 530, released 05 Dec 2017. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: vendor/less/dist/command.c ============================================================================== --- vendor/less/dist/command.c Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/command.c Mon Feb 19 04:47:31 2018 (r329552) @@ -806,7 +806,7 @@ getcc_end_command() * (characters previously given to ungetcc or ungetsc). */ static LWCHAR -getccu() +getccu(VOID_PARAM) { LWCHAR c; if (ungot == NULL) Modified: vendor/less/dist/help.c ============================================================================== --- vendor/less/dist/help.c Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/help.c Mon Feb 19 04:47:31 2018 (r329552) @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 17:31 on 2017/11/13 */ +/* This file was generated by mkhelp.pl from less.hlp at 22:56 on 2017/12/5 */ #include "less.h" constant char helpdata[] = { '\n', Modified: vendor/less/dist/less.man ============================================================================== --- vendor/less/dist/less.man Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/less.man Mon Feb 19 04:47:31 2018 (r329552) @@ -1106,7 +1106,9 @@ LESS(1) General Commands Manual ment file and less uses the original file, as normal. To use an input pipe, make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input - pipe. + pipe. As with non-pipe input preprocessors, the command string must + contain one occurrence of %s, which is replaced with the filename of + the input file. For example, on many Unix systems, this script will work like the pre- vious example scripts: @@ -1664,4 +1666,4 @@ LESS(1) General Commands Manual - Version 529: 13 Nov 2017 LESS(1) + Version 530: 05 Dec 2017 LESS(1) Modified: vendor/less/dist/less.nro ============================================================================== --- vendor/less/dist/less.nro Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/less.nro Mon Feb 19 04:47:31 2018 (r329552) @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 529: 13 Nov 2017" +.TH LESS 1 "Version 530: 05 Dec 2017" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -1199,6 +1199,8 @@ uses the original file, as normal. To use an input pipe, make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input pipe. +As with non-pipe input preprocessors, the command string must contain one +occurrence of %s, which is replaced with the filename of the input file. .PP For example, on many Unix systems, this script will work like the previous example scripts: Modified: vendor/less/dist/lessecho.man ============================================================================== --- vendor/less/dist/lessecho.man Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/lessecho.man Mon Feb 19 04:47:31 2018 (r329552) @@ -51,4 +51,4 @@ LESSECHO(1) General Commands Manual - Version 529: 13 Nov 2017 LESSECHO(1) + Version 530: 05 Dec 2017 LESSECHO(1) Modified: vendor/less/dist/lessecho.nro ============================================================================== --- vendor/less/dist/lessecho.nro Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/lessecho.nro Mon Feb 19 04:47:31 2018 (r329552) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 529: 13 Nov 2017" +.TH LESSECHO 1 "Version 530: 05 Dec 2017" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS Modified: vendor/less/dist/lesskey.man ============================================================================== --- vendor/less/dist/lesskey.man Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/lesskey.man Mon Feb 19 04:47:31 2018 (r329552) @@ -361,4 +361,4 @@ LESSKEY(1) General Commands Manual - Version 529: 13 Nov 2017 LESSKEY(1) + Version 530: 05 Dec 2017 LESSKEY(1) Modified: vendor/less/dist/lesskey.nro ============================================================================== --- vendor/less/dist/lesskey.nro Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/lesskey.nro Mon Feb 19 04:47:31 2018 (r329552) @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 529: 13 Nov 2017" +.TH LESSKEY 1 "Version 530: 05 Dec 2017" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS Modified: vendor/less/dist/version.c ============================================================================== --- vendor/less/dist/version.c Mon Feb 19 03:59:26 2018 (r329551) +++ vendor/less/dist/version.c Mon Feb 19 04:47:31 2018 (r329552) @@ -852,6 +852,7 @@ v526 10/25/17 Fix search hilite bug introduced in v5 v527 10/30/17 Fix search hilite bug on last page with -a. v528 11/3/17 Make second ESC-u clear status column. v529 11/12/17 Display Unicode formatting chars in hex if -U is set. +v530 12/2/17 Minor doc change and add missing VOID_PARAM. */ -char version[] = "529"; +char version[] = "530"; From owner-svn-src-all@freebsd.org Mon Feb 19 04:56:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DD6AF0123B; Mon, 19 Feb 2018 04:56:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D28E7FDAC; Mon, 19 Feb 2018 04:56:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 293ED16043; Mon, 19 Feb 2018 04:56:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J4uNxE020509; Mon, 19 Feb 2018 04:56:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J4uMns020508; Mon, 19 Feb 2018 04:56:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201802190456.w1J4uMns020508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Feb 2018 04:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329553 - vendor/less/v530 X-SVN-Group: vendor X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: vendor/less/v530 X-SVN-Commit-Revision: 329553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 04:56:23 -0000 Author: delphij Date: Mon Feb 19 04:56:22 2018 New Revision: 329553 URL: https://svnweb.freebsd.org/changeset/base/329553 Log: Tag less v530. Added: vendor/less/v530/ - copied from r329552, vendor/less/dist/ From owner-svn-src-all@freebsd.org Mon Feb 19 05:10:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3955F02170; Mon, 19 Feb 2018 05:10:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 913C580475; Mon, 19 Feb 2018 05:10:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8355E161D5; Mon, 19 Feb 2018 05:10:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J5AN44025944; Mon, 19 Feb 2018 05:10:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J5AM5O025936; Mon, 19 Feb 2018 05:10:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201802190510.w1J5AM5O025936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 19 Feb 2018 05:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329554 - head/contrib/less X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/contrib/less X-SVN-Commit-Revision: 329554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 05:10:24 -0000 Author: delphij Date: Mon Feb 19 05:10:22 2018 New Revision: 329554 URL: https://svnweb.freebsd.org/changeset/base/329554 Log: MFV r329552: less v530. MFC after: 2 weeks Modified: head/contrib/less/NEWS head/contrib/less/README head/contrib/less/command.c head/contrib/less/help.c head/contrib/less/less.nro head/contrib/less/lessecho.nro head/contrib/less/lesskey.nro head/contrib/less/version.c Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/NEWS Mon Feb 19 05:10:22 2018 (r329554) @@ -11,7 +11,7 @@ ====================================================================== - Major changes between "less" versions 487 and 529 + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: head/contrib/less/README ============================================================================== --- head/contrib/less/README Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/README Mon Feb 19 05:10:22 2018 (r329554) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 529 + Less, version 530 - This is the distribution of less, version 529, released 13 Nov 2017. + This is the distribution of less, version 530, released 05 Dec 2017. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/command.c Mon Feb 19 05:10:22 2018 (r329554) @@ -812,7 +812,7 @@ getcc_end_command() * (characters previously given to ungetcc or ungetsc). */ static LWCHAR -getccu() +getccu(VOID_PARAM) { LWCHAR c; if (ungot == NULL) Modified: head/contrib/less/help.c ============================================================================== --- head/contrib/less/help.c Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/help.c Mon Feb 19 05:10:22 2018 (r329554) @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 17:31 on 2017/11/13 */ +/* This file was generated by mkhelp.pl from less.hlp at 22:56 on 2017/12/5 */ #include "less.h" constant char helpdata[] = { '\n', Modified: head/contrib/less/less.nro ============================================================================== --- head/contrib/less/less.nro Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/less.nro Mon Feb 19 05:10:22 2018 (r329554) @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 529: 13 Nov 2017" +.TH LESS 1 "Version 530: 05 Dec 2017" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -1199,6 +1199,8 @@ uses the original file, as normal. To use an input pipe, make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input pipe. +As with non-pipe input preprocessors, the command string must contain one +occurrence of %s, which is replaced with the filename of the input file. .PP For example, on many Unix systems, this script will work like the previous example scripts: Modified: head/contrib/less/lessecho.nro ============================================================================== --- head/contrib/less/lessecho.nro Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/lessecho.nro Mon Feb 19 05:10:22 2018 (r329554) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 529: 13 Nov 2017" +.TH LESSECHO 1 "Version 530: 05 Dec 2017" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS Modified: head/contrib/less/lesskey.nro ============================================================================== --- head/contrib/less/lesskey.nro Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/lesskey.nro Mon Feb 19 05:10:22 2018 (r329554) @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 529: 13 Nov 2017" +.TH LESSKEY 1 "Version 530: 05 Dec 2017" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS Modified: head/contrib/less/version.c ============================================================================== --- head/contrib/less/version.c Mon Feb 19 04:56:22 2018 (r329553) +++ head/contrib/less/version.c Mon Feb 19 05:10:22 2018 (r329554) @@ -852,6 +852,7 @@ v526 10/25/17 Fix search hilite bug introduced in v5 v527 10/30/17 Fix search hilite bug on last page with -a. v528 11/3/17 Make second ESC-u clear status column. v529 11/12/17 Display Unicode formatting chars in hex if -U is set. +v530 12/2/17 Minor doc change and add missing VOID_PARAM. */ -char version[] = "529"; +char version[] = "530"; From owner-svn-src-all@freebsd.org Mon Feb 19 06:11:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE80AF0535D; Mon, 19 Feb 2018 06:11:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A15428239F; Mon, 19 Feb 2018 06:11:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C2AA16CBF; Mon, 19 Feb 2018 06:11:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J6BwGs057433; Mon, 19 Feb 2018 06:11:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J6Bwaq057432; Mon, 19 Feb 2018 06:11:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802190611.w1J6Bwaq057432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Feb 2018 06:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329555 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 329555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 06:11:59 -0000 Author: hselasky Date: Mon Feb 19 06:11:58 2018 New Revision: 329555 URL: https://svnweb.freebsd.org/changeset/base/329555 Log: When stepping the radix tree in the LinuxKPI make sure we clear the least significant bits, so that no entries are skipped. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_radix.c Modified: head/sys/compat/linuxkpi/common/src/linux_radix.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_radix.c Mon Feb 19 05:10:22 2018 (r329554) +++ head/sys/compat/linuxkpi/common/src/linux_radix.c Mon Feb 19 06:11:58 2018 (r329555) @@ -103,6 +103,7 @@ restart: next = node->slots[pos]; if (next == NULL) { index += step; + index &= -step; if ((index & mask) == 0) goto restart; } else { From owner-svn-src-all@freebsd.org Mon Feb 19 07:20:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA5CEF08B14; Mon, 19 Feb 2018 07:20:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B2AF84976; Mon, 19 Feb 2018 07:20:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E7A452603CD; Mon, 19 Feb 2018 08:20:44 +0100 (CET) Subject: Re: svn commit: r329538 - head/sbin/devmatch To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802182316.w1INGGXE050801@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <9f4ed166-74fe-d5a8-e736-81551c0fd971@selasky.org> Date: Mon, 19 Feb 2018 08:20:43 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802182316.w1INGGXE050801@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 07:20:51 -0000 On 02/19/18 00:16, Warner Losh wrote: > + if (bus && strcmp(val1, bus) != 0) { > + if (verbose_flag) > + printf("Skipped because table for bus %s, looking for %s\n", > + val1, bus); > + break; > + } There might be some ports kmods which needs recompiling. Try bumping the __FreeBSD_version ? The parent of the topmost USB HUB is: dev.uhub.0.%parent: usbus0 Though no drivers should attach here! --HPS From owner-svn-src-all@freebsd.org Mon Feb 19 08:55:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD3B7F102CD; Mon, 19 Feb 2018 08:55:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56ACA68310; Mon, 19 Feb 2018 08:55:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A9118670; Mon, 19 Feb 2018 08:55:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1J8tN8o040631; Mon, 19 Feb 2018 08:55:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1J8tNFn040630; Mon, 19 Feb 2018 08:55:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802190855.w1J8tNFn040630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 19 Feb 2018 08:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329556 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 08:55:23 -0000 Author: avg Date: Mon Feb 19 08:55:22 2018 New Revision: 329556 URL: https://svnweb.freebsd.org/changeset/base/329556 Log: relax an assert in zfsctl_snapdir_lookup to match r323578 Since r323578 we may remove the last reference to a covered vnode with vrele() instead of vput(). So, v_usecount may be decremented before the vnode is locked and zfsctl_snapdir_lookup may "catch" the vnode with v_usecount of zero and v_holdcnt of one. PR: 225795 Reported by: asomers MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Feb 19 06:11:58 2018 (r329555) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Feb 19 08:55:22 2018 (r329556) @@ -980,7 +980,7 @@ zfsctl_snapdir_lookup(ap) * the mount point or the thread doing the mounting. * There can be more references from concurrent lookups. */ - KASSERT(vrefcnt(*vpp) > 1, ("found unreferenced mountpoint")); + KASSERT((*vpp)->v_holdcnt > 1, ("found unheld mountpoint")); /* * Check if a snapshot is already mounted on top of the vnode. From owner-svn-src-all@freebsd.org Mon Feb 19 10:30:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0C6EF17A83; Mon, 19 Feb 2018 10:30:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABB506C690; Mon, 19 Feb 2018 10:30:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1A93194EF; Mon, 19 Feb 2018 10:30:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JAUYTb086740; Mon, 19 Feb 2018 10:30:34 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JAUY8N086739; Mon, 19 Feb 2018 10:30:34 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802191030.w1JAUY8N086739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Feb 2018 10:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329558 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 10:30:36 -0000 Author: ae Date: Mon Feb 19 10:30:34 2018 New Revision: 329558 URL: https://svnweb.freebsd.org/changeset/base/329558 Log: MFC r328540: Assign IPv6 link-local address to loopback interfaces whith unit > 0. When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr() to check, that interface doesn't already have given address and then uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just exits and thus skips assignment of IPv6 LLA. Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is already assigned in the system, do not call in6_ifattach_loopback(). PR: 138678 Modified: stable/11/sys/netinet6/in6_ifattach.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/11/sys/netinet6/in6_ifattach.c Mon Feb 19 09:08:46 2018 (r329557) +++ stable/11/sys/netinet6/in6_ifattach.c Mon Feb 19 10:30:34 2018 (r329558) @@ -689,7 +689,6 @@ void in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) { struct in6_ifaddr *ia; - struct in6_addr in6; if (ifp->if_afdata[AF_INET6] == NULL) return; @@ -722,18 +721,16 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * assign loopback address for loopback interface. - * XXX multiple loopback interface case. */ if ((ifp->if_flags & IFF_LOOPBACK) != 0) { - struct ifaddr *ifa; - - in6 = in6addr_loopback; - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6); - if (ifa == NULL) { - if (in6_ifattach_loopback(ifp) != 0) - return; - } else - ifa_free(ifa); + /* + * check that loopback address doesn't exist yet. + */ + ia = in6ifa_ifwithaddr(&in6addr_loopback, 0); + if (ia == NULL) + in6_ifattach_loopback(ifp); + else + ifa_free(&ia->ia_ifa); } /* @@ -741,18 +738,10 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) */ if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { - int error; - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia == NULL) { - error = in6_ifattach_linklocal(ifp, altifp); -#if 0 - if (error) - log(LOG_NOTICE, "in6_ifattach_linklocal: " - "failed to add a link-local addr to %s\n", - if_name(ifp)); -#endif - } else + if (ia == NULL) + in6_ifattach_linklocal(ifp, altifp); + else ifa_free(&ia->ia_ifa); } From owner-svn-src-all@freebsd.org Mon Feb 19 10:34:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 614ADF181E5; Mon, 19 Feb 2018 10:34:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 139216D312; Mon, 19 Feb 2018 10:34:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A52F19684; Mon, 19 Feb 2018 10:34:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JAYUJq092420; Mon, 19 Feb 2018 10:34:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JAYUHi092419; Mon, 19 Feb 2018 10:34:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802191034.w1JAYUHi092419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Feb 2018 10:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329559 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 10:34:31 -0000 Author: ae Date: Mon Feb 19 10:34:30 2018 New Revision: 329559 URL: https://svnweb.freebsd.org/changeset/base/329559 Log: MFC r328541: Do not skip scope zone violation check, when mbuf has M_FASTFWD_OURS flag. When mbuf has M_FASTFWD_OURS flag, this means that a destination address is our local, but we still need to pass scope zone violation check, because protocol level expects that IPv6 link-local addresses have embedded scope zone indexes. This should fix the problem, when ipfw is used to forward packets to local address and source address of a packet is IPv6 LLA. Reported by: asomers@ Modified: stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Mon Feb 19 10:30:34 2018 (r329558) +++ stable/11/sys/netinet6/ip6_input.c Mon Feb 19 10:34:30 2018 (r329559) @@ -571,10 +571,8 @@ ip6_input(struct mbuf *m) /* * Firewall changed destination to local. */ - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } /* @@ -735,10 +733,8 @@ ip6_input(struct mbuf *m) if ((m = ip6_tryforward(m)) == NULL) return; if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; ip6 = mtod(m, struct ip6_hdr *); - goto hbhcheck; + goto passin; } } #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -769,13 +765,7 @@ ip6_input(struct mbuf *m) return; ip6 = mtod(m, struct ip6_hdr *); srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst); - - if (m->m_flags & M_FASTFWD_OURS) { - m->m_flags &= ~M_FASTFWD_OURS; - ours = 1; - goto hbhcheck; - } - if ((m->m_flags & M_IP6_NEXTHOP) && + if ((m->m_flags & (M_IP6_NEXTHOP | M_FASTFWD_OURS)) == M_IP6_NEXTHOP && m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) { /* * Directly ship the packet on. This allows forwarding @@ -805,6 +795,11 @@ passin: in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; + } + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + goto hbhcheck; } /* * Multicast check. Assume packet is for us to avoid From owner-svn-src-all@freebsd.org Mon Feb 19 10:59:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40A31F1A21E; Mon, 19 Feb 2018 10:59:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA32D6E323; Mon, 19 Feb 2018 10:59:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0B7B199BD; Mon, 19 Feb 2018 10:59:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JAxJ09002486; Mon, 19 Feb 2018 10:59:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JAxJpZ002485; Mon, 19 Feb 2018 10:59:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802191059.w1JAxJpZ002485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Feb 2018 10:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329560 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 329560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 10:59:20 -0000 Author: kib Date: Mon Feb 19 10:59:19 2018 New Revision: 329560 URL: https://svnweb.freebsd.org/changeset/base/329560 Log: MFC r329347: Note that on amd64 pmap_enter(psind = 1) works. Modified: stable/11/share/man/man9/pmap_enter.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/pmap_enter.9 ============================================================================== --- stable/11/share/man/man9/pmap_enter.9 Mon Feb 19 10:34:30 2018 (r329559) +++ stable/11/share/man/man9/pmap_enter.9 Mon Feb 19 10:59:19 2018 (r329560) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2015 +.Dd February 16, 2018 .Dt PMAP_ENTER 9 .Os .Sh NAME @@ -133,13 +133,13 @@ The function must handle the multiprocessor TLB consistency for the given address. .Sh NOTES -On amd64, arm and i386 architectures the existing implementation +On arm and i386 architectures the existing implementation of the .Nm function is incomplete, only value 0 for .Fa psind is supported. -Other supported architectures have +Other supported architectures, except amd64, have .Dv pagesizes[] array of size 1. .Sh RETURN VALUES From owner-svn-src-all@freebsd.org Mon Feb 19 11:14:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02CDFF1BA42; Mon, 19 Feb 2018 11:14:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96F3A6EFD1; Mon, 19 Feb 2018 11:14:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 889F519CDC; Mon, 19 Feb 2018 11:14:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JBEcK8022618; Mon, 19 Feb 2018 11:14:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JBEchL022617; Mon, 19 Feb 2018 11:14:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802191114.w1JBEchL022617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Feb 2018 11:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329561 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 329561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 11:14:39 -0000 Author: ae Date: Mon Feb 19 11:14:38 2018 New Revision: 329561 URL: https://svnweb.freebsd.org/changeset/base/329561 Log: Check packet length to do not make out of bounds access. Also save ah_nxt value to use it later, since ah pointer can become invalid. Reported by: Maxime Villard MFC after: 5 days Modified: head/sys/netipsec/xform_ah.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Mon Feb 19 10:59:19 2018 (r329560) +++ head/sys/netipsec/xform_ah.c Mon Feb 19 11:14:38 2018 (r329561) @@ -582,6 +582,16 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski error = EACCES; goto bad; } + if (skip + authsize + rplen > m->m_pkthdr.len) { + DPRINTF(("%s: bad mbuf length %u (expecting %lu)" + " for packet in SA %s/%08lx\n", __func__, + m->m_pkthdr.len, (u_long) (skip + authsize + rplen), + ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)), + (u_long) ntohl(sav->spi))); + AHSTAT_INC(ahs_badauthl); + error = EACCES; + goto bad; + } AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl); /* Get crypto descriptors. */ @@ -626,6 +636,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Zeroize the authenticator on the packet. */ m_copyback(m, skip + rplen, authsize, ipseczeroes); + /* Save ah_nxt, since ah pointer can become invalid after "massage" */ + hl = ah->ah_nxt; + /* "Massage" the packet headers for crypto processing. */ error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family, skip, ahx->type, 0); @@ -650,7 +663,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* These are passed as-is to the callback. */ xd->sav = sav; - xd->nxt = ah->ah_nxt; + xd->nxt = hl; xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; From owner-svn-src-all@freebsd.org Mon Feb 19 12:20:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 000F4F214A9; Mon, 19 Feb 2018 12:20:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6851719BC; Mon, 19 Feb 2018 12:20:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D60D1A67A; Mon, 19 Feb 2018 12:20:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JCKHLp053250; Mon, 19 Feb 2018 12:20:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JCKHtP053249; Mon, 19 Feb 2018 12:20:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802191220.w1JCKHtP053249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Feb 2018 12:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r329562 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 329562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 12:20:18 -0000 Author: hselasky Date: Mon Feb 19 12:20:17 2018 New Revision: 329562 URL: https://svnweb.freebsd.org/changeset/base/329562 Log: Add myself. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Feb 19 11:14:38 2018 (r329561) +++ svnadmin/conf/sizelimit.conf Mon Feb 19 12:20:17 2018 (r329562) @@ -19,6 +19,7 @@ bapt brooks davidcs dim +hselasky imp jb jeff From owner-svn-src-all@freebsd.org Mon Feb 19 12:20:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C40AEF21562; Mon, 19 Feb 2018 12:20:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7730171B06; Mon, 19 Feb 2018 12:20:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57FDC1A691; Mon, 19 Feb 2018 12:20:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JCKqUT054201; Mon, 19 Feb 2018 12:20:52 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JCKq1s054199; Mon, 19 Feb 2018 12:20:52 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802191220.w1JCKq1s054199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Feb 2018 12:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329563 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 329563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 12:20:53 -0000 Author: ae Date: Mon Feb 19 12:20:51 2018 New Revision: 329563 URL: https://svnweb.freebsd.org/changeset/base/329563 Log: Remove unused variables and sysctl declaration. MFC after: 1 week Modified: head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Mon Feb 19 12:20:17 2018 (r329562) +++ head/sys/netipsec/ipsec.c Mon Feb 19 12:20:51 2018 (r329563) @@ -110,7 +110,6 @@ VNET_PCPUSTAT_SYSINIT(ipsec4stat); VNET_PCPUSTAT_SYSUNINIT(ipsec4stat); #endif /* VIMAGE */ -VNET_DEFINE(int, ip4_ah_offsetmask) = 0; /* maybe IP_DF? */ /* DF bit on encap. 0: clear 1: set 2: copy */ VNET_DEFINE(int, ip4_ipsec_dfbit) = 0; VNET_DEFINE(int, ip4_esp_trans_deflev) = IPSEC_LEVEL_USE; @@ -119,7 +118,6 @@ VNET_DEFINE(int, ip4_ah_trans_deflev) = IPSEC_LEVEL_US VNET_DEFINE(int, ip4_ah_net_deflev) = IPSEC_LEVEL_USE; /* ECN ignore(-1)/forbidden(0)/allowed(1) */ VNET_DEFINE(int, ip4_ipsec_ecn) = 0; -VNET_DEFINE(int, ip4_esp_randpad) = -1; static VNET_DEFINE(int, ip4_filtertunnel) = 0; #define V_ip4_filtertunnel VNET(ip4_filtertunnel) @@ -194,9 +192,6 @@ SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_AH_NETLEV, ah SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_CLEARTOS, ah_cleartos, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ah_cleartos), 0, "If set, clear type-of-service field when doing AH computation."); -SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_OFFSETMASK, ah_offsetmask, - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ah_offsetmask), 0, - "If not set, clear offset field mask when doing AH computation."); SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DFBIT, dfbit, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ipsec_dfbit), 0, "Do not fragment bit on encap."); Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Mon Feb 19 12:20:17 2018 (r329562) +++ head/sys/netipsec/ipsec.h Mon Feb 19 12:20:51 2018 (r329563) @@ -280,10 +280,8 @@ VNET_DECLARE(int, ip4_esp_trans_deflev); VNET_DECLARE(int, ip4_esp_net_deflev); VNET_DECLARE(int, ip4_ah_trans_deflev); VNET_DECLARE(int, ip4_ah_net_deflev); -VNET_DECLARE(int, ip4_ah_offsetmask); VNET_DECLARE(int, ip4_ipsec_dfbit); VNET_DECLARE(int, ip4_ipsec_ecn); -VNET_DECLARE(int, ip4_esp_randpad); VNET_DECLARE(int, crypto_support); VNET_DECLARE(int, async_crypto); VNET_DECLARE(int, natt_cksum_policy); @@ -294,10 +292,8 @@ VNET_DECLARE(int, natt_cksum_policy); #define V_ip4_esp_net_deflev VNET(ip4_esp_net_deflev) #define V_ip4_ah_trans_deflev VNET(ip4_ah_trans_deflev) #define V_ip4_ah_net_deflev VNET(ip4_ah_net_deflev) -#define V_ip4_ah_offsetmask VNET(ip4_ah_offsetmask) #define V_ip4_ipsec_dfbit VNET(ip4_ipsec_dfbit) #define V_ip4_ipsec_ecn VNET(ip4_ipsec_ecn) -#define V_ip4_esp_randpad VNET(ip4_esp_randpad) #define V_crypto_support VNET(crypto_support) #define V_async_crypto VNET(async_crypto) #define V_natt_cksum_policy VNET(natt_cksum_policy) From owner-svn-src-all@freebsd.org Mon Feb 19 12:21:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CAF2F216DC; Mon, 19 Feb 2018 12:21:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C23AD71E36; Mon, 19 Feb 2018 12:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0DE1A6E4; Mon, 19 Feb 2018 12:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JCLuOt055030; Mon, 19 Feb 2018 12:21:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JCLuvs055029; Mon, 19 Feb 2018 12:21:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802191221.w1JCLuvs055029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Feb 2018 12:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r329565 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 329565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 12:21:57 -0000 Author: hselasky Date: Mon Feb 19 12:21:56 2018 New Revision: 329565 URL: https://svnweb.freebsd.org/changeset/base/329565 Log: Remove myself. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Feb 19 12:21:24 2018 (r329564) +++ svnadmin/conf/sizelimit.conf Mon Feb 19 12:21:56 2018 (r329565) @@ -19,7 +19,6 @@ bapt brooks davidcs dim -hselasky imp jb jeff From owner-svn-src-all@freebsd.org Mon Feb 19 14:21:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D90A1F034A8; Mon, 19 Feb 2018 14:21:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8781B777BC; Mon, 19 Feb 2018 14:21:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6845D1BA51; Mon, 19 Feb 2018 14:21:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JELvDJ026294; Mon, 19 Feb 2018 14:21:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JELv5A026289; Mon, 19 Feb 2018 14:21:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191421.w1JELv5A026289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 14:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329576 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 14:21:58 -0000 Author: kevans Date: Mon Feb 19 14:21:56 2018 New Revision: 329576 URL: https://svnweb.freebsd.org/changeset/base/329576 Log: stand/lua: Defer kernel/module loading until boot or menu escape Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment is even more painful. Defer loading until we either boot, auto-boot, or escape to loader prompt. We still need to deal with configuration changes as the boot environment changes, but this is generally much quicker. This commit strips all ELF loading out of config.load/config.reload so that these are purely for configuration. config.loadelf has been created to deal with kernel/module loads. Unloading logic has been ripped out, as we won't need to deal with it in the menu anymore. Discussed in part with: allanjude Modified: head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 12:52:17 2018 (r329575) +++ head/stand/lua/config.lua Mon Feb 19 14:21:56 2018 (r329576) @@ -345,6 +345,9 @@ function config.loadkernel(other_kernel) end end +function config.selectkernel(kernel) + config.kernel_selected = kernel; +end function config.load(file) if (not file) then @@ -367,40 +370,38 @@ function config.load(file) -- Cache the provided module_path at load time for later use config.module_path = loader.getenv("module_path"); +end - print("Loading kernel..."); - config.loadkernel(config.kernel_loaded); - - print("Loading configured modules..."); - if (not config.loadmod(modules)) then - print("Could not load one or more modules!"); - end +-- Reload configuration +function config.reload(file) + -- XXX TODO: We should be doing something more here to clear out env + -- changes that rode in with the last configuration load + modules = {}; + config.load(file); end -function config.reload(kernel) - local kernel_loaded = false; +function config.loadelf() + local kernel = config.kernel_loaded or config.kernel_selected; + local loaded = false; - -- unload all modules - print("Unloading modules..."); - loader.perform("unload"); + print("Loading kernel..."); + loaded = config.loadkernel(kernel); - if (kernel ~= nil) then - print("Trying to load '" .. kernel .. "'") - kernel_loaded = config.loadkernel(kernel); - if (kernel_loaded) then - print("Kernel '" .. kernel .. "' loaded!"); - end + if (not loaded) then + loaded = config.loadkernel(); end - -- failed to load kernel or it is nil - -- then load default - if (not kernel_loaded) then - print("Loading default kernel..."); - config.loadkernel(); + if (not loaded) then + -- Ultimately failed to load kernel + print("Failed to load any kernel"); + return; end - -- load modules - config.loadmod(modules); + print("Loading configured modules..."); + if (not config.loadmod(modules)) then + print("Could not load one or more modules!"); + end end + return config Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Mon Feb 19 12:52:17 2018 (r329575) +++ head/stand/lua/core.lua Mon Feb 19 14:21:56 2018 (r329576) @@ -26,6 +26,8 @@ -- $FreeBSD$ -- +local config = require('config'); + local core = {}; -- Commonly appearing constants @@ -180,10 +182,12 @@ function core.setDefaults() end function core.autoboot() + config.loadelf(); loader.perform("autoboot"); end function core.boot() + config.loadelf(); loader.perform("boot"); end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 12:52:17 2018 (r329575) +++ head/stand/lua/menu.lua Mon Feb 19 14:21:56 2018 (r329576) @@ -220,9 +220,7 @@ menu.welcome = { " of " .. #all_choices .. ")"; end, func = function(idx, choice, all_choices) - if (#all_choices > 1) then - config.reload(choice); - end + config.selectkernel(choice); end, alias = {"k", "K"} }, @@ -332,6 +330,7 @@ function menu.run(m) if (m == menu.welcome) then screen.defcursor(); print("Exiting menu!"); + config.loadelf(); return false; end From owner-svn-src-all@freebsd.org Mon Feb 19 15:42:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D3E8F0976F; Mon, 19 Feb 2018 15:42:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1326B7ADD6; Mon, 19 Feb 2018 15:42:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E2331C82C; Mon, 19 Feb 2018 15:42:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFgKYh072156; Mon, 19 Feb 2018 15:42:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFgKOF072152; Mon, 19 Feb 2018 15:42:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191542.w1JFgKOF072152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 15:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329577 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:42:21 -0000 Author: kevans Date: Mon Feb 19 15:42:20 2018 New Revision: 329577 URL: https://svnweb.freebsd.org/changeset/base/329577 Log: stand/lua: Rename bootserial for clarity Modified: head/stand/lua/color.lua head/stand/lua/core.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Feb 19 14:21:56 2018 (r329576) +++ head/stand/lua/color.lua Mon Feb 19 15:42:20 2018 (r329577) @@ -50,7 +50,7 @@ function color.isEnabled() return false; end end - return (not core.bootserial()); + return (not core.isSerialBoot()); end color.disabled = (not color.isEnabled()); Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Mon Feb 19 14:21:56 2018 (r329576) +++ head/stand/lua/core.lua Mon Feb 19 15:42:20 2018 (r329577) @@ -191,7 +191,7 @@ function core.boot() loader.perform("boot"); end -function core.bootserial() +function core.isSerialBoot() local c = loader.getenv("console"); if (c ~= nil) then Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 14:21:56 2018 (r329576) +++ head/stand/lua/menu.lua Mon Feb 19 15:42:20 2018 (r329577) @@ -338,7 +338,7 @@ function menu.run(m) end function menu.skip() - if (core.bootserial() )then + if (core.isSerialBoot())then return true; end local c = string.lower(loader.getenv("console") or ""); Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Mon Feb 19 14:21:56 2018 (r329576) +++ head/stand/lua/screen.lua Mon Feb 19 15:42:20 2018 (r329577) @@ -43,14 +43,14 @@ function intstring(num) end function screen.clear() - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end loader.printc("\027[H\027[J"); end function screen.setcursor(x, y) - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end @@ -76,7 +76,7 @@ function screen.defcolor() end function screen.defcursor() - if (core.bootserial()) then + if (core.isSerialBoot()) then return; end loader.printc("\027[25;0H"); From owner-svn-src-all@freebsd.org Mon Feb 19 15:47:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DA0EF09E46; Mon, 19 Feb 2018 15:47:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7CBB7B24C; Mon, 19 Feb 2018 15:47:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2A551C848; Mon, 19 Feb 2018 15:47:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFl98v073772; Mon, 19 Feb 2018 15:47:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFl9qu073771; Mon, 19 Feb 2018 15:47:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191547.w1JFl9qu073771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 15:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329578 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:47:11 -0000 Author: kevans Date: Mon Feb 19 15:47:09 2018 New Revision: 329578 URL: https://svnweb.freebsd.org/changeset/base/329578 Log: stand/lua: Menu style.lua(9) nits Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 15:42:20 2018 (r329577) +++ head/stand/lua/menu.lua Mon Feb 19 15:47:09 2018 (r329578) @@ -52,7 +52,8 @@ menu.boot_options = { { entry_type = core.MENU_RETURN, name = function() - return "Back to main menu"..color.highlight(" [Backspace]"); + return "Back to main menu" .. + color.highlight(" [Backspace]"); end }, @@ -60,7 +61,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return "Load System "..color.highlight("D").."efaults"; + return "Load System " .. color.highlight("D") .. + "efaults"; end, func = function() core.setDefaults(); @@ -86,7 +88,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("A").."CPI :", core.acpi); + return OnOff(color.highlight("A") .. "CPI :", + core.acpi); end, func = function() core.setACPI(); @@ -97,7 +100,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff("Safe "..color.highlight("M").."ode :", core.sm); + return OnOff("Safe " .. color.highlight("M") .. + "ode :", core.sm); end, func = function() core.setSafeMode(); @@ -108,7 +112,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("S").."ingle user:", core.su); + return OnOff(color.highlight("S") .. "ingle user:", + core.su); end, func = function() core.setSingleUser(); @@ -119,7 +124,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("V").."erbose :", core.verbose); + return OnOff(color.highlight("V") .. "erbose :", + core.verbose); end, func = function() core.setVerbose(); @@ -133,7 +139,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("B").."oot Multi user "..color.highlight("[Enter]"); + return color.highlight("B") .. "oot Multi user " .. + color.highlight("[Enter]"); end, func = function() core.setSingleUser(false); @@ -146,7 +153,7 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return "Boot "..color.highlight("S").."ingle user"; + return "Boot " .. color.highlight("S") .. "ingle user"; end, func = function() core.setSingleUser(true); @@ -159,7 +166,7 @@ menu.welcome = { { entry_type = core.MENU_RETURN, name = function() - return color.highlight("Esc").."ape to loader prompt"; + return color.highlight("Esc") .. "ape to loader prompt"; end, func = function() loader.setenv("autoboot_delay", "NO"); @@ -171,7 +178,7 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("R").."eboot"; + return color.highlight("R") .. "eboot"; end, func = function() loader.perform("reboot"); @@ -229,7 +236,7 @@ menu.welcome = { { entry_type = core.MENU_SUBMENU, name = function() - return "Boot "..color.highlight("O").."ptions"; + return "Boot " .. color.highlight("O") .. "ptions"; end, submenu = function() return menu.boot_options; @@ -338,7 +345,7 @@ function menu.run(m) end function menu.skip() - if (core.isSerialBoot())then + if (core.isSerialBoot()) then return true; end local c = string.lower(loader.getenv("console") or ""); @@ -374,8 +381,9 @@ function menu.autoboot() repeat time = endtime - loader.time(); screen.setcursor(x, y); - print("Autoboot in "..time.." seconds, hit [Enter] to boot" - .." or any other key to stop "); + print("Autoboot in " .. time .. + " seconds, hit [Enter] to boot" .. + " or any other key to stop "); screen.defcursor(); if (io.ischar()) then local ch = io.getchar(); @@ -385,7 +393,7 @@ function menu.autoboot() -- erase autoboot msg screen.setcursor(0, y); print(" " - .." "); + .. " "); screen.defcursor(); return; end @@ -399,9 +407,11 @@ end function OnOff(str, b) if (b) then - return str .. color.escapef(color.GREEN).."On"..color.escapef(color.WHITE); + return str .. color.escapef(color.GREEN) .. "On" .. + color.escapef(color.WHITE); else - return str .. color.escapef(color.RED).."off"..color.escapef(color.WHITE); + return str .. color.escapef(color.RED) .. "off" .. + color.escapef(color.WHITE); end end From owner-svn-src-all@freebsd.org Mon Feb 19 15:49:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42260F0A122; Mon, 19 Feb 2018 15:49:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E76E97B42E; Mon, 19 Feb 2018 15:49:14 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDD7B1C849; Mon, 19 Feb 2018 15:49:14 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFnEGp074008; Mon, 19 Feb 2018 15:49:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFnEFo074006; Mon, 19 Feb 2018 15:49:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802191549.w1JFnEFo074006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 19 Feb 2018 15:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329579 - in head/sys: dev/ofw powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: in head/sys: dev/ofw powerpc/ofw X-SVN-Commit-Revision: 329579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:49:15 -0000 Author: nwhitehorn Date: Mon Feb 19 15:49:14 2018 New Revision: 329579 URL: https://svnweb.freebsd.org/changeset/base/329579 Log: Set internal error returns for OF_peer(), OF_child(), and OF_parent() to zero, matching the IEEE 1275 standard. Since these internal error paths have never, to my knowledge, been taken, behavior is unchanged. Reported by: gonzo MFC after: 2 weeks Modified: head/sys/dev/ofw/ofw_standard.c head/sys/powerpc/ofw/ofw_real.c Modified: head/sys/dev/ofw/ofw_standard.c ============================================================================== --- head/sys/dev/ofw/ofw_standard.c Mon Feb 19 15:47:09 2018 (r329578) +++ head/sys/dev/ofw/ofw_standard.c Mon Feb 19 15:49:14 2018 (r329579) @@ -232,7 +232,7 @@ ofw_std_peer(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware(&args) == -1) - return (-1); + return (0); return (args.next); } @@ -254,7 +254,7 @@ ofw_std_child(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware(&args) == -1) - return (-1); + return (0); return (args.child); } @@ -276,7 +276,7 @@ ofw_std_parent(ofw_t ofw, phandle_t node) args.node = node; if (openfirmware(&args) == -1) - return (-1); + return (0); return (args.parent); } Modified: head/sys/powerpc/ofw/ofw_real.c ============================================================================== --- head/sys/powerpc/ofw/ofw_real.c Mon Feb 19 15:47:09 2018 (r329578) +++ head/sys/powerpc/ofw/ofw_real.c Mon Feb 19 15:49:14 2018 (r329579) @@ -366,7 +366,7 @@ ofw_real_peer(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(&args, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, &args, sizeof(args)); ofw_real_stop(); @@ -395,7 +395,7 @@ ofw_real_child(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(&args, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, &args, sizeof(args)); ofw_real_stop(); @@ -424,7 +424,7 @@ ofw_real_parent(ofw_t ofw, phandle_t node) argsptr = ofw_real_map(&args, sizeof(args)); if (openfirmware((void *)argsptr) == -1) { ofw_real_stop(); - return (-1); + return (0); } ofw_real_unmap(argsptr, &args, sizeof(args)); ofw_real_stop(); From owner-svn-src-all@freebsd.org Mon Feb 19 15:49:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E174FF0A179; Mon, 19 Feb 2018 15:49:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9515B7B52A; Mon, 19 Feb 2018 15:49:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 901D61C84A; Mon, 19 Feb 2018 15:49:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFnRnt074071; Mon, 19 Feb 2018 15:49:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFnRt4074070; Mon, 19 Feb 2018 15:49:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191549.w1JFnRt4074070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 15:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329580 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:49:28 -0000 Author: kevans Date: Mon Feb 19 15:49:27 2018 New Revision: 329580 URL: https://svnweb.freebsd.org/changeset/base/329580 Log: stand/lua: Remove some unused local declarations Menus are actually defined as entries in the 'menu' table. These local declarations have not been used in the history of our in-tree lua scripts, so give them the boot. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 15:49:14 2018 (r329579) +++ head/stand/lua/menu.lua Mon Feb 19 15:49:27 2018 (r329580) @@ -41,11 +41,7 @@ local run; local autoboot; local carousel_choices = {}; ---loader menu tree: ---rooted at menu.welcome ---submenu declarations: -local boot_options; -local welcome; +-- loader menu tree is rooted at menu.welcome menu.boot_options = { -- return to welcome menu From owner-svn-src-all@freebsd.org Mon Feb 19 15:54:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53522F0AAF0; Mon, 19 Feb 2018 15:54:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 046D07BCA9; Mon, 19 Feb 2018 15:54:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF4C41C9F2; Mon, 19 Feb 2018 15:54:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFsQu7079256; Mon, 19 Feb 2018 15:54:26 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFsQGl079255; Mon, 19 Feb 2018 15:54:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201802191554.w1JFsQGl079255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 19 Feb 2018 15:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329581 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:54:27 -0000 Author: vangyzen Date: Mon Feb 19 15:54:26 2018 New Revision: 329581 URL: https://svnweb.freebsd.org/changeset/base/329581 Log: MFC r329053 Fix ICMPv6 redirects icmp6_redirect_input() validates that a redirect packet came from the current gateway for the respective destination. To do this, it compares the source address, which has an embedded scope zone id, to the next-hop address, which does not. If the address is link-local, which should be the case, the comparison fails and the redirect is ignored. Insert the scope zone id into the next-hop address so the comparison is accurate. Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases. Submitted by: Farrell Woods (initial revision) Reviewed by: ae melifaro dab Relnotes: yes Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14254 Modified: stable/11/sys/netinet6/icmp6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/icmp6.c ============================================================================== --- stable/11/sys/netinet6/icmp6.c Mon Feb 19 15:49:27 2018 (r329580) +++ stable/11/sys/netinet6/icmp6.c Mon Feb 19 15:54:26 2018 (r329581) @@ -2302,6 +2302,14 @@ icmp6_redirect_input(struct mbuf *m, int off) goto bad; } + /* + * Embed scope zone id into next hop address, since + * fib6_lookup_nh_basic() returns address without embedded + * scope zone id. + */ + if (in6_setscope(&nh6.nh_addr, m->m_pkthdr.rcvif, NULL)) + goto freeit; + if (IN6_ARE_ADDR_EQUAL(&src6, &nh6.nh_addr) == 0) { nd6log((LOG_ERR, "ICMP6 redirect rejected; " From owner-svn-src-all@freebsd.org Mon Feb 19 15:56:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D365F0AE44; Mon, 19 Feb 2018 15:56:34 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F29CA7BF1C; Mon, 19 Feb 2018 15:56:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8E3B1C9F3; Mon, 19 Feb 2018 15:56:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JFuXef079604; Mon, 19 Feb 2018 15:56:33 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JFuX3V079603; Mon, 19 Feb 2018 15:56:33 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201802191556.w1JFuX3V079603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 19 Feb 2018 15:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329582 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 15:56:34 -0000 Author: vangyzen Date: Mon Feb 19 15:56:33 2018 New Revision: 329582 URL: https://svnweb.freebsd.org/changeset/base/329582 Log: MFC r329181 Update the MTU in affected routes when IPv6 RA changes the MTU ip6_calcmtu() only looks at the interface MTU if neither the TCP hostcache nor the route provides an MTU. Update the routes so they do not provide stale MTUs. This fixes UNH IPv6 conformance test cases v6LC_4_1_08 and v6LC_4_1_09, which use a RA to reduce the link MTU from 1500 to 1280. Reported and tested by: Farrell Woods Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14257 Modified: stable/11/sys/netinet6/nd6_rtr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/11/sys/netinet6/nd6_rtr.c Mon Feb 19 15:54:26 2018 (r329581) +++ stable/11/sys/netinet6/nd6_rtr.c Mon Feb 19 15:56:33 2018 (r329582) @@ -406,8 +406,11 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) int change = (ndi->linkmtu != mtu); ndi->linkmtu = mtu; - if (change) /* in6_maxmtu may change */ + if (change) { + /* in6_maxmtu may change */ in6_setmaxmtu(); + rt_updatemtu(ifp); + } } else { nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " "mtu=%lu sent from %s; " From owner-svn-src-all@freebsd.org Mon Feb 19 16:25:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5D45F0D641; Mon, 19 Feb 2018 16:25:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E3767D533; Mon, 19 Feb 2018 16:25:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44D701CEC8; Mon, 19 Feb 2018 16:25:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGPiQg097218; Mon, 19 Feb 2018 16:25:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGPhnS097216; Mon, 19 Feb 2018 16:25:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191625.w1JGPhnS097216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:25:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329583 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:25:44 -0000 Author: kevans Date: Mon Feb 19 16:25:43 2018 New Revision: 329583 URL: https://svnweb.freebsd.org/changeset/base/329583 Log: stand/lua: Store menu entries in an "entries" table Instead of directly listing them in menu.welcome and menu.boot_options, store them at menu.welcome.entries and welcome.boot_options.entries. This will come into play later when we need to re-order the welcome menu if boot_single is specified. Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 15:56:33 2018 (r329582) +++ head/stand/lua/drawer.lua Mon Feb 19 16:25:43 2018 (r329583) @@ -166,7 +166,9 @@ function drawer.drawmenu(m) -- print the menu and build the alias table local alias_table = {}; local entry_num = 0; - for line_num, e in ipairs(m) do + local menu_entries = m.entries; + + for line_num, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. if (e.visible ~= nil) and (not e.visible()) then Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 15:56:33 2018 (r329582) +++ head/stand/lua/menu.lua Mon Feb 19 16:25:43 2018 (r329583) @@ -44,202 +44,205 @@ local carousel_choices = {}; -- loader menu tree is rooted at menu.welcome menu.boot_options = { - -- return to welcome menu - { - entry_type = core.MENU_RETURN, - name = function() - return "Back to main menu" .. - color.highlight(" [Backspace]"); - end - }, + entries = { + -- return to welcome menu + { + entry_type = core.MENU_RETURN, + name = function() + return "Back to main menu" .. + color.highlight(" [Backspace]"); + end + }, - -- load defaults - { - entry_type = core.MENU_ENTRY, - name = function() - return "Load System " .. color.highlight("D") .. - "efaults"; - end, - func = function() - core.setDefaults(); - end, - alias = {"d", "D"} - }, + -- load defaults + { + entry_type = core.MENU_ENTRY, + name = function() + return "Load System " .. color.highlight("D") .. + "efaults"; + end, + func = function() + core.setDefaults(); + end, + alias = {"d", "D"} + }, - { - entry_type = core.MENU_SEPARATOR, - name = function() - return ""; - end - }, + { + entry_type = core.MENU_SEPARATOR, + name = function() + return ""; + end + }, - { - entry_type = core.MENU_SEPARATOR, - name = function() - return "Boot Options:"; - end - }, + { + entry_type = core.MENU_SEPARATOR, + name = function() + return "Boot Options:"; + end + }, - -- acpi - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("A") .. "CPI :", - core.acpi); - end, - func = function() - core.setACPI(); - end, - alias = {"a", "A"} + -- acpi + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff(color.highlight("A") .. "CPI :", + core.acpi); + end, + func = function() + core.setACPI(); + end, + alias = {"a", "A"} + }, + -- safe mode + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff("Safe " .. color.highlight("M") .. + "ode :", core.sm); + end, + func = function() + core.setSafeMode(); + end, + alias = {"m", "M"} + }, + -- single user + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff(color.highlight("S") .. "ingle user:", + core.su); + end, + func = function() + core.setSingleUser(); + end, + alias = {"s", "S"} + }, + -- verbose boot + { + entry_type = core.MENU_ENTRY, + name = function() + return OnOff(color.highlight("V") .. "erbose :", + core.verbose); + end, + func = function() + core.setVerbose(); + end, + alias = {"v", "V"} + }, }, - -- safe mode - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff("Safe " .. color.highlight("M") .. - "ode :", core.sm); - end, - func = function() - core.setSafeMode(); - end, - alias = {"m", "M"} - }, - -- single user - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("S") .. "ingle user:", - core.su); - end, - func = function() - core.setSingleUser(); - end, - alias = {"s", "S"} - }, - -- verbose boot - { - entry_type = core.MENU_ENTRY, - name = function() - return OnOff(color.highlight("V") .. "erbose :", - core.verbose); - end, - func = function() - core.setVerbose(); - end, - alias = {"v", "V"} - }, }; menu.welcome = { - -- boot multi user - { - entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("B") .. "oot Multi user " .. - color.highlight("[Enter]"); - end, - func = function() - core.setSingleUser(false); - core.boot(); - end, - alias = {"b", "B"} - }, + entries = { + -- boot multi user + { + entry_type = core.MENU_ENTRY, + name = function() + return color.highlight("B") .. "oot Multi user " .. + color.highlight("[Enter]"); + end, + func = function() + core.setSingleUser(false); + core.boot(); + end, + alias = {"b", "B"} + }, - -- boot single user - { - entry_type = core.MENU_ENTRY, - name = function() - return "Boot " .. color.highlight("S") .. "ingle user"; - end, - func = function() - core.setSingleUser(true); - core.boot(); - end, - alias = {"s", "S"} - }, + -- boot single user + { + entry_type = core.MENU_ENTRY, + name = function() + return "Boot " .. color.highlight("S") .. "ingle user"; + end, + func = function() + core.setSingleUser(true); + core.boot(); + end, + alias = {"s", "S"} + }, - -- escape to interpreter - { - entry_type = core.MENU_RETURN, - name = function() - return color.highlight("Esc") .. "ape to loader prompt"; - end, - func = function() - loader.setenv("autoboot_delay", "NO"); - end, - alias = {core.KEYSTR_ESCAPE} - }, + -- escape to interpreter + { + entry_type = core.MENU_RETURN, + name = function() + return color.highlight("Esc") .. "ape to loader prompt"; + end, + func = function() + loader.setenv("autoboot_delay", "NO"); + end, + alias = {core.KEYSTR_ESCAPE} + }, - -- reboot - { - entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("R") .. "eboot"; - end, - func = function() - loader.perform("reboot"); - end, - alias = {"r", "R"} - }, + -- reboot + { + entry_type = core.MENU_ENTRY, + name = function() + return color.highlight("R") .. "eboot"; + end, + func = function() + loader.perform("reboot"); + end, + alias = {"r", "R"} + }, - { - entry_type = core.MENU_SEPARATOR, - name = function() - return ""; - end - }, - - { - entry_type = core.MENU_SEPARATOR, - name = function() - return "Options:"; - end - }, - - -- kernel options - { - entry_type = core.MENU_CAROUSEL_ENTRY, - carousel_id = "kernel", - items = core.kernelList, - name = function(idx, choice, all_choices) - if (#all_choices == 0) then - return "Kernel: "; + { + entry_type = core.MENU_SEPARATOR, + name = function() + return ""; end + }, - local is_default = (idx == 1); - local kernel_name = ""; - local name_color; - if (is_default) then - name_color = color.escapef(color.GREEN); - kernel_name = "default/"; - else - name_color = color.escapef(color.BLUE); + { + entry_type = core.MENU_SEPARATOR, + name = function() + return "Options:"; end - kernel_name = kernel_name .. name_color .. choice .. - color.default(); - return color.highlight("K").."ernel: " .. kernel_name .. - " (" .. idx .. - " of " .. #all_choices .. ")"; - end, - func = function(idx, choice, all_choices) - config.selectkernel(choice); - end, - alias = {"k", "K"} - }, + }, - -- boot options - { - entry_type = core.MENU_SUBMENU, - name = function() - return "Boot " .. color.highlight("O") .. "ptions"; - end, - submenu = function() - return menu.boot_options; - end, - alias = {"o", "O"} - } + -- kernel options + { + entry_type = core.MENU_CAROUSEL_ENTRY, + carousel_id = "kernel", + items = core.kernelList, + name = function(idx, choice, all_choices) + if (#all_choices == 0) then + return "Kernel: "; + end + local is_default = (idx == 1); + local kernel_name = ""; + local name_color; + if (is_default) then + name_color = color.escapef(color.GREEN); + kernel_name = "default/"; + else + name_color = color.escapef(color.BLUE); + end + kernel_name = kernel_name .. name_color .. choice .. + color.default(); + return color.highlight("K").."ernel: " .. kernel_name .. + " (" .. idx .. + " of " .. #all_choices .. ")"; + end, + func = function(idx, choice, all_choices) + config.selectkernel(choice); + end, + alias = {"k", "K"} + }, + + -- boot options + { + entry_type = core.MENU_SUBMENU, + name = function() + return "Boot " .. color.highlight("O") .. "ptions"; + end, + submenu = function() + return menu.boot_options; + end, + alias = {"o", "O"} + }, + }, }; -- The first item in every carousel is always the default item. From owner-svn-src-all@freebsd.org Mon Feb 19 16:31:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56A41F0DDCB; Mon, 19 Feb 2018 16:31:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BC937D9A9; Mon, 19 Feb 2018 16:31:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06B4A1D04A; Mon, 19 Feb 2018 16:31:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGVJvO098177; Mon, 19 Feb 2018 16:31:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGVJQA098176; Mon, 19 Feb 2018 16:31:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802191631.w1JGVJQA098176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Feb 2018 16:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329584 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:31:20 -0000 Author: hselasky Date: Mon Feb 19 16:31:19 2018 New Revision: 329584 URL: https://svnweb.freebsd.org/changeset/base/329584 Log: Implement list_safe_reset_next() function macro in the LinuxKPI. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Mon Feb 19 16:25:43 2018 (r329583) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Mon Feb 19 16:31:19 2018 (r329584) @@ -179,6 +179,9 @@ list_del_init(struct list_head *entry) #define list_next_entry(ptr, member) \ list_entry(((ptr)->member.next), typeof(*(ptr)), member) +#define list_safe_reset_next(ptr, n, member) \ + (n) = list_next_entry(ptr, member) + #define list_prev_entry(ptr, member) \ list_entry(((ptr)->member.prev), typeof(*(ptr)), member) From owner-svn-src-all@freebsd.org Mon Feb 19 16:34:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D791F0E1F7; Mon, 19 Feb 2018 16:34:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 124AE7DDE5; Mon, 19 Feb 2018 16:34:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 096491D0AD; Mon, 19 Feb 2018 16:34:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGYNiv003192; Mon, 19 Feb 2018 16:34:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGYNAE003191; Mon, 19 Feb 2018 16:34:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191634.w1JGYNAE003191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329585 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:34:24 -0000 Author: kevans Date: Mon Feb 19 16:34:23 2018 New Revision: 329585 URL: https://svnweb.freebsd.org/changeset/base/329585 Log: stand/lua: Add core.isSingleUserBoot Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Mon Feb 19 16:31:19 2018 (r329584) +++ head/stand/lua/core.lua Mon Feb 19 16:34:23 2018 (r329585) @@ -191,6 +191,11 @@ function core.boot() loader.perform("boot"); end +function core.isSingleUserBoot() + local single_user = loader.getenv("boot_single"); + return single_user ~= nil and single_user:lower() == "yes"; +end + function core.isSerialBoot() local c = loader.getenv("console"); From owner-svn-src-all@freebsd.org Mon Feb 19 16:35:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3DDDF0E3C9; Mon, 19 Feb 2018 16:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55DEA7E05F; Mon, 19 Feb 2018 16:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50D7F1D0B9; Mon, 19 Feb 2018 16:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGZkai003548; Mon, 19 Feb 2018 16:35:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGZkbY003547; Mon, 19 Feb 2018 16:35:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191635.w1JGZkbY003547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329586 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:35:46 -0000 Author: kevans Date: Mon Feb 19 16:35:46 2018 New Revision: 329586 URL: https://svnweb.freebsd.org/changeset/base/329586 Log: stand/lua: Call menu_entries if it's a function If we've fetched menu.entries and it turns out it's a function, call it to get the actual menu entries. This will be used to swap multi-/single- user boot options if we're booting single user by default (boot_single="YES" in loader.conf(5)). It can also be used fairly easily for other non-standard situations. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 16:34:23 2018 (r329585) +++ head/stand/lua/drawer.lua Mon Feb 19 16:35:46 2018 (r329586) @@ -167,7 +167,9 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; local menu_entries = m.entries; - + if (type(menu_entries) == "function") then + menu_entries = menu_entries(); + end for line_num, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. From owner-svn-src-all@freebsd.org Mon Feb 19 16:36:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67A83F0E4ED; Mon, 19 Feb 2018 16:36:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D9857E1B5; Mon, 19 Feb 2018 16:36:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 187D81D0BA; Mon, 19 Feb 2018 16:36:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGaTPr003688; Mon, 19 Feb 2018 16:36:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGaTci003687; Mon, 19 Feb 2018 16:36:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191636.w1JGaTci003687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329587 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:36:30 -0000 Author: kevans Date: Mon Feb 19 16:36:29 2018 New Revision: 329587 URL: https://svnweb.freebsd.org/changeset/base/329587 Log: stand/lua: Swap single-/multi- user boot entries as needed Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 16:35:46 2018 (r329586) +++ head/stand/lua/menu.lua Mon Feb 19 16:36:29 2018 (r329587) @@ -133,7 +133,19 @@ menu.boot_options = { }; menu.welcome = { - entries = { + entries = function() + local menu_entries = menu.welcome.all_entries; + -- Swap the first two menu items on single user boot + if (core.isSingleUserBoot()) then + local multiuser = menu_entries[1]; + local singleuser = menu_entries[2]; + + menu_entries[2] = multiuser; + menu_entries[1] = singleuser; + end + return menu_entries; + end, + all_entries = { -- boot multi user { entry_type = core.MENU_ENTRY, From owner-svn-src-all@freebsd.org Mon Feb 19 16:42:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18BB4F0EC21; Mon, 19 Feb 2018 16:42:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF1B77E67C; Mon, 19 Feb 2018 16:42:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA28C1D223; Mon, 19 Feb 2018 16:42:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGg6ph008026; Mon, 19 Feb 2018 16:42:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGg6T4008025; Mon, 19 Feb 2018 16:42:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191642.w1JGg6T4008025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329588 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:42:07 -0000 Author: kevans Date: Mon Feb 19 16:42:06 2018 New Revision: 329588 URL: https://svnweb.freebsd.org/changeset/base/329588 Log: stand/lua: Re-wrap menu.lua now that I've added indentation... Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 16:36:29 2018 (r329587) +++ head/stand/lua/menu.lua Mon Feb 19 16:42:06 2018 (r329588) @@ -85,8 +85,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("A") .. "CPI :", - core.acpi); + return OnOff(color.highlight("A") .. + "CPI :", core.acpi); end, func = function() core.setACPI(); @@ -109,8 +109,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("S") .. "ingle user:", - core.su); + return OnOff(color.highlight("S") .. + "ingle user:", core.su); end, func = function() core.setSingleUser(); @@ -121,8 +121,8 @@ menu.boot_options = { { entry_type = core.MENU_ENTRY, name = function() - return OnOff(color.highlight("V") .. "erbose :", - core.verbose); + return OnOff(color.highlight("V") .. + "erbose :", core.verbose); end, func = function() core.setVerbose(); @@ -150,7 +150,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return color.highlight("B") .. "oot Multi user " .. + return color.highlight("B") .. + "oot Multi user " .. color.highlight("[Enter]"); end, func = function() @@ -164,7 +165,8 @@ menu.welcome = { { entry_type = core.MENU_ENTRY, name = function() - return "Boot " .. color.highlight("S") .. "ingle user"; + return "Boot " .. color.highlight("S") .. + "ingle user"; end, func = function() core.setSingleUser(true); @@ -177,7 +179,8 @@ menu.welcome = { { entry_type = core.MENU_RETURN, name = function() - return color.highlight("Esc") .. "ape to loader prompt"; + return color.highlight("Esc") .. + "ape to loader prompt"; end, func = function() loader.setenv("autoboot_delay", "NO"); @@ -231,11 +234,11 @@ menu.welcome = { else name_color = color.escapef(color.BLUE); end - kernel_name = kernel_name .. name_color .. choice .. - color.default(); - return color.highlight("K").."ernel: " .. kernel_name .. - " (" .. idx .. - " of " .. #all_choices .. ")"; + kernel_name = kernel_name .. name_color .. + choice .. color.default(); + return color.highlight("K").."ernel: " .. + kernel_name .. " (" .. idx .. " of " .. + #all_choices .. ")"; end, func = function(idx, choice, all_choices) config.selectkernel(choice); @@ -247,7 +250,8 @@ menu.welcome = { { entry_type = core.MENU_SUBMENU, name = function() - return "Boot " .. color.highlight("O") .. "ptions"; + return "Boot " .. color.highlight("O") .. + "ptions"; end, submenu = function() return menu.boot_options; From owner-svn-src-all@freebsd.org Mon Feb 19 16:59:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42408F0FF64; Mon, 19 Feb 2018 16:59:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4E157F0AE; Mon, 19 Feb 2018 16:59:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB7F41D3DA; Mon, 19 Feb 2018 16:59:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JGxSKW016140; Mon, 19 Feb 2018 16:59:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JGxSVg016139; Mon, 19 Feb 2018 16:59:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191659.w1JGxSVg016139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 16:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329589 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 16:59:29 -0000 Author: kevans Date: Mon Feb 19 16:59:28 2018 New Revision: 329589 URL: https://svnweb.freebsd.org/changeset/base/329589 Log: stand/lua: Track env changes that come in via loader.conf(5) This will be used when boot environment support lands to make a good-faith effort to apply any new loader.conf(5) environment settings atop the default configuration that we started with. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 16:42:06 2018 (r329588) +++ head/stand/lua/config.lua Mon Feb 19 16:59:28 2018 (r329589) @@ -27,9 +27,23 @@ -- local config = {}; +-- Which variables we changed +config.env_changed = {}; +-- Values to restore env to (nil to unset) +config.env_restore = {}; local modules = {}; +function config.setenv(k, v) + -- Do we need to track this change? + if (config.env_changed[k] == nil) then + config.env_changed[k] = true; + config.env_restore[k] = loader.getenv(k); + end + + return loader.setenv(k, v); +end + function config.setKey(k, n, v) if (modules[k] == nil) then modules[k] = {}; @@ -115,7 +129,7 @@ local pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if (loader.setenv(k, v) ~= 0) then + if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. "' with value: " .. v .. ""); end @@ -125,7 +139,7 @@ local pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if (loader.setenv(k, v) ~= 0) then + if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. "' with value: " .. v .. ""); end From owner-svn-src-all@freebsd.org Mon Feb 19 17:01:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AC31F102BF; Mon, 19 Feb 2018 17:01:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E28247F357; Mon, 19 Feb 2018 17:01:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD5661D41D; Mon, 19 Feb 2018 17:01:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JH1LgG019394; Mon, 19 Feb 2018 17:01:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JH1LY9019393; Mon, 19 Feb 2018 17:01:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191701.w1JH1LY9019393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 17:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329590 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:01:22 -0000 Author: kevans Date: Mon Feb 19 17:01:21 2018 New Revision: 329590 URL: https://svnweb.freebsd.org/changeset/base/329590 Log: stand/lua: Restore environment upon config reload This restores environment to whatever defaults we had coming into lualoader. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 16:59:28 2018 (r329589) +++ head/stand/lua/config.lua Mon Feb 19 17:01:21 2018 (r329590) @@ -34,6 +34,20 @@ config.env_restore = {}; local modules = {}; +function config.restoreEnv() + for k, v in pairs(config.env_changed) do + local restore_value = config.env_restore[k]; + if (restore_value ~= nil) then + loader.setenv(k, restore_value); + else + loader.unsetenv(k); + end + end + + config.env_changed = {}; + config.env_restore = {}; +end + function config.setenv(k, v) -- Do we need to track this change? if (config.env_changed[k] == nil) then @@ -391,6 +405,7 @@ function config.reload(file) -- XXX TODO: We should be doing something more here to clear out env -- changes that rode in with the last configuration load modules = {}; + config.restoreEnv(); config.load(file); end From owner-svn-src-all@freebsd.org Mon Feb 19 17:03:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EB87F108EF; Mon, 19 Feb 2018 17:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2007D7F92B; Mon, 19 Feb 2018 17:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AFA91D583; Mon, 19 Feb 2018 17:03:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JH3odw021239; Mon, 19 Feb 2018 17:03:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JH3o9m021238; Mon, 19 Feb 2018 17:03:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802191703.w1JH3o9m021238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Feb 2018 17:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329591 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:03:51 -0000 Author: markj Date: Mon Feb 19 17:03:50 2018 New Revision: 329591 URL: https://svnweb.freebsd.org/changeset/base/329591 Log: MFC r329374: Use the conventional name for an array of pages. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Mon Feb 19 17:01:21 2018 (r329590) +++ stable/11/sys/vm/swap_pager.c Mon Feb 19 17:03:50 2018 (r329591) @@ -1083,16 +1083,16 @@ swap_pager_unswapped(vm_page_t m) /* * swap_pager_getpages() - bring pages in from swap * - * Attempt to page in the pages in array "m" of length "count". The caller - * may optionally specify that additional pages preceding and succeeding - * the specified range be paged in. The number of such pages is returned - * in the "rbehind" and "rahead" parameters, and they will be in the - * inactive queue upon return. + * Attempt to page in the pages in array "ma" of length "count". The + * caller may optionally specify that additional pages preceding and + * succeeding the specified range be paged in. The number of such pages + * is returned in the "rbehind" and "rahead" parameters, and they will + * be in the inactive queue upon return. * - * The pages in "m" must be busied and will remain busied upon return. + * The pages in "ma" must be busied and will remain busied upon return. */ static int -swap_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind, +swap_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int *rbehind, int *rahead) { struct buf *bp; @@ -1107,7 +1107,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, bp = getpbuf(&nsw_rcount); VM_OBJECT_WLOCK(object); - if (!swap_pager_haspage(object, m[0]->pindex, &maxbehind, &maxahead)) { + if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead)) { relpbuf(bp, &nsw_rcount); return (VM_PAGER_FAIL); } @@ -1119,15 +1119,15 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, KASSERT(reqcount - 1 <= maxahead, ("page count %d extends beyond swap block", reqcount)); *rahead = imin(*rahead, maxahead - (reqcount - 1)); - pindex = m[reqcount - 1]->pindex; - msucc = TAILQ_NEXT(m[reqcount - 1], listq); + pindex = ma[reqcount - 1]->pindex; + msucc = TAILQ_NEXT(ma[reqcount - 1], listq); if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead) *rahead = msucc->pindex - pindex - 1; } if (rbehind != NULL) { *rbehind = imin(*rbehind, maxbehind); - pindex = m[0]->pindex; - mpred = TAILQ_PREV(m[0], pglist, listq); + pindex = ma[0]->pindex; + mpred = TAILQ_PREV(ma[0], pglist, listq); if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind) *rbehind = pindex - mpred->pindex - 1; } @@ -1138,7 +1138,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, shift = rbehind != NULL ? *rbehind : 0; if (shift != 0) { for (i = 1; i <= shift; i++) { - p = vm_page_alloc(object, m[0]->pindex - i, + p = vm_page_alloc(object, ma[0]->pindex - i, VM_ALLOC_NORMAL); if (p == NULL) { /* Shift allocated pages to the left. */ @@ -1153,11 +1153,11 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, *rbehind = shift; } for (i = 0; i < reqcount; i++) - bp->b_pages[i + shift] = m[i]; + bp->b_pages[i + shift] = ma[i]; if (rahead != NULL) { for (i = 0; i < *rahead; i++) { p = vm_page_alloc(object, - m[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); + ma[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); if (p == NULL) break; bp->b_pages[shift + reqcount + i] = p; @@ -1202,7 +1202,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * Instead, we look at the one page we are interested in which we * still hold a lock on even through the I/O completion. * - * The other pages in our m[] array are also released on completion, + * The other pages in our ma[] array are also released on completion, * so we cannot assume they are valid anymore either. * * NOTE: b_blkno is destroyed by the call to swapdev_strategy @@ -1216,8 +1216,8 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * is set in the metadata for each page in the request. */ VM_OBJECT_WLOCK(object); - while ((m[0]->oflags & VPO_SWAPINPROG) != 0) { - m[0]->oflags |= VPO_SWAPSLEEP; + while ((ma[0]->oflags & VPO_SWAPINPROG) != 0) { + ma[0]->oflags |= VPO_SWAPSLEEP; PCPU_INC(cnt.v_intrans); if (VM_OBJECT_SLEEP(object, &object->paging_in_progress, PSWP, "swread", hz * 20)) { @@ -1231,7 +1231,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * If we had an unrecoverable read error pages will not be valid. */ for (i = 0; i < reqcount; i++) - if (m[i]->valid != VM_PAGE_BITS_ALL) + if (ma[i]->valid != VM_PAGE_BITS_ALL) return (VM_PAGER_ERROR); return (VM_PAGER_OK); @@ -1251,12 +1251,12 @@ swap_pager_getpages(vm_object_t object, vm_page_t *m, * swap_pager_getpages(). */ static int -swap_pager_getpages_async(vm_object_t object, vm_page_t *m, int count, +swap_pager_getpages_async(vm_object_t object, vm_page_t *ma, int count, int *rbehind, int *rahead, pgo_getpages_iodone_t iodone, void *arg) { int r, error; - r = swap_pager_getpages(object, m, count, rbehind, rahead); + r = swap_pager_getpages(object, ma, count, rbehind, rahead); VM_OBJECT_WUNLOCK(object); switch (r) { case VM_PAGER_OK: @@ -1271,7 +1271,7 @@ swap_pager_getpages_async(vm_object_t object, vm_page_ default: panic("unhandled swap_pager_getpages() error %d", r); } - (iodone)(arg, m, count, error); + (iodone)(arg, ma, count, error); VM_OBJECT_WLOCK(object); return (r); @@ -1300,16 +1300,16 @@ swap_pager_getpages_async(vm_object_t object, vm_page_ * We need to unbusy the rest on I/O completion. */ static void -swap_pager_putpages(vm_object_t object, vm_page_t *m, int count, +swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count, int flags, int *rtvals) { int i, n; boolean_t sync; - if (count && m[0]->object != object) { + if (count && ma[0]->object != object) { panic("swap_pager_putpages: object mismatch %p/%p", object, - m[0]->object + ma[0]->object ); } @@ -1387,7 +1387,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *m, VM_OBJECT_WLOCK(object); for (j = 0; j < n; ++j) { - vm_page_t mreq = m[i+j]; + vm_page_t mreq = ma[i+j]; swp_pager_meta_build( mreq->object, From owner-svn-src-all@freebsd.org Mon Feb 19 17:09:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDA28F11280; Mon, 19 Feb 2018 17:09:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 667FB7FE1D; Mon, 19 Feb 2018 17:09:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CED91D586; Mon, 19 Feb 2018 17:09:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JH9Ucb021858; Mon, 19 Feb 2018 17:09:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JH9UIq021857; Mon, 19 Feb 2018 17:09:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191709.w1JH9UIq021857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 17:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329592 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:09:31 -0000 Author: kevans Date: Mon Feb 19 17:09:29 2018 New Revision: 329592 URL: https://svnweb.freebsd.org/changeset/base/329592 Log: stand/lua: Remove inaccurate comment after r329590 lualoader does a pretty good job of reverting any environment changes now. It will even wipe out boot_verbose if it's set explicitly in loader.conf(5) and overwritten in the boot options menu. Future work will likely change this, as explicit choices made in the menu should probably override the new loader.conf(5). I don't suspect this will cause much grief, though, so it is not a high priority until boot environment support actually lands. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 17:03:50 2018 (r329591) +++ head/stand/lua/config.lua Mon Feb 19 17:09:29 2018 (r329592) @@ -402,8 +402,6 @@ end -- Reload configuration function config.reload(file) - -- XXX TODO: We should be doing something more here to clear out env - -- changes that rode in with the last configuration load modules = {}; config.restoreEnv(); config.load(file); From owner-svn-src-all@freebsd.org Mon Feb 19 17:22:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE574F124CE for ; Mon, 19 Feb 2018 17:22:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C82E809A2 for ; Mon, 19 Feb 2018 17:22:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id p188so12000356ioe.12 for ; Mon, 19 Feb 2018 09:22:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=gP8ASvSMtXo9xCe8+RjdK9+u3lW4vJ7Bl+DO2KFPuEA=; b=SKkLMbwNVBxV7v4QnRqdhyR1T+xDJ7FLdlOJlBd7NgH/n3u36JtRqGZWVPXyQLp7d6 WSEMt4VXrJl6xYkc1bGfG708DeZmZgQhOLJU6yLzN5e1bdPQ09CpSxlXavL4KXVsymdr vw0xgy7+8Omwxyj5cTdd0ahyaRetnwH4zIGqYUHnikkQvWLEd0tC2iUgHENDC/vn0BOH DJZSYjHCVuSFuKYTqvixVKEj0hU9ty/USdvzsP8J/5kemI7LPLp88ux5u9xCpAub25Yf QctOdxvT1H7C1zpV0Sm+DZbiXgHgKQG5hBNeCAeJOOJ17IcHy8IA3GUXM9WlYCUBzWJD fqPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=gP8ASvSMtXo9xCe8+RjdK9+u3lW4vJ7Bl+DO2KFPuEA=; b=iBe7/MA8DMvgtaVwYusvhi7o6jUjS22dddTPT0BI9BNLTHkmnPPDRiClwigoyKxtFn 3cDWPeS7xt5iePtPuLjxk//82J54ll4uQ5kF7kz78yyP1+REA+FIrpKybo7CNUaJH7rm o3kFeBZaRFjfRbDrq0zb2dUsnGaNwk13ShLk2jTMG93mJxTVt15qY1yBxcGFHeOv4Oja bklcUfwePigKi7mLuZ8OeSMmJFF8XokoxPsGKu51b1ELgzuFz5tWK9ZWHHMc6ytoN3sS 3txNd2rMra2XAGAFRJij5rZquH4yqGVWT2U47ehBKP1CFbF65FNHkJQ7vzW7Vza4+AzX fL4w== X-Gm-Message-State: APf1xPAKhcXDEto8LxML1VcKc4sIvQ1DG7KyAdGKrtlbTOFDVMVjh6KS iptG7DKo+5JOebWcFjMqJPjNGRkcIG1ITAJCFimwJg== X-Google-Smtp-Source: AH8x226cilck5JLRqJl3oov1p/xAeSgerhXXE5ofvASfOwThv4qU3XYTj/s4rhzx+k+KsJmgvtONc6lYiM2u7pBDxOk= X-Received: by 10.107.175.77 with SMTP id y74mr20850563ioe.37.1519060966638; Mon, 19 Feb 2018 09:22:46 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 19 Feb 2018 09:22:45 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <9f4ed166-74fe-d5a8-e736-81551c0fd971@selasky.org> References: <201802182316.w1INGGXE050801@repo.freebsd.org> <9f4ed166-74fe-d5a8-e736-81551c0fd971@selasky.org> From: Warner Losh Date: Mon, 19 Feb 2018 10:22:45 -0700 X-Google-Sender-Auth: -X0KUu8bERehAagZt9f_OvgS3FI Message-ID: Subject: Re: svn commit: r329538 - head/sbin/devmatch To: Hans Petter Selasky Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:22:48 -0000 On Mon, Feb 19, 2018 at 12:20 AM, Hans Petter Selasky wrote: > On 02/19/18 00:16, Warner Losh wrote: > >> + if (bus && strcmp(val1, bus) != 0) { >> + if (verbose_flag) >> + printf("Skipped because table for >> bus %s, looking for %s\n", >> + val1, bus); >> + break; >> + } >> > > There might be some ports kmods which needs recompiling. Try bumping the > __FreeBSD_version ? > > The parent of the topmost USB HUB is: > dev.uhub.0.%parent: usbus0 > > Though no drivers should attach here! Yes. It wasn't the attachment point that was at issue, that never changed, just the usb driver pnp table marking. I think this has been resolved and I had some old modules that prevented things from working. Since there's a work around, I'll keep it in place until the next version bump then GC it. There's other changes needed to this code in the coming weeks, so it won't get forgotten. I've been able to to boot and get everything loaded across a few different test kernels at this point and have plugged in some unusual devices that I have laying around to hopefully ensure nothing gets busted in the future. Warner From owner-svn-src-all@freebsd.org Mon Feb 19 17:40:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AB6DF143F3; Mon, 19 Feb 2018 17:40:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B550881ACF; Mon, 19 Feb 2018 17:40:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABDAC1DA45; Mon, 19 Feb 2018 17:40:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JHeJt6036981; Mon, 19 Feb 2018 17:40:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JHeJif036979; Mon, 19 Feb 2018 17:40:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191740.w1JHeJif036979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 17:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329593 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:40:20 -0000 Author: kevans Date: Mon Feb 19 17:40:19 2018 New Revision: 329593 URL: https://svnweb.freebsd.org/changeset/base/329593 Log: stand/lua: Change boot menu items' names when swapped [Enter] should be moved to the single user menu item when we swap them. Define a non-standard menu entry function "alternate_name" to use for this purpose for ultimate flexibility if we change our minds later. When we're booting single user, make a shallow copy of the menu that we'd normally display and swap the items and their name functions to use alternate_name instead. Toggling single user in the options menu and going back to the main menu will now correctly reflect the current boot setting with the first two menu options and "[Enter]" will always be on the right one. This shallow copy technique has the chance of being quite slow since it's done on every redraw, but in my testing it does not seem to make any obvious difference. shallowCopyTable could likely belong better in a general-purpose utility module, but this (and the key constnats) are the only candidates we have at the moment so we'll drop it into our core stuff for the moment and consider re-organization at a later date. Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Mon Feb 19 17:09:29 2018 (r329592) +++ head/stand/lua/core.lua Mon Feb 19 17:40:19 2018 (r329593) @@ -217,5 +217,18 @@ function core.isSerialBoot() return false; end +-- This may be a better candidate for a 'utility' module. +function core.shallowCopyTable(tbl) + local new_tbl = {}; + for k, v in pairs(tbl) do + if (type(v) == "table") then + new_tbl[k] = core.shallowCopyTable(v); + else + new_tbl[k] = v; + end + end + return new_tbl; +end + core.setACPI(core.getACPIPresent(false)); return core; Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 17:09:29 2018 (r329592) +++ head/stand/lua/menu.lua Mon Feb 19 17:40:19 2018 (r329593) @@ -137,9 +137,15 @@ menu.welcome = { local menu_entries = menu.welcome.all_entries; -- Swap the first two menu items on single user boot if (core.isSingleUserBoot()) then + -- Shallow copy the table + menu_entries = core.shallowCopyTable(menu_entries); + local multiuser = menu_entries[1]; local singleuser = menu_entries[2]; + multiuser.name = multiuser.alternate_name; + singleuser.name = singleuser.alternate_name; + menu_entries[2] = multiuser; menu_entries[1] = singleuser; end @@ -154,6 +160,11 @@ menu.welcome = { "oot Multi user " .. color.highlight("[Enter]"); end, + -- Not a standard menu entry function! + alternate_name = function() + return color.highlight("B") .. + "oot Multi user"; + end, func = function() core.setSingleUser(false); core.boot(); @@ -167,6 +178,11 @@ menu.welcome = { name = function() return "Boot " .. color.highlight("S") .. "ingle user"; + end, + -- Not a standard menu entry function! + alternate_name = function() + return "Boot " .. color.highlight("S") .. + "ingle user " .. color.highlight("[Enter]"); end, func = function() core.setSingleUser(true); From owner-svn-src-all@freebsd.org Mon Feb 19 17:51:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FEE4F15374; Mon, 19 Feb 2018 17:51:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 435C282718; Mon, 19 Feb 2018 17:51:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E5A21DD38; Mon, 19 Feb 2018 17:51:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JHpYJn045137; Mon, 19 Feb 2018 17:51:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JHpXow045132; Mon, 19 Feb 2018 17:51:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191751.w1JHpXow045132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 17:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329594 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:51:34 -0000 Author: kevans Date: Mon Feb 19 17:51:33 2018 New Revision: 329594 URL: https://svnweb.freebsd.org/changeset/base/329594 Log: stand/lua: Round up some more style.lua(9) concerns Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Feb 19 17:40:19 2018 (r329593) +++ head/stand/lua/color.lua Mon Feb 19 17:51:33 2018 (r329594) @@ -26,10 +26,10 @@ -- $FreeBSD$ -- -local color = {}; - local core = require("core"); +local color = {}; + color.BLACK = 0; color.RED = 1; color.GREEN = 2; @@ -59,14 +59,14 @@ function color.escapef(c) if (color.disabled) then return c; end - return "\027[3"..c.."m"; + return "\027[3" .. c .. "m"; end function color.escapeb(c) if (color.disabled) then return c; end - return "\027[4"..c.."m"; + return "\027[4" .. c .. "m"; end function color.escape(fg, bg, att) @@ -76,9 +76,9 @@ function color.escape(fg, bg, att) if (not att) then att = "" else - att = att..";"; + att = att .. ";"; end - return "\027["..att.."3"..fg..";4"..bg.."m"; + return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m"; end function color.default() @@ -92,7 +92,7 @@ function color.highlight(str) if (color.disabled) then return str; end - return "\027[1m"..str.."\027[0m"; + return "\027[1m" .. str .. "\027[0m"; end return color; Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 17:40:19 2018 (r329593) +++ head/stand/lua/config.lua Mon Feb 19 17:51:33 2018 (r329594) @@ -196,7 +196,7 @@ function config.loadmod(mod, silent) if (not silent) then print("Failed to execute '" .. v.before .. - "' before loading '".. k .. + "' before loading '" .. k .. "'"); end status = false; @@ -227,7 +227,9 @@ function config.loadmod(mod, silent) end else - --if not silent then print("Skiping module '".. k .. "'"); end + -- if not silent then + -- print("Skiping module '". . k .. "'"); + -- end end end @@ -431,4 +433,4 @@ function config.loadelf() end -return config +return config; Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 17:40:19 2018 (r329593) +++ head/stand/lua/drawer.lua Mon Feb 19 17:51:33 2018 (r329594) @@ -193,7 +193,7 @@ function drawer.drawmenu(m) else name = e.name(); end - print(entry_num .. ". "..name); + print(entry_num .. ". " .. name); -- fill the alias table alias_table[tostring(entry_num)] = e; Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 17:40:19 2018 (r329593) +++ head/stand/lua/menu.lua Mon Feb 19 17:51:33 2018 (r329594) @@ -252,7 +252,7 @@ menu.welcome = { end kernel_name = kernel_name .. name_color .. choice .. color.default(); - return color.highlight("K").."ernel: " .. + return color.highlight("K") .. "ernel: " .. kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")"; end, @@ -315,7 +315,7 @@ function menu.run(m) -- Special key behaviors if ((key == core.KEY_BACKSPACE) or (key == core.KEY_DELETE)) and (m ~= menu.welcome) then - break + break; elseif (key == core.KEY_ENTER) then core.boot(); -- Should not return @@ -431,7 +431,7 @@ function menu.autoboot() end loader.delay(50000); - until time <= 0 + until time <= 0; core.boot(); end Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Mon Feb 19 17:40:19 2018 (r329593) +++ head/stand/lua/screen.lua Mon Feb 19 17:51:33 2018 (r329594) @@ -26,11 +26,11 @@ -- $FreeBSD$ -- -local screen = {}; - local color = require("color"); local core = require("core"); +local screen = {}; + -- XXX TODO: This should be fixed in the interpreter to not print decimals function intstring(num) local str = tostring(num); @@ -54,21 +54,21 @@ function screen.setcursor(x, y) return; end - loader.printc("\027["..intstring(y)..";"..intstring(x).."H"); + loader.printc("\027[" .. intstring(y) .. ";" .. intstring(x) .. "H"); end function screen.setforeground(c) if (color.disabled) then return c; end - loader.printc("\027[3"..c.."m"); + loader.printc("\027[3" .. c .. "m"); end function screen.setbackground(c) if (color.disabled) then return c; end - loader.printc("\027[4"..c.."m"); + loader.printc("\027[4" .. c .. "m"); end function screen.defcolor() From owner-svn-src-all@freebsd.org Mon Feb 19 17:54:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9371CF158C2; Mon, 19 Feb 2018 17:54:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4535482A08; Mon, 19 Feb 2018 17:54:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BD631DD80; Mon, 19 Feb 2018 17:54:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JHsNBa046841; Mon, 19 Feb 2018 17:54:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JHsMSA046838; Mon, 19 Feb 2018 17:54:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191754.w1JHsMSA046838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 17:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329595 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 17:54:23 -0000 Author: kevans Date: Mon Feb 19 17:54:22 2018 New Revision: 329595 URL: https://svnweb.freebsd.org/changeset/base/329595 Log: stand/lua: Re-order locals after copyright notice; require comes first Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 17:51:33 2018 (r329594) +++ head/stand/lua/drawer.lua Mon Feb 19 17:54:22 2018 (r329595) @@ -26,11 +26,11 @@ -- $FreeBSD$ -- -local drawer = {}; - local color = require("color"); local core = require("core"); local screen = require("screen"); + +local drawer = {}; drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 17:51:33 2018 (r329594) +++ head/stand/lua/menu.lua Mon Feb 19 17:54:22 2018 (r329595) @@ -27,13 +27,13 @@ -- -local menu = {}; - local core = require("core"); local color = require("color"); local config = require("config"); local screen = require("screen"); local drawer = require("drawer"); + +local menu = {}; local OnOff; local skip; Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Mon Feb 19 17:51:33 2018 (r329594) +++ head/stand/lua/password.lua Mon Feb 19 17:54:22 2018 (r329595) @@ -26,10 +26,10 @@ -- $FreeBSD$ -- -local password = {}; - local core = require("core"); local screen = require("screen"); + +local password = {}; function password.read() local str = ""; From owner-svn-src-all@freebsd.org Mon Feb 19 18:11:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 657E2F16D57; Mon, 19 Feb 2018 18:11:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BFB6837DB; Mon, 19 Feb 2018 18:11:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16F141DF67; Mon, 19 Feb 2018 18:11:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JIBZO1054660; Mon, 19 Feb 2018 18:11:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JIBZCP054657; Mon, 19 Feb 2018 18:11:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802191811.w1JIBZCP054657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 18:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329596 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 18:11:36 -0000 Author: kevans Date: Mon Feb 19 18:11:35 2018 New Revision: 329596 URL: https://svnweb.freebsd.org/changeset/base/329596 Log: stand/lua: Add copyright notice in places I've made some not-insignificant changes to config, menu, and password bits of our lua scripts. Add a copyright notice to them to reflect. Modified: head/stand/lua/config.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Mon Feb 19 17:54:22 2018 (r329595) +++ head/stand/lua/config.lua Mon Feb 19 18:11:35 2018 (r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 17:54:22 2018 (r329595) +++ head/stand/lua/menu.lua Mon Feb 19 18:11:35 2018 (r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Mon Feb 19 17:54:22 2018 (r329595) +++ head/stand/lua/password.lua Mon Feb 19 18:11:35 2018 (r329596) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (C) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Mon Feb 19 18:41:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8EE5F1942C; Mon, 19 Feb 2018 18:41:57 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B2C284CA4; Mon, 19 Feb 2018 18:41:57 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55E9A1E445; Mon, 19 Feb 2018 18:41:57 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JIfvUl071326; Mon, 19 Feb 2018 18:41:57 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JIfutv071319; Mon, 19 Feb 2018 18:41:56 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201802191841.w1JIfutv071319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 19 Feb 2018 18:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329598 - in head: share/man/man9 sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: in head: share/man/man9 sys/dev/pci X-SVN-Commit-Revision: 329598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 18:41:57 -0000 Author: bryanv Date: Mon Feb 19 18:41:56 2018 New Revision: 329598 URL: https://svnweb.freebsd.org/changeset/base/329598 Log: Add PCI methods to iterate over the PCI capabilities VirtIO V1 provides configuration in multiple VENDOR capabilities so this allows all of the configuration to be discovered. Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14325 Modified: head/share/man/man9/pci.9 head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_private.h head/sys/dev/pci/pcivar.h head/sys/dev/pci/vga_pci.c Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Mon Feb 19 18:14:12 2018 (r329597) +++ head/share/man/man9/pci.9 Mon Feb 19 18:41:56 2018 (r329598) @@ -42,6 +42,9 @@ .Nm pci_find_device , .Nm pci_find_extcap , .Nm pci_find_htcap , +.Nm pci_find_next_cap , +.Nm pci_find_next_extcap , +.Nm pci_find_next_htcap , .Nm pci_find_pcie_root_port , .Nm pci_get_id , .Nm pci_get_max_payload , @@ -100,6 +103,12 @@ .Fn pci_find_extcap "device_t dev" "int capability" "int *capreg" .Ft int .Fn pci_find_htcap "device_t dev" "int capability" "int *capreg" +.Ft int +.Fn pci_find_next_cap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_extcap "device_t dev" "int capability" "int start" "int *capreg" +.Ft int +.Fn pci_find_next_htcap "device_t dev" "int capability" "int start" "int *capreg" .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int @@ -330,6 +339,22 @@ returns zero. If the capability is not found or the device does not support capabilities, .Fn pci_find_cap returns an error. +The +.Fn pci_find_next_cap +function is used to locate the next instance of a PCI capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_cap +or +.Fn pci_find_next_cap . +When no more instances are located +.Fn pci_find_next_cap +returns an error. .Pp The .Fn pci_find_extcap @@ -352,6 +377,22 @@ If the extended capability is not found or the device PCI-express device, .Fn pci_find_extcap returns an error. +The +.Fn pci_find_next_extcap +function is used to locate the next instance of a PCI-express +extended capability register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_extcap +or +.Fn pci_find_next_extcap . +When no more instances are located +.Fn pci_find_next_extcap +returns an error. .Pp The .Fn pci_find_htcap @@ -372,6 +413,22 @@ and returns zero. If the capability is not found or the device is not a HyperTransport device, .Fn pci_find_htcap +returns an error. +The +.Fn pci_find_next_htcap +function is used to locate the next instance of a HyperTransport capability +register set for the device +.Fa dev . +The +.Fa start +should be the +.Fa *capreg +returned by a prior +.Fn pci_find_htcap +or +.Fn pci_find_next_htcap . +When no more instances are located +.Fn pci_find_next_htcap returns an error. .Pp The Modified: head/sys/dev/pci/hostb_pci.c ============================================================================== --- head/sys/dev/pci/hostb_pci.c Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/hostb_pci.c Mon Feb 19 18:41:56 2018 (r329598) @@ -207,6 +207,14 @@ pci_hostb_find_cap(device_t dev, device_t child, int c } static int +pci_hostb_find_next_cap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_cap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -215,6 +223,14 @@ pci_hostb_find_extcap(device_t dev, device_t child, in } static int +pci_hostb_find_next_extcap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_extcap(dev, capability, start, capreg)); +} + +static int pci_hostb_find_htcap(device_t dev, device_t child, int capability, int *capreg) { @@ -222,6 +238,14 @@ pci_hostb_find_htcap(device_t dev, device_t child, int return (pci_find_htcap(dev, capability, capreg)); } +static int +pci_hostb_find_next_htcap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_htcap(dev, capability, start, capreg)); +} + static device_method_t pci_hostb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_hostb_probe), @@ -252,8 +276,11 @@ static device_method_t pci_hostb_methods[] = { DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), DEVMETHOD(pci_assign_interrupt, pci_hostb_assign_interrupt), DEVMETHOD(pci_find_cap, pci_hostb_find_cap), + DEVMETHOD(pci_find_next_cap, pci_hostb_find_next_cap), DEVMETHOD(pci_find_extcap, pci_hostb_find_extcap), + DEVMETHOD(pci_find_next_extcap, pci_hostb_find_next_extcap), DEVMETHOD(pci_find_htcap, pci_hostb_find_htcap), + DEVMETHOD(pci_find_next_htcap, pci_hostb_find_next_htcap), { 0, 0 } }; Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/pci.c Mon Feb 19 18:41:56 2018 (r329598) @@ -183,8 +183,11 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_set_powerstate, pci_set_powerstate_method), DEVMETHOD(pci_assign_interrupt, pci_assign_interrupt_method), DEVMETHOD(pci_find_cap, pci_find_cap_method), + DEVMETHOD(pci_find_next_cap, pci_find_next_cap_method), DEVMETHOD(pci_find_extcap, pci_find_extcap_method), + DEVMETHOD(pci_find_next_extcap, pci_find_next_extcap_method), DEVMETHOD(pci_find_htcap, pci_find_htcap_method), + DEVMETHOD(pci_find_next_htcap, pci_find_next_htcap_method), DEVMETHOD(pci_alloc_msi, pci_alloc_msi_method), DEVMETHOD(pci_alloc_msix, pci_alloc_msix_method), DEVMETHOD(pci_enable_msi, pci_enable_msi_method), @@ -1377,7 +1380,7 @@ pci_find_htcap_method(device_t dev, device_t child, in * Traverse the capabilities list checking each HT capability * to see if it matches the requested HT capability. */ - while (ptr != 0) { + for (;;) { val = pci_read_config(child, ptr + PCIR_HT_COMMAND, 2); if (capability == PCIM_HTCAP_SLAVE || capability == PCIM_HTCAP_HOST) @@ -1391,13 +1394,51 @@ pci_find_htcap_method(device_t dev, device_t child, in } /* Skip to the next HT capability. */ - while (ptr != 0) { - ptr = pci_read_config(child, ptr + PCICAP_NEXTPTR, 1); - if (pci_read_config(child, ptr + PCICAP_ID, 1) == - PCIY_HT) - break; + if (pci_find_next_cap(child, PCIY_HT, ptr, &ptr) != 0) + break; + } + + return (ENOENT); +} + +/* + * Find the next requested HyperTransport capability after start and return + * the offset in configuration space via the pointer provided. The function + * returns 0 on success and an error code otherwise. + */ +int +pci_find_next_htcap_method(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + int ptr; + uint16_t val; + + KASSERT(pci_read_config(child, start + PCICAP_ID, 1) == PCIY_HT, + ("start capability is not HyperTransport capability")); + ptr = start; + + /* + * Traverse the capabilities list checking each HT capability + * to see if it matches the requested HT capability. + */ + for (;;) { + /* Skip to the next HT capability. */ + if (pci_find_next_cap(child, PCIY_HT, ptr, &ptr) != 0) + break; + + val = pci_read_config(child, ptr + PCIR_HT_COMMAND, 2); + if (capability == PCIM_HTCAP_SLAVE || + capability == PCIM_HTCAP_HOST) + val &= 0xe000; + else + val &= PCIM_HTCMD_CAP_MASK; + if (val == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); } } + return (ENOENT); } @@ -1412,8 +1453,8 @@ pci_find_cap_method(device_t dev, device_t child, int { struct pci_devinfo *dinfo = device_get_ivars(child); pcicfgregs *cfg = &dinfo->cfg; - u_int32_t status; - u_int8_t ptr; + uint32_t status; + uint8_t ptr; /* * Check the CAP_LIST bit of the PCI status register first. @@ -1455,6 +1496,33 @@ pci_find_cap_method(device_t dev, device_t child, int } /* + * Find the next requested capability after start and return the offset in + * configuration space via the pointer provided. The function returns + * 0 on success and an error code otherwise. + */ +int +pci_find_next_cap_method(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + uint8_t ptr; + + KASSERT(pci_read_config(child, start + PCICAP_ID, 1) == capability, + ("start capability is not expected capability")); + + ptr = pci_read_config(child, start + PCICAP_NEXTPTR, 1); + while (ptr != 0) { + if (pci_read_config(child, ptr + PCICAP_ID, 1) == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); + } + ptr = pci_read_config(child, ptr + PCICAP_NEXTPTR, 1); + } + + return (ENOENT); +} + +/* * Find the requested extended capability and return the offset in * configuration space via the pointer provided. The function returns * 0 on success and an error code otherwise. @@ -1486,6 +1554,41 @@ pci_find_extcap_method(device_t dev, device_t child, i if (ptr == 0) break; ecap = pci_read_config(child, ptr, 4); + } + + return (ENOENT); +} + +/* + * Find the next requested extended capability after start and return the + * offset in configuration space via the pointer provided. The function + * returns 0 on success and an error code otherwise. + */ +int +pci_find_next_extcap_method(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + pcicfgregs *cfg = &dinfo->cfg; + uint32_t ecap; + uint16_t ptr; + + /* Only supported for PCI-express devices. */ + if (cfg->pcie.pcie_location == 0) + return (ENXIO); + + ecap = pci_read_config(child, start, 4); + KASSERT(PCI_EXTCAP_ID(ecap) == capability, + ("start extended capability is not expected capability")); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + while (ptr != 0) { + ecap = pci_read_config(child, ptr, 4); + if (PCI_EXTCAP_ID(ecap) == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); + } + ptr = PCI_EXTCAP_NEXTPTR(ecap); } return (ENOENT); Modified: head/sys/dev/pci/pci_if.m ============================================================================== --- head/sys/dev/pci/pci_if.m Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/pci_if.m Mon Feb 19 18:41:56 2018 (r329598) @@ -141,6 +141,14 @@ METHOD int find_cap { int *capreg; }; +METHOD int find_next_cap { + device_t dev; + device_t child; + int capability; + int start; + int *capreg; +}; + METHOD int find_extcap { device_t dev; device_t child; @@ -148,10 +156,26 @@ METHOD int find_extcap { int *capreg; }; +METHOD int find_next_extcap { + device_t dev; + device_t child; + int capability; + int start; + int *capreg; +}; + METHOD int find_htcap { device_t dev; device_t child; int capability; + int *capreg; +}; + +METHOD int find_next_htcap { + device_t dev; + device_t child; + int capability; + int start; int *capreg; }; Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/pci_private.h Mon Feb 19 18:41:56 2018 (r329598) @@ -90,10 +90,16 @@ int pci_enable_io_method(device_t dev, device_t child int pci_disable_io_method(device_t dev, device_t child, int space); int pci_find_cap_method(device_t dev, device_t child, int capability, int *capreg); +int pci_find_next_cap_method(device_t dev, device_t child, + int capability, int start, int *capreg); int pci_find_extcap_method(device_t dev, device_t child, int capability, int *capreg); +int pci_find_next_extcap_method(device_t dev, device_t child, + int capability, int start, int *capreg); int pci_find_htcap_method(device_t dev, device_t child, int capability, int *capreg); +int pci_find_next_htcap_method(device_t dev, device_t child, + int capability, int start, int *capreg); int pci_alloc_msi_method(device_t dev, device_t child, int *count); int pci_alloc_msix_method(device_t dev, device_t child, int *count); void pci_enable_msi_method(device_t dev, device_t child, Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/pcivar.h Mon Feb 19 18:41:56 2018 (r329598) @@ -468,15 +468,36 @@ pci_find_cap(device_t dev, int capability, int *capreg } static __inline int +pci_find_next_cap(device_t dev, int capability, int start, int *capreg) +{ + return (PCI_FIND_NEXT_CAP(device_get_parent(dev), dev, capability, start, + capreg)); +} + +static __inline int pci_find_extcap(device_t dev, int capability, int *capreg) { return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg)); } static __inline int +pci_find_next_extcap(device_t dev, int capability, int start, int *capreg) +{ + return (PCI_FIND_NEXT_EXTCAP(device_get_parent(dev), dev, capability, + start, capreg)); +} + +static __inline int pci_find_htcap(device_t dev, int capability, int *capreg) { return (PCI_FIND_HTCAP(device_get_parent(dev), dev, capability, capreg)); +} + +static __inline int +pci_find_next_htcap(device_t dev, int capability, int start, int *capreg) +{ + return (PCI_FIND_NEXT_HTCAP(device_get_parent(dev), dev, capability, + start, capreg)); } static __inline int Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Mon Feb 19 18:14:12 2018 (r329597) +++ head/sys/dev/pci/vga_pci.c Mon Feb 19 18:41:56 2018 (r329598) @@ -497,6 +497,14 @@ vga_pci_find_cap(device_t dev, device_t child, int cap } static int +vga_pci_find_next_cap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_cap(dev, capability, start, capreg)); +} + +static int vga_pci_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -505,6 +513,14 @@ vga_pci_find_extcap(device_t dev, device_t child, int } static int +vga_pci_find_next_extcap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_extcap(dev, capability, start, capreg)); +} + +static int vga_pci_find_htcap(device_t dev, device_t child, int capability, int *capreg) { @@ -513,6 +529,14 @@ vga_pci_find_htcap(device_t dev, device_t child, int c } static int +vga_pci_find_next_htcap(device_t dev, device_t child, int capability, + int start, int *capreg) +{ + + return (pci_find_next_htcap(dev, capability, start, capreg)); +} + +static int vga_pci_alloc_msi(device_t dev, device_t child, int *count) { struct vga_pci_softc *sc; @@ -622,8 +646,11 @@ static device_method_t vga_pci_methods[] = { DEVMETHOD(pci_set_powerstate, vga_pci_set_powerstate), DEVMETHOD(pci_assign_interrupt, vga_pci_assign_interrupt), DEVMETHOD(pci_find_cap, vga_pci_find_cap), + DEVMETHOD(pci_find_next_cap, vga_pci_find_next_cap), DEVMETHOD(pci_find_extcap, vga_pci_find_extcap), + DEVMETHOD(pci_find_next_extcap, vga_pci_find_next_extcap), DEVMETHOD(pci_find_htcap, vga_pci_find_htcap), + DEVMETHOD(pci_find_next_htcap, vga_pci_find_next_htcap), DEVMETHOD(pci_alloc_msi, vga_pci_alloc_msi), DEVMETHOD(pci_alloc_msix, vga_pci_alloc_msix), DEVMETHOD(pci_remap_msix, vga_pci_remap_msix), From owner-svn-src-all@freebsd.org Mon Feb 19 19:01:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CF14F1AD7E; Mon, 19 Feb 2018 19:01:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6FE285D79; Mon, 19 Feb 2018 19:01:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1EA21E783; Mon, 19 Feb 2018 19:01:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JJ1kAj081700; Mon, 19 Feb 2018 19:01:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JJ1kYS081699; Mon, 19 Feb 2018 19:01:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802191901.w1JJ1kYS081699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Feb 2018 19:01:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329599 - head/tools/tools/net80211/w00t/ap X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/tools/tools/net80211/w00t/ap X-SVN-Commit-Revision: 329599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 19:01:47 -0000 Author: eadler Date: Mon Feb 19 19:01:46 2018 New Revision: 329599 URL: https://svnweb.freebsd.org/changeset/base/329599 Log: tools/80211: correct array index wh->i_dur is a two byte value; not a single byte set twice Reported by: swildner@DragonFlyBSD.org Modified: head/tools/tools/net80211/w00t/ap/ap.c Modified: head/tools/tools/net80211/w00t/ap/ap.c ============================================================================== --- head/tools/tools/net80211/w00t/ap/ap.c Mon Feb 19 18:41:56 2018 (r329598) +++ head/tools/tools/net80211/w00t/ap/ap.c Mon Feb 19 19:01:46 2018 (r329599) @@ -389,7 +389,7 @@ void send_cts(struct params *p, char *mac) wh->i_fc[0] |= IEEE80211_FC0_TYPE_CTL; wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_CTS; wh->i_dur[0] = 0x69; - wh->i_dur[0] = 0x00; + wh->i_dur[1] = 0x00; memcpy(wh->i_addr1, mac, 6); send_frame(p, wh, 10); From owner-svn-src-all@freebsd.org Mon Feb 19 19:08:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EEA8F1B4F8; Mon, 19 Feb 2018 19:08:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12FD186122; Mon, 19 Feb 2018 19:08:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 093DE1E8B2; Mon, 19 Feb 2018 19:08:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JJ8P3P081955; Mon, 19 Feb 2018 19:08:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JJ8PZ2081954; Mon, 19 Feb 2018 19:08:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802191908.w1JJ8PZ2081954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Feb 2018 19:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329600 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 329600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 19:08:26 -0000 Author: kib Date: Mon Feb 19 19:08:25 2018 New Revision: 329600 URL: https://svnweb.freebsd.org/changeset/base/329600 Log: Do not free(9) uninitialized pointer. Reported and tested by: allanjude Reviewed by: markj Sponsored by: The FreeBSD Foundation Modified: head/sys/ufs/ffs/ffs_subr.c Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Mon Feb 19 19:01:46 2018 (r329599) +++ head/sys/ufs/ffs/ffs_subr.c Mon Feb 19 19:08:25 2018 (r329600) @@ -174,12 +174,17 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper *fsp = NULL; if (altsuperblock != -1) { - if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0) + ret = readsuper(devfd, fsp, altsuperblock, readfunc); + if (*fsp != NULL) + (*fsp)->fs_csp = NULL; + if (ret != 0) return (ret); } else { for (i = 0; sblock_try[i] != -1; i++) { - if ((ret = readsuper(devfd, fsp, sblock_try[i], - readfunc)) == 0) + ret = readsuper(devfd, fsp, sblock_try[i], readfunc); + if (*fsp != NULL) + (*fsp)->fs_csp = NULL; + if (ret == 0) break; if (ret == ENOENT) continue; @@ -188,17 +193,17 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper if (sblock_try[i] == -1) return (ENOENT); } + /* - * If not filling in summary information, NULL out fs_csp and return. + * Not filling in summary information, return. */ - fs = *fsp; - if (filltype == NULL) { - fs->fs_csp = NULL; + if (filltype == NULL) return (0); - } + /* * Read in the superblock summary information. */ + fs = *fsp; size = fs->fs_cssize; blks = howmany(size, fs->fs_fsize); if (fs->fs_contigsumsize > 0) From owner-svn-src-all@freebsd.org Mon Feb 19 19:28:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2293F1CD8B; Mon, 19 Feb 2018 19:28:25 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF8C86D94; Mon, 19 Feb 2018 19:28:25 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B821EBEA; Mon, 19 Feb 2018 19:28:25 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JJSPHo091922; Mon, 19 Feb 2018 19:28:25 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JJSOH5091919; Mon, 19 Feb 2018 19:28:24 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201802191928.w1JJSOH5091919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 19 Feb 2018 19:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329601 - head/sys/dev/virtio X-SVN-Group: head X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: head/sys/dev/virtio X-SVN-Commit-Revision: 329601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 19:28:26 -0000 Author: bryanv Date: Mon Feb 19 19:28:24 2018 New Revision: 329601 URL: https://svnweb.freebsd.org/changeset/base/329601 Log: Add VirtIO bus config_generation method VirtIO buses (PCI, MMIO) can provide a generation field so a driver can ensure either a 64-bit or array read was stable. MFC after: 2 weeks Modified: head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_bus_if.m Modified: head/sys/dev/virtio/virtio.c ============================================================================== --- head/sys/dev/virtio/virtio.c Mon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.c Mon Feb 19 19:28:24 2018 (r329601) @@ -240,6 +240,13 @@ virtio_reinit_complete(device_t dev) VIRTIO_BUS_REINIT_COMPLETE(device_get_parent(dev)); } +int +virtio_config_generation(device_t dev) +{ + + return (VIRTIO_BUS_CONFIG_GENERATION(device_get_parent(dev))); +} + void virtio_read_device_config(device_t dev, bus_size_t offset, void *dst, int len) { Modified: head/sys/dev/virtio/virtio.h ============================================================================== --- head/sys/dev/virtio/virtio.h Mon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio.h Mon Feb 19 19:28:24 2018 (r329601) @@ -78,6 +78,7 @@ int virtio_alloc_virtqueues(device_t dev, int flags, int virtio_setup_intr(device_t dev, enum intr_type type); int virtio_with_feature(device_t dev, uint64_t feature); void virtio_stop(device_t dev); +int virtio_config_generation(device_t dev); int virtio_reinit(device_t dev, uint64_t features); void virtio_reinit_complete(device_t dev); Modified: head/sys/dev/virtio/virtio_bus_if.m ============================================================================== --- head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:08:25 2018 (r329600) +++ head/sys/dev/virtio/virtio_bus_if.m Mon Feb 19 19:28:24 2018 (r329601) @@ -34,6 +34,14 @@ HEADER { struct vq_alloc_info; }; +CODE { + static int + virtio_bus_default_config_generation(device_t dev) + { + return (0); + } +}; + METHOD uint64_t negotiate_features { device_t dev; uint64_t child_features; @@ -73,6 +81,10 @@ METHOD void notify_vq { device_t dev; uint16_t queue; }; + +METHOD int config_generation { + device_t dev; +} DEFAULT virtio_bus_default_config_generation; METHOD void read_device_config { device_t dev; From owner-svn-src-all@freebsd.org Mon Feb 19 19:31:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D7E1F1D151; Mon, 19 Feb 2018 19:31:19 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E47CE870B6; Mon, 19 Feb 2018 19:31:18 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF4A01ED23; Mon, 19 Feb 2018 19:31:18 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JJVIl9092999; Mon, 19 Feb 2018 19:31:18 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JJVIcL092997; Mon, 19 Feb 2018 19:31:18 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201802191931.w1JJVIcL092997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 19 Feb 2018 19:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329602 - head/sys/dev/virtio X-SVN-Group: head X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: head/sys/dev/virtio X-SVN-Commit-Revision: 329602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 19:31:19 -0000 Author: bryanv Date: Mon Feb 19 19:31:18 2018 New Revision: 329602 URL: https://svnweb.freebsd.org/changeset/base/329602 Log: Add more virtqueue getter methods MFC after: 2 weeks Modified: head/sys/dev/virtio/virtqueue.c head/sys/dev/virtio/virtqueue.h Modified: head/sys/dev/virtio/virtqueue.c ============================================================================== --- head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.c Mon Feb 19 19:31:18 2018 (r329602) @@ -369,6 +369,33 @@ virtqueue_paddr(struct virtqueue *vq) return (vtophys(vq->vq_ring_mem)); } +vm_paddr_t +virtqueue_desc_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.desc)); +} + +vm_paddr_t +virtqueue_avail_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.avail)); +} + +vm_paddr_t +virtqueue_used_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.used)); +} + +uint16_t +virtqueue_index(struct virtqueue *vq) +{ + return (vq->vq_queue_index); +} + int virtqueue_size(struct virtqueue *vq) { Modified: head/sys/dev/virtio/virtqueue.h ============================================================================== --- head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:28:24 2018 (r329601) +++ head/sys/dev/virtio/virtqueue.h Mon Feb 19 19:31:18 2018 (r329602) @@ -84,7 +84,11 @@ void virtqueue_disable_intr(struct virtqueue *vq); /* Get physical address of the virtqueue ring. */ vm_paddr_t virtqueue_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_desc_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_avail_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_used_paddr(struct virtqueue *vq); +uint16_t virtqueue_index(struct virtqueue *vq); int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq); From owner-svn-src-all@freebsd.org Mon Feb 19 19:55:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88A41F1F0D3; Mon, 19 Feb 2018 19:55:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 371FF68192; Mon, 19 Feb 2018 19:55:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E08D1F09E; Mon, 19 Feb 2018 19:55:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JJtUpT007131; Mon, 19 Feb 2018 19:55:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JJtU6K007129; Mon, 19 Feb 2018 19:55:30 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802191955.w1JJtU6K007129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 19 Feb 2018 19:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329603 - stable/11/sys/dev/nctgpio X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/dev/nctgpio X-SVN-Commit-Revision: 329603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 19:55:30 -0000 Author: gonzo Date: Mon Feb 19 19:55:29 2018 New Revision: 329603 URL: https://svnweb.freebsd.org/changeset/base/329603 Log: MFC r327502: nctgpio: add new device id for the GPIO chip in PCEngines APU3 PR: 224512 Submitted by: mike@sentex.net Modified: stable/11/sys/dev/nctgpio/nctgpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nctgpio/nctgpio.c ============================================================================== --- stable/11/sys/dev/nctgpio/nctgpio.c Mon Feb 19 19:31:18 2018 (r329602) +++ stable/11/sys/dev/nctgpio/nctgpio.c Mon Feb 19 19:55:29 2018 (r329603) @@ -140,6 +140,10 @@ struct nuvoton_vendor_device_id { .chip_id = 0xc452, .descr = "Nuvoton NCT5104D (PC-Engines APU)", }, + { + .chip_id = 0xc453, + .descr = "Nuvoton NCT5104D (PC-Engines APU3)", + }, }; static void From owner-svn-src-all@freebsd.org Mon Feb 19 21:55:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C322F01CFB; Mon, 19 Feb 2018 21:55:10 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73ABA6D6F0; Mon, 19 Feb 2018 21:55:10 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward104j.mail.yandex.net (Yandex) with ESMTP id CF7094182E; Tue, 20 Feb 2018 00:54:59 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KoBtvJIf05-sxr8Lqrr; Tue, 20 Feb 2018 00:54:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519077299; bh=lpQiq8iCx0fXeyXsbm8oXD1wa/CLf2znjd7NtyOFIBw=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=Gea3T7UEnOhPiWCiiwSp0oR+z9bUr+7FIFFUDUoeebohFIh9Yyogshme8PRN9eoQ7 81evMR4q3THFMoGNzpSwvfuwGqabS/06QpL+o/qHf4hloGqK+P3YowVUPvRISgljpY xjYhAw6Irkzp1gm4eQsZ3W/qUboA/I5gfSfkWs9s= Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 0hzWNvO8iQ-sveSWbDG; Tue, 20 Feb 2018 00:54:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519077299; bh=lpQiq8iCx0fXeyXsbm8oXD1wa/CLf2znjd7NtyOFIBw=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=Gea3T7UEnOhPiWCiiwSp0oR+z9bUr+7FIFFUDUoeebohFIh9Yyogshme8PRN9eoQ7 81evMR4q3THFMoGNzpSwvfuwGqabS/06QpL+o/qHf4hloGqK+P3YowVUPvRISgljpY xjYhAw6Irkzp1gm4eQsZ3W/qUboA/I5gfSfkWs9s= Authentication-Results: smtp2o.mail.yandex.net; dkim=pass header.i=@yandex.ru Date: Mon, 19 Feb 2018 21:54:53 +0000 From: Alexander Nasonov To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329585 - head/stand/lua Message-ID: <20180219215453.GA10409@neva> References: <201802191634.w1JGYNAE003191@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201802191634.w1JGYNAE003191@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 21:55:11 -0000 Kyle Evans wrote: > +function core.isSingleUserBoot() > + local single_user = loader.getenv("boot_single"); > + return single_user ~= nil and single_user:lower() == "yes"; > +end Just curious, why do you end all lines with semi-colons? It's not very common in Lua code. This version looks more idiomatic: function core.isSingleUserBoot() local single_user = loader.getenv("boot_single") return single_user and single_user:lower() == "yes" end -- Alex From owner-svn-src-all@freebsd.org Mon Feb 19 22:00:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F984F02492; Mon, 19 Feb 2018 22:00:30 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4D7B6DE0D; Mon, 19 Feb 2018 22:00:29 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward103p.mail.yandex.net (Yandex) with ESMTP id EE7B3218320B; Tue, 20 Feb 2018 01:00:19 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wxIIyRjkiT-0Jpabfpn; Tue, 20 Feb 2018 01:00:19 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519077619; bh=km47xx61cwgFvTOR+P5ACKw/K4qkE/ry9Y2rrkXJO4s=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=aBIcwfI1qgQIVz45ki8rN6wXc4I9SlGdwaN9tzDhKdMzJst6bZ0HKtMce2DA6GIeE XySR+6o4hVwrzbWUCB/5j+GoiGzz7jsaDNjAo5haSr1qS2b356S43PwZEHzQHCu1Nu ku9GUVore8BYK6dowa+ZwyyZiS8hQs/mAQEjsIZc= Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ZiZrThuqsZ-0HCSUfM2; Tue, 20 Feb 2018 01:00:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519077619; bh=km47xx61cwgFvTOR+P5ACKw/K4qkE/ry9Y2rrkXJO4s=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=aBIcwfI1qgQIVz45ki8rN6wXc4I9SlGdwaN9tzDhKdMzJst6bZ0HKtMce2DA6GIeE XySR+6o4hVwrzbWUCB/5j+GoiGzz7jsaDNjAo5haSr1qS2b356S43PwZEHzQHCu1Nu ku9GUVore8BYK6dowa+ZwyyZiS8hQs/mAQEjsIZc= Authentication-Results: smtp1o.mail.yandex.net; dkim=pass header.i=@yandex.ru Date: Mon, 19 Feb 2018 22:00:01 +0000 From: Alexander Nasonov To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329587 - head/stand/lua Message-ID: <20180219220001.GA12274@neva> References: <201802191636.w1JGaTci003687@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201802191636.w1JGaTci003687@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:00:30 -0000 Kyle Evans wrote: > + -- Swap the first two menu items on single user boot > + if (core.isSingleUserBoot()) then > + local multiuser = menu_entries[1]; > + local singleuser = menu_entries[2]; > + > + menu_entries[2] = multiuser; > + menu_entries[1] = singleuser; > + end -- Swap the first two menu items on single user boot if core.isSingleUserBoot() then menu_entries[1], menu_entries[2] = menu_entries[2], menu_entries[1] end -- Alex From owner-svn-src-all@freebsd.org Mon Feb 19 22:09:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5FFFF030EC; Mon, 19 Feb 2018 22:09:27 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BBCD6E754; Mon, 19 Feb 2018 22:09:27 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f46.google.com with SMTP id v9so1467446lfa.11; Mon, 19 Feb 2018 14:09:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4PA1VORV5uOfS+aZUqkVnJxBydoKf/Be8fBPyE05NG4=; b=YHWd4aWiFVtGSYv3q2cK+et8Y8Y+bJNUbVNI7j/zU31bZLl8WA+gAucJFkLLuI6Vjd l+50UWd9HqeSClM8P+RuCvGjRZWjQoJD8GcSA76Uf9K9lOTn4CmlUx8bzoS82ySy8XnH afns8c97WzuVFwQ5/npplVbFwLsKFutwc5eKAPQqzzgHURPFDBwdjwYCyJMJLVhR2dbo 8J/UJ+49yQ+3MU0/7iC2YI0F49zh/PyP9atVhWcjov35Hak7kvtuKckEu9za0u6MmRS3 DqIhGjEB4kXzzlCydNQii6yw9Q/lZyZ+8oi1aRBRhTjeIyF3zg4WqtMGKiyvFv8ENoVF ybAQ== X-Gm-Message-State: APf1xPBeS1do4oTa8OanWfhOiTPxIcZSJduMk/2qkKjzD4gCdkjI7zCD r2HH7lC7SpGsi7s/EzxOMXdlECHk X-Google-Smtp-Source: AH8x226p/x+ZLP4xKRqFWDi+t86AnRavxO1si/L4bA1yOGx7QRRGmzJrD5ys6NuBsJf8NGxNuAJQ2A== X-Received: by 10.25.234.75 with SMTP id i72mr355666lfh.65.1519078159846; Mon, 19 Feb 2018 14:09:19 -0800 (PST) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com. [209.85.215.42]) by smtp.gmail.com with ESMTPSA id b82sm2275249lfl.9.2018.02.19.14.09.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 14:09:19 -0800 (PST) Received: by mail-lf0-f42.google.com with SMTP id y19so1494124lfd.4; Mon, 19 Feb 2018 14:09:19 -0800 (PST) X-Received: by 10.46.88.84 with SMTP id x20mr11082681ljd.44.1519078159447; Mon, 19 Feb 2018 14:09:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Mon, 19 Feb 2018 14:08:58 -0800 (PST) In-Reply-To: <20180219215453.GA10409@neva> References: <201802191634.w1JGYNAE003191@repo.freebsd.org> <20180219215453.GA10409@neva> From: Kyle Evans Date: Mon, 19 Feb 2018 16:08:58 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329585 - head/stand/lua To: Alexander Nasonov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:09:28 -0000 On Mon, Feb 19, 2018 at 3:54 PM, Alexander Nasonov wrote: > Kyle Evans wrote: >> +function core.isSingleUserBoot() >> + local single_user = loader.getenv("boot_single"); >> + return single_user ~= nil and single_user:lower() == "yes"; >> +end > > Just curious, why do you end all lines with semi-colons? It's not very > common in Lua code. > These scripts had a mixture of both styles when I started working on this, and I wanted to make it consistent. I was naturally adding semicolons to most statements as a habit from all of the other C we use, so it was the most natural style for the transition; especially given that it causes no harm. We can always change it later, but it has been kind of a useful style rule in some of the grepping I've done to figure out how we use things. It's an easy way to separate things out, since our general rule disallows semicolons after "end" and we of course don't use it for 'if' statements and some other odds and ends. From owner-svn-src-all@freebsd.org Mon Feb 19 22:09:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47539F0317E; Mon, 19 Feb 2018 22:09:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7D1D6E862; Mon, 19 Feb 2018 22:09:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C520020570; Mon, 19 Feb 2018 22:09:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JM9n0K072594; Mon, 19 Feb 2018 22:09:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JM9nlB072592; Mon, 19 Feb 2018 22:09:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802192209.w1JM9nlB072592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 19 Feb 2018 22:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329606 - in head/usr.bin/tail: . tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/usr.bin/tail: . tests X-SVN-Commit-Revision: 329606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:09:50 -0000 Author: asomers Date: Mon Feb 19 22:09:49 2018 New Revision: 329606 URL: https://svnweb.freebsd.org/changeset/base/329606 Log: tail: fix "tail -r" for piped input that begins with '\n' A subtle logic bug, probably introduced in r311895, caused tail to print the first two lines of piped input in forward order, if the very first character was a newline. PR: 222671 Reported by: Jim Long , pprocacci@gmail.com MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/usr.bin/tail/reverse.c head/usr.bin/tail/tests/tail_test.sh Modified: head/usr.bin/tail/reverse.c ============================================================================== --- head/usr.bin/tail/reverse.c Mon Feb 19 22:00:02 2018 (r329605) +++ head/usr.bin/tail/reverse.c Mon Feb 19 22:09:49 2018 (r329606) @@ -257,10 +257,13 @@ r_buf(FILE *fp, const char *fn) if ((*p == '\n') || start) { struct bfelem *tr; - if (start && llen) + if (llen && start && *p != '\n') WR(p, llen + 1); - else if (llen) + else if (llen) { WR(p + 1, llen); + if (start && *p == '\n') + WR(p, 1); + } tr = TAILQ_NEXT(tl, entries); llen = 0; if (tr != NULL) { Modified: head/usr.bin/tail/tests/tail_test.sh ============================================================================== --- head/usr.bin/tail/tests/tail_test.sh Mon Feb 19 22:00:02 2018 (r329605) +++ head/usr.bin/tail/tests/tail_test.sh Mon Feb 19 22:09:49 2018 (r329606) @@ -83,6 +83,27 @@ HERE atf_check cmp expectfile outpipe } +# Regression test for PR 222671 +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222671 +atf_test_case pipe_leading_newline_r +pipe_leading_newline_r_head() +{ + atf_set "descr" "Reverse a pipe whose first character is a newline" +} +pipe_leading_newline_r_body() +{ + cat > expectfile << HERE +3 +2 +1 + +HERE + printf '\n1\n2\n3\n' | tail -r > outfile + printf '\n1\n2\n3\n' | tail -r > outpipe + atf_check cmp expectfile outfile + atf_check cmp expectfile outpipe +} + atf_test_case file_rc28 file_rc28_head() { @@ -105,6 +126,28 @@ HERE atf_check cmp expectfile outpipe } +atf_test_case file_rc28 +file_rc28_head() +{ + atf_set "descr" "Reverse a file and display the last 28 characters" +} +file_rc28_body() +{ + cat > infile < expectfile << HERE +This is the third line +line +HERE + tail -rc28 infile > outfile + tail -rc28 < infile > outpipe + atf_check cmp expectfile outfile + atf_check cmp expectfile outpipe +} + atf_test_case longfile_r longfile_r_head() { @@ -235,6 +278,7 @@ atf_init_test_cases() atf_add_test_case file_r atf_add_test_case file_rc28 atf_add_test_case file_rn2 + atf_add_test_case pipe_leading_newline_r # The longfile tests are designed to exercise behavior in r_buf(), # which operates on 128KB blocks atf_add_test_case longfile_r From owner-svn-src-all@freebsd.org Mon Feb 19 22:13:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA26CF03756; Mon, 19 Feb 2018 22:13:52 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A59E6ED56; Mon, 19 Feb 2018 22:13:52 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f48.google.com with SMTP id r80so1477769lfe.13; Mon, 19 Feb 2018 14:13:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XJ4JwUC8hCCIjFMQAXovJAvQj/9NijwpWip1/lmYrz0=; b=UDDCJa8XAvHQ2G57UuLfiTFt8QLjqe6ApAqzI/aszaDMOhK3LyF2oYIkE03sW2Q7VE PsgL8u3WHg6OyqicYgRPYezxmrwf6FVQKHnPEJs3ZixNdSFCBJK8HugRrBp2+JFZ/nY9 pgcMEDtM2Qf6J5HDTxhPB5lBvTf5RZwMSUlXjVy0rbE4u9jTzuScP+nDN++EZ5zQp3hb WOCXpvb3Ii04Wqx/RhpPPVX6oXP2Bg6/ILTQQzYuouDXnFY9u01nt8ASWtO2WEUudMra JaMzFW2jBYbEOEZafPAsUUMEj450+D5ezGKvSrGQDBFzG8/nhgpG2QGkitNNe0oOWLpl yD0Q== X-Gm-Message-State: APf1xPBbIYmCbXwAuOE1xWqh3Q/N9/O6qMb5sOy0E1Yor/ptPStS2yCT LTHLTnOXWFLQunu6o1Bu4nGFHkbL X-Google-Smtp-Source: AH8x225hFrLD1yF1ZJRJ7tKdZ9PkHKbFUsVK41yVxZccyiQmREkLDi/33aJqM0I0ztDI51UlJ+Ec3A== X-Received: by 10.25.239.10 with SMTP id n10mr10252872lfh.8.1519078424100; Mon, 19 Feb 2018 14:13:44 -0800 (PST) Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com. [209.85.215.43]) by smtp.gmail.com with ESMTPSA id g24sm1324298lje.97.2018.02.19.14.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 14:13:44 -0800 (PST) Received: by mail-lf0-f43.google.com with SMTP id y19so1506442lfd.4; Mon, 19 Feb 2018 14:13:43 -0800 (PST) X-Received: by 10.46.88.84 with SMTP id x20mr11088723ljd.44.1519078423776; Mon, 19 Feb 2018 14:13:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Mon, 19 Feb 2018 14:13:23 -0800 (PST) In-Reply-To: <20180219220001.GA12274@neva> References: <201802191636.w1JGaTci003687@repo.freebsd.org> <20180219220001.GA12274@neva> From: Kyle Evans Date: Mon, 19 Feb 2018 16:13:23 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329587 - head/stand/lua To: Alexander Nasonov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:13:53 -0000 On Mon, Feb 19, 2018 at 4:00 PM, Alexander Nasonov wrote: > Kyle Evans wrote: >> + -- Swap the first two menu items on single user boot >> + if (core.isSingleUserBoot()) then >> + local multiuser = menu_entries[1]; >> + local singleuser = menu_entries[2]; >> + >> + menu_entries[2] = multiuser; >> + menu_entries[1] = singleuser; >> + end > > -- Swap the first two menu items on single user boot > if core.isSingleUserBoot() then > menu_entries[1], menu_entries[2] = > menu_entries[2], menu_entries[1] > end > Noted. I ended up expanding this section a little bit later (see: r329593) and I'm not sure how I feel about the look of this one: -- Shallow copy the table menu_entries = core.shallowCopyTable(menu_entries); menu_entries[1], menu_entries[2] = menu_entries[2], menu_entries[1]; menu_entries[1].name, menu_entries[2].name = menu_entries[1].alternate_name, menu_entries[2].alternate_name; I'll need to sit on that one for a little bit. =) From owner-svn-src-all@freebsd.org Mon Feb 19 22:29:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26B71F04987; Mon, 19 Feb 2018 22:29:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C989D6F9FF; Mon, 19 Feb 2018 22:29:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C03A12089B; Mon, 19 Feb 2018 22:29:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JMTGtn082625; Mon, 19 Feb 2018 22:29:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JMTG9C082624; Mon, 19 Feb 2018 22:29:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802192229.w1JMTG9C082624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 22:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329609 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:29:17 -0000 Author: kevans Date: Mon Feb 19 22:29:16 2018 New Revision: 329609 URL: https://svnweb.freebsd.org/changeset/base/329609 Log: stand/lua: Cache swapped menu, and don't create locals for swapping Building the swapped welcome menu (first two items swapped) is kind of a sluggish, because it requires a full (recrusive) shallow copy of the welcome menu. Cache the result of that and re-use it later, instead of building it everytime. While here, don't create temporary locals just for swapping. The following is just as good: x, y = y, x; Reported by: Alexander Nasonov (swapping) Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 22:22:35 2018 (r329608) +++ head/stand/lua/menu.lua Mon Feb 19 22:29:16 2018 (r329609) @@ -138,17 +138,22 @@ menu.welcome = { local menu_entries = menu.welcome.all_entries; -- Swap the first two menu items on single user boot if (core.isSingleUserBoot()) then + -- We'll cache the swapped menu, for performance + if (menu.welcome.swapped_menu ~= nil) then + return menu.welcome.swapped_menu; + end -- Shallow copy the table menu_entries = core.shallowCopyTable(menu_entries); - local multiuser = menu_entries[1]; - local singleuser = menu_entries[2]; + -- Swap the first two menu entries + menu_entries[1], menu_entries[2] = menu_entries[2], + menu_entries[1]; - multiuser.name = multiuser.alternate_name; - singleuser.name = singleuser.alternate_name; - - menu_entries[2] = multiuser; - menu_entries[1] = singleuser; + -- Then set their names to their alternate names + menu_entries[1].name, menu_entries[2].name = + menu_entries[1].alternate_name, + menu_entries[2].alternate_name; + menu.welcome.swapped_menu = menu_entries; end return menu_entries; end, From owner-svn-src-all@freebsd.org Mon Feb 19 22:37:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88380F053E3 for ; Mon, 19 Feb 2018 22:37:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14CF37024C for ; Mon, 19 Feb 2018 22:37:11 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 56ffe470-15c5-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 56ffe470-15c5-11e8-b951-f99fef315fd9; Mon, 19 Feb 2018 22:36:35 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w1JMb4Po055894; Mon, 19 Feb 2018 15:37:04 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1519079823.91697.30.camel@freebsd.org> Subject: Re: svn commit: r329609 - head/stand/lua From: Ian Lepore To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 19 Feb 2018 15:37:03 -0700 In-Reply-To: <201802192229.w1JMTG9C082624@repo.freebsd.org> References: <201802192229.w1JMTG9C082624@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:37:12 -0000 On Mon, 2018-02-19 at 22:29 +0000, Kyle Evans wrote: > > +                       -- Swap the first two menu entries > +                       menu_entries[1], menu_entries[2] = menu_entries[2], > +                           menu_entries[1]; >   IMO, this is the sort of unreadable insanity that comes from having inflexible rules about line-wrapping which trump readability.  The original code could be easily understood.  The suggested replacement,  menu_entries[1], menu_entries[2] =     menu_entries[2], menu_entries[1] Was also pretty readable, although not as much as it would be if it were all on one line.  But splitting the line at the whitespace nearest to 80 columns just creates an unreadable mess for the insignificant virtue of following some arbitrary rule.  (Which is why I very often ignore that rule and split lines at the point < 80 which makes the most sense for understanding the code, even if that means splitting at column 30.) -- Ian From owner-svn-src-all@freebsd.org Mon Feb 19 22:42:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23625F05AAF; Mon, 19 Feb 2018 22:42:08 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87569707F6; Mon, 19 Feb 2018 22:42:07 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f46.google.com with SMTP id t79so1585445lfe.3; Mon, 19 Feb 2018 14:42:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1aUBe4GvRVzyhF30GXSS86cIP+MeXMGkRIUmAlWr2MY=; b=lDedTD1UZxvhaMu6Fr12KSzh5xBZL7tPfpYUyD1WfVp2kCNAx8MmqMMP9vAB49q5BV TcNw9vSS7oHtyxSBBfRUYKwmtI3sPjNr6PgTb8DdLC7JxmJNO5b1wa+YSs/ZDpnRUHYZ ZdJTvAyo+X+XPo9BeZZLdYvPkn1X398q6A+8Y38frX88+LnBqOJYORzTLP5AafnNFpYX scEJr4ynUDM+Vei7w3QOL5IUNKqRnzon+hBsELE+AApXGPQ+a2Vch7BhZ7owdRmVMrcu NLWEUqaghllYSfcafB047AdT1Xo++utyVrzjkm5RvKHwd0rukqB5xfiLp/DfGxGH9Pfz fPWg== X-Gm-Message-State: APf1xPB1uwU8U4Q5Rti6XAzVEjQJed7k0ntxKzv0GPCYs53SJ8xagB4l 4YKepQGWJ31HfTw9PBfhuThuhY+T X-Google-Smtp-Source: AH8x224m6Y4B1qp5LLN5TJ4N2J8LT6WSiRVw3hMW2q7teLfHkI/K/mOjjLbKqnWRHmO+SnNZVFk17A== X-Received: by 10.46.41.90 with SMTP id u87mr741771lje.112.1519080125514; Mon, 19 Feb 2018 14:42:05 -0800 (PST) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id 22sm2380731ljj.9.2018.02.19.14.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 14:42:05 -0800 (PST) Received: by mail-lf0-f46.google.com with SMTP id l191so1603660lfe.1; Mon, 19 Feb 2018 14:42:05 -0800 (PST) X-Received: by 10.25.143.27 with SMTP id r27mr11711224lfd.129.1519080125177; Mon, 19 Feb 2018 14:42:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Mon, 19 Feb 2018 14:41:44 -0800 (PST) In-Reply-To: <1519079823.91697.30.camel@freebsd.org> References: <201802192229.w1JMTG9C082624@repo.freebsd.org> <1519079823.91697.30.camel@freebsd.org> From: Kyle Evans Date: Mon, 19 Feb 2018 16:41:44 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329609 - head/stand/lua To: Ian Lepore Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:42:08 -0000 On Mon, Feb 19, 2018 at 4:37 PM, Ian Lepore wrote: > On Mon, 2018-02-19 at 22:29 +0000, Kyle Evans wrote: >> >> + -- Swap the first two menu entries >> + menu_entries[1], menu_entries[2] = menu_entries[2], >> + menu_entries[1]; >> > > IMO, this is the sort of unreadable insanity that comes from having > inflexible rules about line-wrapping which trump readability. The > original code could be easily understood. The suggested replacement, > > menu_entries[1], menu_entries[2] = > menu_entries[2], menu_entries[1] > > Was also pretty readable, although not as much as it would be if it > were all on one line. But splitting the line at the whitespace nearest > to 80 columns just creates an unreadable mess for the insignificant > virtue of following some arbitrary rule. (Which is why I very often > ignore that rule and split lines at the point < 80 which makes the most > sense for understanding the code, even if that means splitting at > column 30.) > Right, perhaps we should clarify this while the opportunity is ripe for style.lua(9) into something more like "80 columns are preferred, wrapping may occur much earlier than 80 columns." I blindly followed it here because we hadn't discussed any exception to it previously, but I think we're more likely in Lua to run into scenarios where the current guideline just isn't appropriate. From owner-svn-src-all@freebsd.org Mon Feb 19 22:54:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F4F0F06B3D; Mon, 19 Feb 2018 22:54:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 008E0712BD; Mon, 19 Feb 2018 22:54:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFA3C20D7A; Mon, 19 Feb 2018 22:54:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JMsA8w097550; Mon, 19 Feb 2018 22:54:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JMsAsK097549; Mon, 19 Feb 2018 22:54:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802192254.w1JMsAsK097549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 22:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329610 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 329610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:54:11 -0000 Author: kevans Date: Mon Feb 19 22:54:10 2018 New Revision: 329610 URL: https://svnweb.freebsd.org/changeset/base/329610 Log: style.lua(9): Note that wrapping at 80-columns is not rigid Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 ============================================================================== --- head/share/man/man9/style.lua.9 Mon Feb 19 22:29:16 2018 (r329609) +++ head/share/man/man9/style.lua.9 Mon Feb 19 22:54:10 2018 (r329610) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 18, 2018 +.Dd February 19, 2018 .Dt STYLE.LUA 9 .Os .Sh NAME @@ -66,6 +66,8 @@ is generally avoided. .Pp Indentation and wrapping should match the guidelines provided by .Xr style 9 . +Do note that it is ok to wrap much earlier than 80 columns if readability would +otherwise suffer. .Pp Statements should be terminated with a semicolon. .Ic end From owner-svn-src-all@freebsd.org Mon Feb 19 22:56:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA1FFF06DAE; Mon, 19 Feb 2018 22:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 599CA7148D; Mon, 19 Feb 2018 22:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FDBB20D7B; Mon, 19 Feb 2018 22:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1JMu5UH097683; Mon, 19 Feb 2018 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1JMu5cM097682; Mon, 19 Feb 2018 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802192256.w1JMu5cM097682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 19 Feb 2018 22:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329611 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 22:56:06 -0000 Author: kevans Date: Mon Feb 19 22:56:04 2018 New Revision: 329611 URL: https://svnweb.freebsd.org/changeset/base/329611 Log: stand/lua: Wrap tuple assignment earlier for readability Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Mon Feb 19 22:54:10 2018 (r329610) +++ head/stand/lua/menu.lua Mon Feb 19 22:56:04 2018 (r329611) @@ -146,8 +146,8 @@ menu.welcome = { menu_entries = core.shallowCopyTable(menu_entries); -- Swap the first two menu entries - menu_entries[1], menu_entries[2] = menu_entries[2], - menu_entries[1]; + menu_entries[1], menu_entries[2] = + menu_entries[2], menu_entries[1]; -- Then set their names to their alternate names menu_entries[1].name, menu_entries[2].name = From owner-svn-src-all@freebsd.org Mon Feb 19 23:04:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AC0FF076FE for ; Mon, 19 Feb 2018 23:04:40 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 835DB71AAF for ; Mon, 19 Feb 2018 23:04:39 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 2f8d2f57-15c9-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 2f8d2f57-15c9-11e8-b951-f99fef315fd9; Mon, 19 Feb 2018 23:04:07 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w1JN4ZEu055971; Mon, 19 Feb 2018 16:04:35 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1519081475.91697.32.camel@freebsd.org> Subject: Re: svn commit: r329610 - head/share/man/man9 From: Ian Lepore To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 19 Feb 2018 16:04:35 -0700 In-Reply-To: <201802192254.w1JMsAsK097549@repo.freebsd.org> References: <201802192254.w1JMsAsK097549@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 23:04:40 -0000 On Mon, 2018-02-19 at 22:54 +0000, Kyle Evans wrote: > Author: kevans > Date: Mon Feb 19 22:54:10 2018 > New Revision: 329610 > URL: https://svnweb.freebsd.org/changeset/base/329610 > > Log: >   style.lua(9): Note that wrapping at 80-columns is not rigid > > > [...] > +Do note that it is ok to wrap much earlier than 80 columns if readability would > +otherwise suffer. > Cool. Now if we could just get the same change to style(9) for C... :) -- Ian From owner-svn-src-all@freebsd.org Mon Feb 19 23:57:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45AACF0B03D; Mon, 19 Feb 2018 23:57:11 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::600]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C27F3736D9; Mon, 19 Feb 2018 23:57:10 +0000 (UTC) (envelope-from alnsn@yandex.ru) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 6B1C52A219A7; Tue, 20 Feb 2018 02:57:08 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id K3jJSKOwIQ-v8nuSqkL; Tue, 20 Feb 2018 02:57:08 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519084628; bh=i3oq4H/TJdplbxQ4ApfY5XkRnQNlcr4GsXENzD/mup4=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=sZziPevSJVlq2mUxQxCqwNL3AKUCktCdA0tzWzJAKuVg5wZHUNkNQy2Hy73BpM7cP IFGHWdyPhV/9Vht0AuFUKlS3BtcL+koNNJkJlBQbTCnlYC+pegc8JS3s18o6iHPybH p/lSiSNYdf7ru5YZRjfZmZwbo9BPJ/6FoMI7F8qc= Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6ryCWDVlxz-v6eqs3JS; Tue, 20 Feb 2018 02:57:06 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1519084627; bh=i3oq4H/TJdplbxQ4ApfY5XkRnQNlcr4GsXENzD/mup4=; h=Date:From:To:Cc:Subject:Message-ID:References:In-Reply-To; b=QaaOfMHQ9eVCN4daglXjg5Myf6ziWMR2OwkaCSmIZK7CfWvUaNRDKqqO7iqAQLehZ nN5sqDllSLuTzSUEJ7j0f3uofSfAdLheNuXaYWT4HeSf9fkVmmOH9UfIuKak29Xlm6 +fXolBPzvId7LRGXrLy9TKnUraMOQxbalZoWaezc= Authentication-Results: smtp2o.mail.yandex.net; dkim=pass header.i=@yandex.ru Date: Mon, 19 Feb 2018 23:57:04 +0000 From: Alexander Nasonov To: Ian Lepore Cc: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329609 - head/stand/lua Message-ID: <20180219235704.GB24491@neva> References: <201802192229.w1JMTG9C082624@repo.freebsd.org> <1519079823.91697.30.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519079823.91697.30.camel@freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 23:57:11 -0000 Ian Lepore wrote: > On Mon, 2018-02-19 at 22:29 +0000, Kyle Evans wrote: > > > > +???????????????????????-- Swap the first two menu entries > > +???????????????????????menu_entries[1], menu_entries[2] = menu_entries[2], > > +?????????????????????????? menu_entries[1]; > > ? > > IMO, this is the sort of unreadable insanity that comes from having > inflexible rules about line-wrapping which trump readability. ?The > original code could be easily understood. ?The suggested replacement,? > > menu_entries[1], menu_entries[2] = > ? ? menu_entries[2], menu_entries[1] > > Was also pretty readable, although not as much as it would be if it > were all on one line. ?But splitting the line at the whitespace nearest > to 80 columns just creates an unreadable mess for the insignificant > virtue of following some arbitrary rule. ?(Which is why I very often > ignore that rule and split lines at the point < 80 which makes the most > sense for understanding the code, even if that means splitting at > column 30.) +1 Other possibilities are: - moving code to a helper function often removes extra indentation - shorter identifiers (e.g. as a side effect of moving code to a helper function) local function swap_1_2(t) t[1], t[2] = t[2], t[1] end swap_1_2(menu_entries) or local function swap(t, i, j) t[i], t[j] = t[j], t[i] end swap(menu_entries, 1, 2) -- Alex From owner-svn-src-all@freebsd.org Tue Feb 20 00:06:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D13EFF0BD27; Tue, 20 Feb 2018 00:06:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83DE773D5C; Tue, 20 Feb 2018 00:06:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E88221897; Tue, 20 Feb 2018 00:06:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K067oB032313; Tue, 20 Feb 2018 00:06:07 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K067ZL032311; Tue, 20 Feb 2018 00:06:07 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802200006.w1K067ZL032311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 20 Feb 2018 00:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329612 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 329612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 00:06:08 -0000 Author: jeff Date: Tue Feb 20 00:06:07 2018 New Revision: 329612 URL: https://svnweb.freebsd.org/changeset/base/329612 Log: Further parallelize the buffer cache. Provide multiple clean queues partitioned into 'domains'. Each domain manages its own bufspace and has its own bufspace daemon. Each domain has a set of subqueues indexed by the current cpuid to reduce lock contention on the cleanq. Refine the sleep/wakeup around the bufspace daemon to use atomics as much as possible. Add a B_REUSE flag that is used to requeue bufs during the scan to approximate LRU rather than locking the queue on every use of a frequently accessed buf. Implement bufspace_reserve with only atomic_fetchadd to avoid loop restarts. Reviewed by: markj Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14274 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c head/sys/sys/buf.h head/sys/sys/bufobj.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Feb 19 22:56:04 2018 (r329611) +++ head/sys/kern/vfs_bio.c Tue Feb 20 00:06:07 2018 (r329612) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -105,7 +106,6 @@ caddr_t unmapped_buf; /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ struct proc *bufdaemonproc; -struct proc *bufspacedaemonproc; static int inmem(struct vnode *vp, daddr_t blkno); static void vm_hold_free_pages(struct buf *bp, int newbsize); @@ -124,11 +124,8 @@ static int vfs_bio_clcheck(struct vnode *vp, int size, static void breada(struct vnode *, daddr_t *, int *, int, struct ucred *, int, void (*)(struct buf *)); static int buf_flush(struct vnode *vp, int); -static int buf_recycle(bool); -static int buf_scan(bool); static int flushbufqueues(struct vnode *, int, int); static void buf_daemon(void); -static void bremfreel(struct buf *bp); static __inline void bd_wakeup(void); static int sysctl_runningspace(SYSCTL_HANDLER_ARGS); static void bufkva_reclaim(vmem_t *, int); @@ -137,28 +134,17 @@ static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); -#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) static int sysctl_bufspace(SYSCTL_HANDLER_ARGS); -#endif - int vmiodirenable = TRUE; SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0, "Use the VM system for directory writes"); long runningbufspace; SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0, "Amount of presently outstanding async buffer io"); -static long bufspace; -#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, - &bufspace, 0, sysctl_bufspace, "L", "Virtual memory used for buffers"); -#else -SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, - "Physical memory used for buffers"); -#endif -static long bufkvaspace; -SYSCTL_LONG(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, 0, + NULL, 0, sysctl_bufspace, "L", "Physical memory used for buffers"); +static counter_u64_t bufkvaspace; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, "Kernel virtual memory used for buffers"); static long maxbufspace; SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RW, &maxbufspace, 0, @@ -178,11 +164,11 @@ SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RW, &h long bufspacethresh; SYSCTL_LONG(_vfs, OID_AUTO, bufspacethresh, CTLFLAG_RW, &bufspacethresh, 0, "Bufspace consumed before waking the daemon to free some"); -static int buffreekvacnt; -SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, 0, +static counter_u64_t buffreekvacnt; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, "Number of times we have freed the KVA space from some buffer"); -static int bufdefragcnt; -SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, 0, +static counter_u64_t bufdefragcnt; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, "Number of times we have had to repeat buffer allocation to defragment"); static long lorunningspace; SYSCTL_PROC(_vfs, OID_AUTO, lorunningspace, CTLTYPE_LONG | CTLFLAG_MPSAFE | @@ -225,24 +211,26 @@ SYSCTL_INT(_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RW, static int hifreebuffers; SYSCTL_INT(_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RW, &hifreebuffers, 0, "Threshold for clean buffer recycling"); -static int getnewbufcalls; -SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW, &getnewbufcalls, 0, - "Number of calls to getnewbuf"); -static int getnewbufrestarts; -SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, &getnewbufrestarts, 0, +static counter_u64_t getnewbufcalls; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, + &getnewbufcalls, "Number of calls to getnewbuf"); +static counter_u64_t getnewbufrestarts; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RD, + &getnewbufrestarts, "Number of times getnewbuf has had to restart a buffer acquisition"); -static int mappingrestarts; -SYSCTL_INT(_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RW, &mappingrestarts, 0, +static counter_u64_t mappingrestarts; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RD, + &mappingrestarts, "Number of times getblk has had to restart a buffer mapping for " "unmapped buffer"); -static int numbufallocfails; -SYSCTL_INT(_vfs, OID_AUTO, numbufallocfails, CTLFLAG_RW, &numbufallocfails, 0, - "Number of times buffer allocations failed"); +static counter_u64_t numbufallocfails; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, numbufallocfails, CTLFLAG_RW, + &numbufallocfails, "Number of times buffer allocations failed"); static int flushbufqtarget = 100; SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0, "Amount of work to do in flushbufqueues when helping bufdaemon"); -static long notbufdflushes; -SYSCTL_LONG(_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, ¬bufdflushes, 0, +static counter_u64_t notbufdflushes; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, ¬bufdflushes, "Number of dirty buffer flushes done by the bufdaemon helpers"); static long barrierwrites; SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, &barrierwrites, 0, @@ -266,11 +254,6 @@ static struct mtx_padalign __exclusive_cache_line bdlo static struct mtx_padalign __exclusive_cache_line rbreqlock; /* - * Lock that protects needsbuffer and the sleeps/wakeups surrounding it. - */ -static struct rwlock_padalign __exclusive_cache_line nblock; - -/* * Lock that protects bdirtywait. */ static struct mtx_padalign __exclusive_cache_line bdirtylock; @@ -283,11 +266,6 @@ static struct mtx_padalign __exclusive_cache_line bdir static int bd_request; /* - * Request/wakeup point for the bufspace daemon. - */ -static int bufspace_request; - -/* * Request for the buf daemon to write more buffers than is indicated by * lodirtybuf. This may be necessary to push out excess dependencies or * defragment the address space where a simple count of the number of dirty @@ -302,15 +280,6 @@ static int bd_speedupreq; */ static int runningbufreq; -/* - * Synchronization (sleep/wakeup) variable for buffer requests. - * Can contain the VFS_BIO_NEED flags defined below; setting/clearing is done - * by and/or. - * Used in numdirtywakeup(), bufspace_wakeup(), bwillwrite(), - * getnewbuf(), and getblk(). - */ -static volatile int needsbuffer; - /* * Synchronization for bwillwrite() waiters. */ @@ -323,29 +292,69 @@ static int bdirtywait; #define QUEUE_EMPTY 1 /* empty buffer headers */ #define QUEUE_DIRTY 2 /* B_DELWRI buffers */ #define QUEUE_CLEAN 3 /* non-B_DELWRI buffers */ -#define QUEUE_SENTINEL 1024 /* not an queue index, but mark for sentinel */ +#define QUEUE_SENTINEL 4 /* not an queue index, but mark for sentinel */ -/* Maximum number of clean buffer queues. */ -#define CLEAN_QUEUES 16 +struct bufqueue { + struct mtx_padalign bq_lock; + TAILQ_HEAD(, buf) bq_queue; + uint8_t bq_index; + uint16_t bq_subqueue; + int bq_len; +} __aligned(CACHE_LINE_SIZE); +#define BQ_LOCKPTR(bq) (&(bq)->bq_lock) +#define BQ_LOCK(bq) mtx_lock(BQ_LOCKPTR((bq))) +#define BQ_UNLOCK(bq) mtx_unlock(BQ_LOCKPTR((bq))) +#define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) + +struct bufqueue __exclusive_cache_line bqempty; +struct bufqueue __exclusive_cache_line bqdirty; + +struct bufdomain { + struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue *bd_cleanq; + struct mtx_padalign bd_run_lock; + /* Constants */ + long bd_maxbufspace; + long bd_hibufspace; + long bd_lobufspace; + long bd_bufspacethresh; + int bd_hifreebuffers; + int bd_lofreebuffers; + int bd_lim; + /* atomics */ + int bd_wanted; + int __aligned(CACHE_LINE_SIZE) bd_running; + long __aligned(CACHE_LINE_SIZE) bd_bufspace; + int __aligned(CACHE_LINE_SIZE) bd_freebuffers; +} __aligned(CACHE_LINE_SIZE); + +#define BD_LOCKPTR(bd) (&(bd)->bd_cleanq->bq_lock) +#define BD_LOCK(bd) mtx_lock(BD_LOCKPTR((bd))) +#define BD_UNLOCK(bd) mtx_unlock(BD_LOCKPTR((bd))) +#define BD_ASSERT_LOCKED(bd) mtx_assert(BD_LOCKPTR((bd)), MA_OWNED) +#define BD_RUN_LOCKPTR(bd) (&(bd)->bd_run_lock) +#define BD_RUN_LOCK(bd) mtx_lock(BD_RUN_LOCKPTR((bd))) +#define BD_RUN_UNLOCK(bd) mtx_unlock(BD_RUN_LOCKPTR((bd))) +#define BD_DOMAIN(bd) (bd - bdclean) + +/* Maximum number of clean buffer domains. */ +#define CLEAN_DOMAINS 8 + /* Configured number of clean queues. */ -static int clean_queues; +static int __read_mostly clean_domains; -/* Maximum number of buffer queues. */ -#define BUFFER_QUEUES (QUEUE_CLEAN + CLEAN_QUEUES) +struct bufdomain __exclusive_cache_line bdclean[CLEAN_DOMAINS]; -/* Queues for free buffers with various properties */ -static TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES] = { { 0 } }; -#ifdef INVARIANTS -static int bq_len[BUFFER_QUEUES]; -#endif +static void bq_remove(struct bufqueue *bq, struct buf *bp); +static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock); +static int buf_recycle(struct bufdomain *, bool kva); +static void bq_init(struct bufqueue *bq, int qindex, int cpu, + const char *lockname); +static void bd_init(struct bufdomain *bd); +static int bd_flushall(struct bufdomain *bd); /* - * Lock for each bufqueue - */ -static struct mtx_padalign __exclusive_cache_line bqlocks[BUFFER_QUEUES]; - -/* * per-cpu empty buffer cache. */ uma_zone_t buf_zone; @@ -391,46 +400,34 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) { long lvalue; int ivalue; + int i; + lvalue = 0; + for (i = 0; i < clean_domains; i++) + lvalue += bdclean[i].bd_bufspace; if (sizeof(int) == sizeof(long) || req->oldlen >= sizeof(long)) - return (sysctl_handle_long(oidp, arg1, arg2, req)); - lvalue = *(long *)arg1; + return (sysctl_handle_long(oidp, &lvalue, 0, req)); if (lvalue > INT_MAX) /* On overflow, still write out a long to trigger ENOMEM. */ return (sysctl_handle_long(oidp, &lvalue, 0, req)); ivalue = lvalue; return (sysctl_handle_int(oidp, &ivalue, 0, req)); } -#endif - +#else static int -bqcleanq(void) +sysctl_bufspace(SYSCTL_HANDLER_ARGS) { - static int nextq; + long lvalue; + int i; - return ((atomic_fetchadd_int(&nextq, 1) % clean_queues) + QUEUE_CLEAN); + lvalue = 0; + for (i = 0; i < clean_domains; i++) + lvalue += bdclean[i].bd_bufspace; + return (sysctl_handle_int(oidp, &lvalue, 0, req)); } +#endif -static int -bqisclean(int qindex) -{ - - return (qindex >= QUEUE_CLEAN && qindex < QUEUE_CLEAN + CLEAN_QUEUES); -} - /* - * bqlock: - * - * Return the appropriate queue lock based on the index. - */ -static inline struct mtx * -bqlock(int qindex) -{ - - return (struct mtx *)&bqlocks[qindex]; -} - -/* * bdirtywakeup: * * Wakeup any bwillwrite() waiters. @@ -481,47 +478,50 @@ bdirtyadd(void) } /* - * bufspace_wakeup: + * bufspace_daemon_wakeup: * - * Called when buffer space is potentially available for recovery. - * getnewbuf() will block on this flag when it is unable to free - * sufficient buffer space. Buffer space becomes recoverable when - * bp's get placed back in the queues. + * Wakeup the daemons responsible for freeing clean bufs. */ static void -bufspace_wakeup(void) +bufspace_daemon_wakeup(struct bufdomain *bd) { /* - * If someone is waiting for bufspace, wake them up. - * - * Since needsbuffer is set prior to doing an additional queue - * scan it is safe to check for the flag prior to acquiring the - * lock. The thread that is preparing to scan again before - * blocking would discover the buf we released. + * avoid the lock if the daemon is running. */ - if (needsbuffer) { - rw_rlock(&nblock); - if (atomic_cmpset_int(&needsbuffer, 1, 0) == 1) - wakeup(__DEVOLATILE(void *, &needsbuffer)); - rw_runlock(&nblock); + if (atomic_fetchadd_int(&bd->bd_running, 1) == 0) { + BD_RUN_LOCK(bd); + atomic_store_int(&bd->bd_running, 1); + wakeup(&bd->bd_running); + BD_RUN_UNLOCK(bd); } } /* - * bufspace_daemonwakeup: + * bufspace_daemon_wait: * - * Wakeup the daemon responsible for freeing clean bufs. + * Sleep until the domain falls below a limit or one second passes. */ static void -bufspace_daemonwakeup(void) +bufspace_daemon_wait(struct bufdomain *bd) { - rw_rlock(&nblock); - if (bufspace_request == 0) { - bufspace_request = 1; - wakeup(&bufspace_request); + /* + * Re-check our limits and sleep. bd_running must be + * cleared prior to checking the limits to avoid missed + * wakeups. The waker will adjust one of bufspace or + * freebuffers prior to checking bd_running. + */ + BD_RUN_LOCK(bd); + atomic_store_int(&bd->bd_running, 0); + if (bd->bd_bufspace < bd->bd_bufspacethresh && + bd->bd_freebuffers > bd->bd_lofreebuffers) { + msleep(&bd->bd_running, BD_RUN_LOCKPTR(bd), PRIBIO|PDROP, + "-", hz); + } else { + /* Avoid spurious wakeups while running. */ + atomic_store_int(&bd->bd_running, 1); + BD_RUN_UNLOCK(bd); } - rw_runlock(&nblock); } /* @@ -533,20 +533,22 @@ bufspace_daemonwakeup(void) static void bufspace_adjust(struct buf *bp, int bufsize) { + struct bufdomain *bd; long space; int diff; KASSERT((bp->b_flags & B_MALLOC) == 0, ("bufspace_adjust: malloc buf %p", bp)); + bd = &bdclean[bp->b_domain]; diff = bufsize - bp->b_bufsize; if (diff < 0) { - atomic_subtract_long(&bufspace, -diff); - bufspace_wakeup(); + atomic_subtract_long(&bd->bd_bufspace, -diff); } else { - space = atomic_fetchadd_long(&bufspace, diff); + space = atomic_fetchadd_long(&bd->bd_bufspace, diff); /* Wake up the daemon on the transition. */ - if (space < bufspacethresh && space + diff >= bufspacethresh) - bufspace_daemonwakeup(); + if (space < bd->bd_bufspacethresh && + space + diff >= bd->bd_bufspacethresh) + bufspace_daemon_wakeup(bd); } bp->b_bufsize = bufsize; } @@ -558,24 +560,25 @@ bufspace_adjust(struct buf *bp, int bufsize) * different space limit than data. */ static int -bufspace_reserve(int size, bool metadata) +bufspace_reserve(struct bufdomain *bd, int size, bool metadata) { - long limit; + long limit, new; long space; if (metadata) - limit = maxbufspace; + limit = bd->bd_maxbufspace; else - limit = hibufspace; - do { - space = bufspace; - if (space + size > limit) - return (ENOSPC); - } while (atomic_cmpset_long(&bufspace, space, space + size) == 0); + limit = bd->bd_hibufspace; + space = atomic_fetchadd_long(&bd->bd_bufspace, size); + new = space + size; + if (new > limit) { + atomic_subtract_long(&bd->bd_bufspace, size); + return (ENOSPC); + } /* Wake up the daemon on the transition. */ - if (space < bufspacethresh && space + size >= bufspacethresh) - bufspace_daemonwakeup(); + if (space < bd->bd_bufspacethresh && new >= bd->bd_bufspacethresh) + bufspace_daemon_wakeup(bd); return (0); } @@ -586,21 +589,22 @@ bufspace_reserve(int size, bool metadata) * Release reserved bufspace after bufspace_adjust() has consumed it. */ static void -bufspace_release(int size) +bufspace_release(struct bufdomain *bd, int size) { - atomic_subtract_long(&bufspace, size); - bufspace_wakeup(); + + atomic_subtract_long(&bd->bd_bufspace, size); } /* * bufspace_wait: * * Wait for bufspace, acting as the buf daemon if a locked vnode is - * supplied. needsbuffer must be set in a safe fashion prior to - * polling for space. The operation must be re-tried on return. + * supplied. bd_wanted must be set prior to polling for space. The + * operation must be re-tried on return. */ static void -bufspace_wait(struct vnode *vp, int gbflags, int slpflag, int slptimeo) +bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags, + int slpflag, int slptimeo) { struct thread *td; int error, fl, norunbuf; @@ -609,11 +613,11 @@ bufspace_wait(struct vnode *vp, int gbflags, int slpfl return; td = curthread; - rw_wlock(&nblock); - while (needsbuffer != 0) { + BD_LOCK(bd); + while (bd->bd_wanted) { if (vp != NULL && vp->v_type != VCHR && (td->td_pflags & TDP_BUFNEED) == 0) { - rw_wunlock(&nblock); + BD_UNLOCK(bd); /* * getblk() is called with a vnode locked, and * some majority of the dirty buffers may as @@ -636,18 +640,18 @@ bufspace_wait(struct vnode *vp, int gbflags, int slpfl td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF; fl = buf_flush(vp, flushbufqtarget); td->td_pflags &= norunbuf; - rw_wlock(&nblock); + BD_LOCK(bd); if (fl != 0) continue; - if (needsbuffer == 0) + if (bd->bd_wanted == 0) break; } - error = rw_sleep(__DEVOLATILE(void *, &needsbuffer), &nblock, + error = msleep(&bd->bd_wanted, BD_LOCKPTR(bd), (PRIBIO + 4) | slpflag, "newbuf", slptimeo); if (error != 0) break; } - rw_wunlock(&nblock); + BD_UNLOCK(bd); } @@ -659,10 +663,13 @@ bufspace_wait(struct vnode *vp, int gbflags, int slpfl * block nor work to reclaim buffers. */ static void -bufspace_daemon(void) +bufspace_daemon(void *arg) { + struct bufdomain *bd; + + bd = arg; for (;;) { - kproc_suspend_check(bufspacedaemonproc); + kproc_suspend_check(curproc); /* * Free buffers from the clean queue until we meet our @@ -689,46 +696,25 @@ bufspace_daemon(void) * which will inefficiently trade bufs with bqrelse * until we return to condition 2. */ - while (bufspace > lobufspace || - numfreebuffers < hifreebuffers) { - if (buf_recycle(false) != 0) { - atomic_set_int(&needsbuffer, 1); - if (buf_recycle(false) != 0) { - rw_wlock(&nblock); - if (needsbuffer) - rw_sleep(__DEVOLATILE(void *, - &needsbuffer), &nblock, - PRIBIO|PDROP, "bufspace", - hz/10); - else - rw_wunlock(&nblock); - } + do { + if (buf_recycle(bd, false) != 0) { + if (bd_flushall(bd)) + continue; + BD_LOCK(bd); + if (bd->bd_wanted) { + msleep(&bd->bd_wanted, BD_LOCKPTR(bd), + PRIBIO|PDROP, "bufspace", hz/10); + } else + BD_UNLOCK(bd); } maybe_yield(); - } + } while (bd->bd_bufspace > bd->bd_lobufspace || + bd->bd_freebuffers < bd->bd_hifreebuffers); - /* - * Re-check our limits under the exclusive nblock. - */ - rw_wlock(&nblock); - if (bufspace < bufspacethresh && - numfreebuffers > lofreebuffers) { - bufspace_request = 0; - rw_sleep(&bufspace_request, &nblock, PRIBIO|PDROP, - "-", hz); - } else - rw_wunlock(&nblock); + bufspace_daemon_wait(bd); } } -static struct kproc_desc bufspace_kp = { - "bufspacedaemon", - bufspace_daemon, - &bufspacedaemonproc -}; -SYSINIT(bufspacedaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, - &bufspace_kp); - /* * bufmallocadjust: * @@ -842,7 +828,7 @@ vfs_buf_test_cache(struct buf *bp, vm_ooffset_t foff, } /* Wake up the buffer daemon if necessary */ -static __inline void +static void bd_wakeup(void) { @@ -1038,19 +1024,12 @@ bufinit(void) KASSERT(maxbcachebuf >= MAXBSIZE, ("maxbcachebuf (%d) must be >= MAXBSIZE (%d)\n", maxbcachebuf, MAXBSIZE)); - mtx_init(&bqlocks[QUEUE_DIRTY], "bufq dirty lock", NULL, MTX_DEF); - mtx_init(&bqlocks[QUEUE_EMPTY], "bufq empty lock", NULL, MTX_DEF); - for (i = QUEUE_CLEAN; i < QUEUE_CLEAN + CLEAN_QUEUES; i++) - mtx_init(&bqlocks[i], "bufq clean lock", NULL, MTX_DEF); + bq_init(&bqempty, QUEUE_EMPTY, -1, "bufq empty lock"); + bq_init(&bqdirty, QUEUE_DIRTY, -1, "bufq dirty lock"); mtx_init(&rbreqlock, "runningbufspace lock", NULL, MTX_DEF); - rw_init(&nblock, "needsbuffer lock"); mtx_init(&bdlock, "buffer daemon lock", NULL, MTX_DEF); mtx_init(&bdirtylock, "dirty buf lock", NULL, MTX_DEF); - /* next, make a null set of free lists */ - for (i = 0; i < BUFFER_QUEUES; i++) - TAILQ_INIT(&bufqueues[i]); - unmapped_buf = (caddr_t)kva_alloc(MAXPHYS); /* finally, initialize each buffer header and stick on empty q */ @@ -1060,15 +1039,14 @@ bufinit(void) bp->b_flags = B_INVAL; bp->b_rcred = NOCRED; bp->b_wcred = NOCRED; - bp->b_qindex = QUEUE_EMPTY; + bp->b_qindex = QUEUE_NONE; + bp->b_domain = -1; + bp->b_subqueue = mp_ncpus; bp->b_xflags = 0; bp->b_data = bp->b_kvabase = unmapped_buf; LIST_INIT(&bp->b_dep); BUF_LOCKINIT(bp); - TAILQ_INSERT_TAIL(&bufqueues[QUEUE_EMPTY], bp, b_freelist); -#ifdef INVARIANTS - bq_len[QUEUE_EMPTY]++; -#endif + bq_insert(&bqempty, bp, false); } /* @@ -1150,8 +1128,31 @@ bufinit(void) * One queue per-256mb up to the max. More queues gives better * concurrency but less accurate LRU. */ - clean_queues = MIN(howmany(maxbufspace, 256*1024*1024), CLEAN_QUEUES); + clean_domains = MIN(howmany(maxbufspace, 256*1024*1024), CLEAN_DOMAINS); + for (i = 0 ; i < clean_domains; i++) { + struct bufdomain *bd; + bd = &bdclean[i]; + bd_init(bd); + bd->bd_freebuffers = nbuf / clean_domains; + bd->bd_hifreebuffers = hifreebuffers / clean_domains; + bd->bd_lofreebuffers = lofreebuffers / clean_domains; + bd->bd_bufspace = 0; + bd->bd_maxbufspace = maxbufspace / clean_domains; + bd->bd_hibufspace = hibufspace / clean_domains; + bd->bd_lobufspace = lobufspace / clean_domains; + bd->bd_bufspacethresh = bufspacethresh / clean_domains; + /* Don't allow more than 2% of bufs in the per-cpu caches. */ + bd->bd_lim = nbuf / clean_domains / 50 / mp_ncpus; + } + getnewbufcalls = counter_u64_alloc(M_WAITOK); + getnewbufrestarts = counter_u64_alloc(M_WAITOK); + mappingrestarts = counter_u64_alloc(M_WAITOK); + numbufallocfails = counter_u64_alloc(M_WAITOK); + notbufdflushes = counter_u64_alloc(M_WAITOK); + buffreekvacnt = counter_u64_alloc(M_WAITOK); + bufdefragcnt = counter_u64_alloc(M_WAITOK); + bufkvaspace = counter_u64_alloc(M_WAITOK); } #ifdef INVARIANTS @@ -1326,58 +1327,92 @@ bpmap_qenter(struct buf *bp) (vm_offset_t)(bp->b_offset & PAGE_MASK)); } +static struct bufqueue * +bufqueue(struct buf *bp) +{ + + switch (bp->b_qindex) { + case QUEUE_NONE: + /* FALLTHROUGH */ + case QUEUE_SENTINEL: + return (NULL); + case QUEUE_EMPTY: + return (&bqempty); + case QUEUE_DIRTY: + return (&bqdirty); + case QUEUE_CLEAN: + return (&bdclean[bp->b_domain].bd_subq[bp->b_subqueue]); + default: + break; + } + panic("bufqueue(%p): Unhandled type %d\n", bp, bp->b_qindex); +} + /* + * Return the locked bufqueue that bp is a member of. + */ +static struct bufqueue * +bufqueue_acquire(struct buf *bp) +{ + struct bufqueue *bq, *nbq; + + /* + * bp can be pushed from a per-cpu queue to the + * cleanq while we're waiting on the lock. Retry + * if the queues don't match. + */ + bq = bufqueue(bp); + BQ_LOCK(bq); + for (;;) { + nbq = bufqueue(bp); + if (bq == nbq) + break; + BQ_UNLOCK(bq); + BQ_LOCK(nbq); + bq = nbq; + } + return (bq); +} + +/* * binsfree: * - * Insert the buffer into the appropriate free list. + * Insert the buffer into the appropriate free list. Requires a + * locked buffer on entry and buffer is unlocked before return. */ static void binsfree(struct buf *bp, int qindex) { - struct mtx *olock, *nlock; + struct bufdomain *bd; + struct bufqueue *bq; - if (qindex != QUEUE_EMPTY) { - BUF_ASSERT_XLOCKED(bp); - } + KASSERT(qindex == QUEUE_CLEAN || qindex == QUEUE_DIRTY, + ("binsfree: Invalid qindex %d", qindex)); + BUF_ASSERT_XLOCKED(bp); /* - * Stick to the same clean queue for the lifetime of the buf to - * limit locking below. Otherwise pick ont sequentially. - */ - if (qindex == QUEUE_CLEAN) { - if (bqisclean(bp->b_qindex)) - qindex = bp->b_qindex; - else - qindex = bqcleanq(); - } - - /* * Handle delayed bremfree() processing. */ - nlock = bqlock(qindex); if (bp->b_flags & B_REMFREE) { - olock = bqlock(bp->b_qindex); - mtx_lock(olock); - bremfreel(bp); - if (olock != nlock) { - mtx_unlock(olock); - mtx_lock(nlock); + if (bp->b_qindex == qindex) { + bp->b_flags |= B_REUSE; + bp->b_flags &= ~B_REMFREE; + BUF_UNLOCK(bp); + return; } + bq = bufqueue_acquire(bp); + bq_remove(bq, bp); + BQ_UNLOCK(bq); + } + if (qindex == QUEUE_CLEAN) { + bd = &bdclean[bp->b_domain]; + if (bd->bd_lim != 0) + bq = &bd->bd_subq[PCPU_GET(cpuid)]; + else + bq = bd->bd_cleanq; } else - mtx_lock(nlock); - - if (bp->b_qindex != QUEUE_NONE) - panic("binsfree: free buffer onto another queue???"); - - bp->b_qindex = qindex; - if (bp->b_flags & B_AGE) - TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); - else - TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist); -#ifdef INVARIANTS - bq_len[bp->b_qindex]++; -#endif - mtx_unlock(nlock); + bq = &bqdirty; + bq_insert(bq, bp, true); } /* @@ -1404,10 +1439,9 @@ buf_free(struct buf *bp) if (!LIST_EMPTY(&bp->b_dep)) buf_deallocate(bp); bufkva_free(bp); + atomic_add_int(&bdclean[bp->b_domain].bd_freebuffers, 1); BUF_UNLOCK(bp); uma_zfree(buf_zone, bp); - atomic_add_int(&numfreebuffers, 1); - bufspace_wakeup(); } /* @@ -1424,15 +1458,15 @@ buf_import(void *arg, void **store, int cnt, int domai struct buf *bp; int i; - mtx_lock(&bqlocks[QUEUE_EMPTY]); + BQ_LOCK(&bqempty); for (i = 0; i < cnt; i++) { - bp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); + bp = TAILQ_FIRST(&bqempty.bq_queue); if (bp == NULL) break; - bremfreel(bp); + bq_remove(&bqempty, bp); store[i] = bp; } - mtx_unlock(&bqlocks[QUEUE_EMPTY]); + BQ_UNLOCK(&bqempty); return (i); } @@ -1445,10 +1479,21 @@ buf_import(void *arg, void **store, int cnt, int domai static void buf_release(void *arg, void **store, int cnt) { + struct bufqueue *bq; + struct buf *bp; int i; - for (i = 0; i < cnt; i++) - binsfree(store[i], QUEUE_EMPTY); + bq = &bqempty; + BQ_LOCK(bq); + for (i = 0; i < cnt; i++) { + bp = store[i]; + /* Inline bq_insert() to batch locking. */ + TAILQ_INSERT_TAIL(&bq->bq_queue, bp, b_freelist); + bp->b_flags &= ~(B_AGE | B_REUSE); + bq->bq_len++; + bp->b_qindex = bq->bq_index; + } + BQ_UNLOCK(bq); } /* @@ -1457,22 +1502,31 @@ buf_release(void *arg, void **store, int cnt) * Allocate an empty buffer header. */ static struct buf * -buf_alloc(void) +buf_alloc(struct bufdomain *bd) { struct buf *bp; + int freebufs; - bp = uma_zalloc(buf_zone, M_NOWAIT); + /* + * We can only run out of bufs in the buf zone if the average buf + * is less than BKVASIZE. In this case the actual wait/block will + * come from buf_reycle() failing to flush one of these small bufs. + */ + bp = NULL; + freebufs = atomic_fetchadd_int(&bd->bd_freebuffers, -1); + if (freebufs > 0) + bp = uma_zalloc(buf_zone, M_NOWAIT); if (bp == NULL) { - bufspace_daemonwakeup(); - atomic_add_int(&numbufallocfails, 1); + atomic_fetchadd_int(&bd->bd_freebuffers, 1); + bufspace_daemon_wakeup(bd); + counter_u64_add(numbufallocfails, 1); return (NULL); } - /* - * Wake-up the bufspace daemon on transition. + * Wake-up the bufspace daemon on transition below threshold. */ - if (atomic_fetchadd_int(&numfreebuffers, -1) == lofreebuffers) - bufspace_daemonwakeup(); + if (freebufs == bd->bd_lofreebuffers) + bufspace_daemon_wakeup(bd); if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0) panic("getnewbuf_empty: Locked buf %p on free queue.", bp); @@ -1488,6 +1542,7 @@ buf_alloc(void) KASSERT(bp->b_kvasize == 0, ("bp: %p still has kva\n", bp)); KASSERT(bp->b_bufsize == 0, ("bp: %p still has bufspace\n", bp)); + bp->b_domain = BD_DOMAIN(bd); bp->b_flags = 0; bp->b_ioflags = 0; bp->b_xflags = 0; @@ -1512,22 +1567,26 @@ buf_alloc(void) } /* - * buf_qrecycle: + * buf_recycle: * * Free a buffer from the given bufqueue. kva controls whether the * freed buf must own some kva resources. This is used for * defragmenting. */ static int -buf_qrecycle(int qindex, bool kva) +buf_recycle(struct bufdomain *bd, bool kva) { + struct bufqueue *bq; struct buf *bp, *nbp; if (kva) - atomic_add_int(&bufdefragcnt, 1); + counter_u64_add(bufdefragcnt, 1); nbp = NULL; - mtx_lock(&bqlocks[qindex]); - nbp = TAILQ_FIRST(&bufqueues[qindex]); + bq = bd->bd_cleanq; + BQ_LOCK(bq); + KASSERT(BQ_LOCKPTR(bq) == BD_LOCKPTR(bd), + ("buf_recycle: Locks don't match")); + nbp = TAILQ_FIRST(&bq->bq_queue); /* * Run scan, possibly freeing data and/or kva mappings on the fly @@ -1551,6 +1610,18 @@ buf_qrecycle(int qindex, bool kva) continue; /* + * Implement a second chance algorithm for frequently + * accessed buffers. + */ + if ((bp->b_flags & B_REUSE) != 0) { + TAILQ_REMOVE(&bq->bq_queue, bp, b_freelist); + TAILQ_INSERT_TAIL(&bq->bq_queue, bp, b_freelist); + bp->b_flags &= ~B_REUSE; + BUF_UNLOCK(bp); + continue; + } + + /* * Skip buffers with background writes in progress. */ if ((bp->b_vflags & BV_BKGRDINPROG) != 0) { @@ -1558,14 +1629,18 @@ buf_qrecycle(int qindex, bool kva) continue; } - KASSERT(bp->b_qindex == qindex, - ("getnewbuf: inconsistent queue %d bp %p", qindex, bp)); + KASSERT(bp->b_qindex == QUEUE_CLEAN, + ("buf_recycle: inconsistent queue %d bp %p", + bp->b_qindex, bp)); + KASSERT(bp->b_domain == BD_DOMAIN(bd), + ("getnewbuf: queue domain %d doesn't match request %d", + bp->b_domain, (int)BD_DOMAIN(bd))); /* * NOTE: nbp is now entirely invalid. We can only restart * the scan from this point on. */ - bremfreel(bp); - mtx_unlock(&bqlocks[qindex]); + bq_remove(bq, bp); + BQ_UNLOCK(bq); /* * Requeue the background write buffer with error and @@ -1573,70 +1648,21 @@ buf_qrecycle(int qindex, bool kva) */ if ((bp->b_vflags & BV_BKGRDERR) != 0) { bqrelse(bp); - mtx_lock(&bqlocks[qindex]); - nbp = TAILQ_FIRST(&bufqueues[qindex]); + BQ_LOCK(bq); + nbp = TAILQ_FIRST(&bq->bq_queue); continue; } bp->b_flags |= B_INVAL; brelse(bp); return (0); } - mtx_unlock(&bqlocks[qindex]); + bd->bd_wanted = 1; + BQ_UNLOCK(bq); return (ENOBUFS); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Feb 20 00:34:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B0DAF0E7F3; Tue, 20 Feb 2018 00:34:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DCE27588E; Tue, 20 Feb 2018 00:34:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23C8921D69; Tue, 20 Feb 2018 00:34:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K0YgqD048666; Tue, 20 Feb 2018 00:34:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K0Yg3s048665; Tue, 20 Feb 2018 00:34:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802200034.w1K0Yg3s048665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Feb 2018 00:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329613 - stable/11/sys/geom/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/geom/mirror X-SVN-Commit-Revision: 329613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 00:34:43 -0000 Author: markj Date: Tue Feb 20 00:34:42 2018 New Revision: 329613 URL: https://svnweb.freebsd.org/changeset/base/329613 Log: MFC r328938: Simplify synchronization read error handling. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Tue Feb 20 00:06:07 2018 (r329612) +++ stable/11/sys/geom/mirror/g_mirror.c Tue Feb 20 00:34:42 2018 (r329613) @@ -1334,9 +1334,7 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc */ switch (bp->bio_cmd) { case BIO_READ: { - struct g_mirror_disk *d; struct g_consumer *cp; - int readable; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, bp->bio_error); @@ -1347,31 +1345,17 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc bp->bio_error); /* - * If there's at least one other disk from which we can - * read the block, retry the request. - */ - readable = 0; - LIST_FOREACH(d, &sc->sc_disks, d_next) - if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE && - !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN)) - readable++; - - /* * The read error will trigger a syncid bump, so there's * no need to do that here. * - * If we can retry the read from another disk, do so. - * Otherwise, all we can do is kick out the new disk. + * The read error handling for regular requests will + * retry the read from all active mirrors before passing + * the error back up, so there's no need to retry here. */ - if (readable == 0) { - g_mirror_sync_request_free(disk, bp); - g_mirror_event_send(disk, - G_MIRROR_DISK_STATE_DISCONNECTED, - G_MIRROR_EVENT_DONTWAIT); - } else { - g_mirror_sync_reinit(disk, bp, bp->bio_offset); - goto retry_read; - } + g_mirror_sync_request_free(disk, bp); + g_mirror_event_send(disk, + G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); return; } G_MIRROR_LOGREQ(3, bp, @@ -1427,7 +1411,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc g_mirror_sync_reinit(disk, bp, sync->ds_offset); sync->ds_offset += bp->bio_length; -retry_read: G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); sync->ds_consumer->index++; From owner-svn-src-all@freebsd.org Tue Feb 20 02:03:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 459B5F175B9; Tue, 20 Feb 2018 02:03:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECBCE7937D; Tue, 20 Feb 2018 02:03:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7AB922D29; Tue, 20 Feb 2018 02:03:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K23TAl092367; Tue, 20 Feb 2018 02:03:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K23Tne092366; Tue, 20 Feb 2018 02:03:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200203.w1K23Tne092366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 02:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329614 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 02:03:30 -0000 Author: kevans Date: Tue Feb 20 02:03:29 2018 New Revision: 329614 URL: https://svnweb.freebsd.org/changeset/base/329614 Log: stand/lua: Don't set ACPI off just because we can't detect it. This should unbreak EFI/!i386 cases. Reported by: Peter Lei Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 00:34:42 2018 (r329613) +++ head/stand/lua/core.lua Tue Feb 20 02:03:29 2018 (r329614) @@ -230,5 +230,11 @@ function core.shallowCopyTable(tbl) return new_tbl; end -core.setACPI(core.getACPIPresent(false)); +-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will +-- generally be set upon execution of the kernel. Because of this, we can't (or +-- don't really want to) detect/disable ACPI on !i386 reliably. Just set it +-- enabled if we detect it and leave well enough alone if we don't. +if (core.getACPIPresent(false)) then + core.setACPI(true); +end return core; From owner-svn-src-all@freebsd.org Tue Feb 20 02:18:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED3FF19365; Tue, 20 Feb 2018 02:18:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D595A79FD2; Tue, 20 Feb 2018 02:18:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D07DD22F17; Tue, 20 Feb 2018 02:18:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K2IU7m098043; Tue, 20 Feb 2018 02:18:30 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K2IU4r098041; Tue, 20 Feb 2018 02:18:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802200218.w1K2IU4r098041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Feb 2018 02:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329615 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 02:18:31 -0000 Author: mjg Date: Tue Feb 20 02:18:30 2018 New Revision: 329615 URL: https://svnweb.freebsd.org/changeset/base/329615 Log: Reduce contention on the proctree lock during heavy package build. There is a proctree -> allproc ordering established. Most of the time it is either xlock -> xlock or slock -> slock. On fork however there is a slock -> xlock pair which results in pathological wait times due to threads keeping proctree held for reading and all waiting on allproc. Switch this to xlock -> xlock. Longer term fix would get rid of proctree in this place to begin with. Right now it is necessary to walk the session/process group lists to determine which id is free. The walk can be avoided e.g. with bitmaps. The exit path used to have one place which dealt with allproc and then with proctree. Move the allproc acquire into the section protected by proctree. This reduces contention against threads waiting on proctree in the fork codepath - the fork proctree holder does not have to wait for allproc as often. Finally, move tidhash manipulation outside of the area protected by either of these locks. The removal from the hash was already unprotected. There is no legitimate reason to look up thread ids for a process still under construction. This results in about 50% wait time reduction during -j 128 package build. Modified: head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Tue Feb 20 02:03:29 2018 (r329614) +++ head/sys/kern/kern_exit.c Tue Feb 20 02:18:30 2018 (r329615) @@ -424,16 +424,6 @@ exit1(struct thread *td, int rval, int signo) tidhash_remove(td); /* - * Remove proc from allproc queue and pidhash chain. - * Place onto zombproc. Unlink from parent's child list. - */ - sx_xlock(&allproc_lock); - LIST_REMOVE(p, p_list); - LIST_INSERT_HEAD(&zombproc, p, p_list); - LIST_REMOVE(p, p_hash); - sx_xunlock(&allproc_lock); - - /* * Call machine-dependent code to release any * machine-dependent resources other than the address space. * The address space is released by "vmspace_exitfree(p)" in @@ -443,12 +433,22 @@ exit1(struct thread *td, int rval, int signo) WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); + sx_xlock(&proctree_lock); /* + * Remove proc from allproc queue and pidhash chain. + * Place onto zombproc. Unlink from parent's child list. + */ + sx_xlock(&allproc_lock); + LIST_REMOVE(p, p_list); + LIST_INSERT_HEAD(&zombproc, p, p_list); + LIST_REMOVE(p, p_hash); + sx_xunlock(&allproc_lock); + + /* * Reparent all children processes: * - traced ones to the original parent (or init if we are that parent) * - the rest to init */ - sx_xlock(&proctree_lock); q = LIST_FIRST(&p->p_children); if (q != NULL) /* only need this if any child is S_ZOMB */ wakeup(q->p_reaper); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Feb 20 02:03:29 2018 (r329614) +++ head/sys/kern/kern_fork.c Tue Feb 20 02:18:30 2018 (r329615) @@ -394,7 +394,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct struct filedesc_to_leader *fdtol; struct sigacts *newsigacts; - sx_assert(&proctree_lock, SX_SLOCKED); + sx_assert(&proctree_lock, SX_LOCKED); sx_assert(&allproc_lock, SX_XLOCKED); p1 = td->td_proc; @@ -407,12 +407,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct LIST_INSERT_HEAD(&allproc, p2, p_list); allproc_gen++; LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash); - tidhash_add(td2); PROC_LOCK(p2); PROC_LOCK(p1); sx_xunlock(&allproc_lock); - sx_sunlock(&proctree_lock); + sx_xunlock(&proctree_lock); bcopy(&p1->p_startcopy, &p2->p_startcopy, __rangeof(struct proc, p_startcopy, p_endcopy)); @@ -428,6 +427,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct PROC_UNLOCK(p2); + tidhash_add(td2); + /* * Malloc things while we don't hold any locks. */ @@ -954,7 +955,7 @@ fork1(struct thread *td, struct fork_req *fr) STAILQ_INIT(&newproc->p_ktr); /* We have to lock the process tree while we look for a pid. */ - sx_slock(&proctree_lock); + sx_xlock(&proctree_lock); sx_xlock(&allproc_lock); /* @@ -977,7 +978,7 @@ fork1(struct thread *td, struct fork_req *fr) error = EAGAIN; sx_xunlock(&allproc_lock); - sx_sunlock(&proctree_lock); + sx_xunlock(&proctree_lock); #ifdef MAC mac_proc_destroy(newproc); #endif From owner-svn-src-all@freebsd.org Tue Feb 20 03:40:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 383A1F21C18; Tue, 20 Feb 2018 03:40:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD88A7E2BC; Tue, 20 Feb 2018 03:40:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D872123D98; Tue, 20 Feb 2018 03:40:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K3eGpr038756; Tue, 20 Feb 2018 03:40:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K3eGlc038755; Tue, 20 Feb 2018 03:40:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200340.w1K3eGlc038755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 03:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329619 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 03:40:17 -0000 Author: kevans Date: Tue Feb 20 03:40:16 2018 New Revision: 329619 URL: https://svnweb.freebsd.org/changeset/base/329619 Log: stand/lua: Extract menu handlers out into menu.handlers table This is a bit cleaner than our former method of an if ... else chain of handlers. Store handlers in the menu.handlers table so that they may be added to or removed dynamically. All handlers take the current menu and selected entry as parameters, and their return value indicates whether the menu processor should continue or not. An omitted return value or 'true' will indicate that we should continue, while returning 'false' will indicate that we should exit the current menu. The omitted return value behavior is due to continuing the loop being the more common situation. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 02:32:22 2018 (r329618) +++ head/stand/lua/menu.lua Tue Feb 20 03:40:16 2018 (r329619) @@ -42,6 +42,40 @@ local run; local autoboot; local carousel_choices = {}; +menu.handlers = { + -- Menu handlers take the current menu and selected entry as parameters, + -- and should return a boolean indicating whether execution should + -- continue or not. The return value may be omitted if this entry should + -- have no bearing on whether we continue or not, indicating that we + -- should just continue after execution. + [core.MENU_ENTRY] = function(current_menu, entry) + -- run function + entry.func(); + end, + [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry) + -- carousel (rotating) functionality + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices > 0) then + caridx = (caridx % #choices) + 1; + menu.setCarouselIndex(carid, caridx); + entry.func(caridx, choices[caridx], choices); + end + end, + [core.MENU_SUBMENU] = function(current_menu, entry) + -- recurse + return menu.run(entry.submenu()); + end, + [core.MENU_RETURN] = function(current_menu, entry) + -- allow entry to have a function/side effect + if (entry.func ~= nil) then + entry.func(); + end + return false; + end, +}; -- loader menu tree is rooted at menu.welcome menu.boot_options = { @@ -338,31 +372,16 @@ function menu.run(m) -- if we have an alias do the assigned action: if (sel_entry ~= nil) then - if (sel_entry.entry_type == core.MENU_ENTRY) then - -- run function - sel_entry.func(); - elseif (sel_entry.entry_type == core.MENU_CAROUSEL_ENTRY) then - -- carousel (rotating) functionality - local carid = sel_entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = sel_entry.items(); - - if (#choices > 0) then - caridx = (caridx % #choices) + 1; - menu.setCarouselIndex(carid, caridx); - sel_entry.func(caridx, choices[caridx], - choices); + -- Get menu handler + local handler = menu.handlers[sel_entry.entry_type]; + if (handler ~= nil) then + -- The handler's return value indicates whether + -- we need to exit this menu. An omitted return + -- value means "continue" by default. + cont = handler(m, sel_entry); + if (cont == nil) then + cont = true; end - elseif (sel_entry.entry_type == core.MENU_SUBMENU) then - -- recurse - cont = menu.run(sel_entry.submenu()); - elseif (sel_entry.entry_type == core.MENU_RETURN) then - -- allow entry to have a function/side effect - if (sel_entry.func ~= nil) then - sel_entry.func(); - end - -- break recurse - cont = false; end -- if we got an alias key the screen is out of date: screen.clear(); From owner-svn-src-all@freebsd.org Tue Feb 20 03:51:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 972DBF22B0B; Tue, 20 Feb 2018 03:51:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 456547EC3B; Tue, 20 Feb 2018 03:51:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4073D23FA0; Tue, 20 Feb 2018 03:51:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K3pAeu043520; Tue, 20 Feb 2018 03:51:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K3pAol043518; Tue, 20 Feb 2018 03:51:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802200351.w1K3pAol043518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Feb 2018 03:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329620 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 329620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 03:51:10 -0000 Author: ian Date: Tue Feb 20 03:51:09 2018 New Revision: 329620 URL: https://svnweb.freebsd.org/changeset/base/329620 Log: Add missing MODULE_DEPENDS(). Modified: head/sys/dev/flash/at45d.c head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/at45d.c ============================================================================== --- head/sys/dev/flash/at45d.c Tue Feb 20 03:40:16 2018 (r329619) +++ head/sys/dev/flash/at45d.c Tue Feb 20 03:51:09 2018 (r329620) @@ -450,3 +450,4 @@ static driver_t at45d_driver = { }; DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); +MODULE_DEPEND(at45d, spibus, 1, 1, 1); Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Tue Feb 20 03:40:16 2018 (r329619) +++ head/sys/dev/flash/mx25l.c Tue Feb 20 03:51:09 2018 (r329620) @@ -648,3 +648,4 @@ static driver_t mx25l_driver = { }; DRIVER_MODULE(mx25l, spibus, mx25l_driver, mx25l_devclass, 0, 0); +MODULE_DEPEND(mx25l, spibus, 1, 1, 1); From owner-svn-src-all@freebsd.org Tue Feb 20 03:58:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38317F23519; Tue, 20 Feb 2018 03:58:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D64BA7F10E; Tue, 20 Feb 2018 03:58:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE60A2412B; Tue, 20 Feb 2018 03:58:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K3wj5q048959; Tue, 20 Feb 2018 03:58:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K3wjTD048958; Tue, 20 Feb 2018 03:58:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200358.w1K3wjTD048958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 03:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329621 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 03:58:46 -0000 Author: kevans Date: Tue Feb 20 03:58:45 2018 New Revision: 329621 URL: https://svnweb.freebsd.org/changeset/base/329621 Log: stand/lua: Add and use drawer.menu_name_handlers Pull out specialized naming behavior into drawer.menu_name_handlers. This is currently only needed for the carousel entry, where naming is based on the current choice and the menu item purposefully does not store this state. The setup was designed so that every type can have a special name handler, and the default action is to simply use the result of entry.name(). Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 03:51:09 2018 (r329620) +++ head/stand/lua/drawer.lua Tue Feb 20 03:58:45 2018 (r329621) @@ -159,6 +159,33 @@ function drawer.drawscreen(menu_opts) return drawer.drawmenu(menu_opts); end +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + +function menu_entry_name(drawing_menu, entry) + local name_handler = drawer.menu_name_handlers[entry.entry_type]; + + if (name_handler ~= nil) then + return name_handler(drawing_menu, entry); + end + return entry.name(); +end + function drawer.drawmenu(m) x = drawer.menu_position.x; y = drawer.menu_position.y; @@ -179,22 +206,9 @@ function drawer.drawmenu(m) if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; screen.setcursor(x, y + line_num); - local name = ""; - if (e.entry_type == core.MENU_CAROUSEL_ENTRY) then - local carid = e.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = e.items(); + print(entry_num .. ". " .. menu_entry_name(m, e)); - if (#choices < caridx) then - caridx = 1; - end - name = e.name(caridx, choices[caridx], choices); - else - name = e.name(); - end - print(entry_num .. ". " .. name); - -- fill the alias table alias_table[tostring(entry_num)] = e; if (e.alias ~= nil) then @@ -204,7 +218,7 @@ function drawer.drawmenu(m) end else screen.setcursor(x, y + line_num); - print(e.name()); + print(menu_entry_name(m, e)); end ::continue:: end From owner-svn-src-all@freebsd.org Tue Feb 20 04:11:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66B5AF24817; Tue, 20 Feb 2018 04:11:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 175597FB33; Tue, 20 Feb 2018 04:11:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1016924342; Tue, 20 Feb 2018 04:11:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4BmD4058515; Tue, 20 Feb 2018 04:11:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4Bm2M058514; Tue, 20 Feb 2018 04:11:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200411.w1K4Bm2M058514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 04:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329622 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:11:49 -0000 Author: kevans Date: Tue Feb 20 04:11:48 2018 New Revision: 329622 URL: https://svnweb.freebsd.org/changeset/base/329622 Log: stand/lua: Move drawer.menu_name_handlers further up As a good candidate for modification, move this table further up in the module to improve visibility. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 03:58:45 2018 (r329621) +++ head/stand/lua/drawer.lua Tue Feb 20 04:11:48 2018 (r329622) @@ -32,6 +32,24 @@ local screen = require("screen"); local drawer = {}; +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { " ______ ____ _____ _____ ", @@ -158,24 +176,6 @@ function drawer.drawscreen(menu_opts) drawer.drawbox(); return drawer.drawmenu(menu_opts); end - -drawer.menu_name_handlers = { - -- Menu name handlers should take the menu being drawn and entry being - -- drawn as parameters, and return the name of the item. - -- This is designed so that everything, including menu separators, may - -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) - local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = entry.items(); - - if (#choices < caridx) then - caridx = 1; - end - return entry.name(caridx, choices[caridx], choices); - end, -}; function menu_entry_name(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type]; From owner-svn-src-all@freebsd.org Tue Feb 20 04:14:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02D34F24B26; Tue, 20 Feb 2018 04:14:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A545A7FDB4; Tue, 20 Feb 2018 04:14:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A019724478; Tue, 20 Feb 2018 04:14:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4ECV0058634; Tue, 20 Feb 2018 04:14:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4ECqt058633; Tue, 20 Feb 2018 04:14:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802200414.w1K4ECqt058633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 04:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329623 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:14:13 -0000 Author: mav Date: Tue Feb 20 04:14:12 2018 New Revision: 329623 URL: https://svnweb.freebsd.org/changeset/base/329623 Log: MFV r302649: 7016 arc_available_memory is not 32-bit safe illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190 https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190 https://www.illumos.org/issues/7016 upstream DLPX-39446 arc_available_memory is not 32-bit safe https://github.com/delphix/delphix-os/commit/ 6b353ea3b8a1610be22e71e657d051743c64190b related to this upstream: DLPX-38547 delphix engine hang https://github.com/delphix/delphix-os/commit/ 3183a567b3e8c62a74a65885ca60c86f3d693783 DLPX-38547 delphix engine hang (fix static global) https://github.com/delphix/delphix-os/commit/ 22ac551d8ef085ad66cc8f65e51ac372b12993b9 DLPX-38882 system hung waiting on free segment https://github.com/delphix/delphix-os/commit/ cdd6beef7548cd3b12f0fc0328eeb3af540079c2 Reviewed by: Igor Kozhukhov Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: George Wilson Approved by: Gordon Ross Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Feb 20 04:11:48 2018 (r329622) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Feb 20 04:14:12 2018 (r329623) @@ -350,6 +350,11 @@ extern boolean_t zfs_prefetch_disable; static boolean_t arc_warm; /* + * log2 fraction of the zio arena to keep free. + */ +int arc_zio_arena_free_shift = 2; + +/* * These tunables are for performance analysis. */ uint64_t zfs_arc_max; @@ -4321,15 +4326,16 @@ arc_available_memory(void) /* * If zio data pages are being allocated out of a separate heap segment, * then enforce that the size of available vmem for this arena remains - * above about 1/16th free. + * above about 1/4th (1/(2^arc_zio_arena_free_shift)) free. * - * Note: The 1/16th arena free requirement was put in place - * to aggressively evict memory from the arc in order to avoid - * memory fragmentation issues. + * Note that reducing the arc_zio_arena_free_shift keeps more virtual + * memory (in the zio_arena) free, which can avoid memory + * fragmentation issues. */ if (zio_arena != NULL) { n = (int64_t)vmem_size(zio_arena, VMEM_FREE) - - (vmem_size(zio_arena, VMEM_ALLOC) >> 4); + (vmem_size(zio_arena, VMEM_ALLOC) >> + arc_zio_arena_free_shift); if (n < lowest) { lowest = n; r = FMR_ZIO_ARENA; From owner-svn-src-all@freebsd.org Tue Feb 20 04:23:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79BAEF25863; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F654804DF; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A4C624641; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4NiWR063405; Tue, 20 Feb 2018 04:23:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4Ni9T063404; Tue, 20 Feb 2018 04:23:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200423.w1K4Ni9T063404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 04:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329624 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:23:44 -0000 Author: kevans Date: Tue Feb 20 04:23:43 2018 New Revision: 329624 URL: https://svnweb.freebsd.org/changeset/base/329624 Log: stand/lua: Reduce exposure of the drawer module As part of an effort to slowly reduce our exports overall to a set of stable properties/functions, go ahead and reduce what drawer exposes to others. The graphics should generally not be modified on their own, but their position could be modified if additional grahics also need to be drawn. Export position/shift information, but leave the actual graphic local to the module. The next step will be to create a 'menudef' that gets exported instead, with each entry in the menudef table describing the graphic to be drawn along with specific positioning information. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 04:14:12 2018 (r329623) +++ head/stand/lua/drawer.lua Tue Feb 20 04:23:43 2018 (r329624) @@ -32,6 +32,13 @@ local screen = require("screen"); local drawer = {}; +local fbsd_logo; +local beastie_color; +local beastie; +local fbsd_logo_v; +local orb; +local none; + drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being -- drawn as parameters, and return the name of the item. @@ -51,7 +58,14 @@ drawer.menu_name_handlers = { }; drawer.brand_position = {x = 2, y = 1}; -drawer.fbsd_logo = { +drawer.logo_position = {x = 46, y = 1}; +drawer.fbsd_logo_shift = {x = 5, y = 4}; +drawer.orb_shift = {x = 2, y = 4}; +drawer.none_shift = {x = 17, y = 0}; +drawer.menu_position = {x = 6, y = 11}; +drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; + +fbsd_logo = { " ______ ____ _____ _____ ", " | ____| | _ \\ / ____| __ \\ ", " | |___ _ __ ___ ___ | |_) | (___ | | | |", @@ -61,8 +75,7 @@ drawer.fbsd_logo = { " |_| |_| \\___|\\___||____/|_____/|_____/ " }; -drawer.logo_position = {x = 46, y = 1}; -drawer.beastie_color = { +beastie_color = { " \027[31m, ,", " /( )`", " \\ \\___ / |", @@ -84,7 +97,7 @@ drawer.beastie_color = { " `--{__________)\027[37m" }; -drawer.beastie = { +beastie = { " , ,", " /( )`", " \\ \\___ / |", @@ -106,8 +119,7 @@ drawer.beastie = { " `--{__________)" }; -drawer.fbsd_logo_shift = {x = 5, y = 4}; -drawer.fbsd_logo_v = { +fbsd_logo_v = { " ______", " | ____| __ ___ ___ ", " | |__ | '__/ _ \\/ _ \\", @@ -123,8 +135,7 @@ drawer.fbsd_logo_v = { " |____/|_____/|_____/" }; -drawer.orb_shift = {x = 2, y = 4}; -drawer.orb_color = { +orb_color = { " \027[31m``` \027[31;1m`\027[31m", " s` `.....---...\027[31;1m....--.``` -/\027[31m", " +o .--` \027[31;1m/y:` +.\027[31m", @@ -142,7 +153,7 @@ drawer.orb_color = { " .---.....----.\027[37m" }; -drawer.orb = { +orb = { " ``` `", " s` `.....---.......--.``` -/", " +o .--` /y:` +.", @@ -160,14 +171,8 @@ drawer.orb = { " .---.....----." }; -drawer.none = {""}; +none = {""}; -drawer.none_shift = {x = 17, y = 0}; - -drawer.menu_position = {x = 6, y = 11}; - -drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; - function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements @@ -277,7 +282,7 @@ function drawer.drawbrand() drawer.brand_position.y; local logo = load("return " .. tostring(loader.getenv("loader_brand")))() or - drawer.fbsd_logo; + fbsd_logo; drawer.draw(x, y, logo); end @@ -293,25 +298,25 @@ function drawer.drawlogo() if (logo == "beastie") then if (colored) then - logo = drawer.beastie_color; + logo = beastie_color; end elseif (logo == "beastiebw") then - logo = drawer.beastie; + logo = beastie; elseif (logo == "fbsdbw") then - logo = drawer.fbsd_logo_v; + logo = fbsd_logo_v; s = drawer.fbsd_logo_shift; elseif (logo == "orb") then if (colored) then - logo = drawer.orb_color; + logo = orb_color; end s = drawer.orb_shift; elseif (logo == "orbbw") then - logo = drawer.orb; + logo = orb; s = drawer.orb_shift; elseif (logo == "tribute") then - logo = drawer.fbsd_logo; + logo = fbsd_logo; elseif (logo == "tributebw") then - logo = drawer.fbsd_logo; + logo = fbsd_logo; elseif (logo == "none") then --centre brand and text if no logo drawer.brand_position.x = drawer.brand_position.x + drawer.none_shift.x; @@ -323,13 +328,13 @@ function drawer.drawlogo() --prevent redraws from moving menu further drawer.none_shift.x = 0; drawer.none_shift.y = 0; - logo = drawer.none; + logo = none; end if (not logo) then if (colored) then - logo = drawer.orb_color; + logo = orb_color; else - logo = drawer.orb; + logo = orb; end end drawer.draw(x + s.x, y + s.y, logo); From owner-svn-src-all@freebsd.org Tue Feb 20 04:36:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 098A3F26853; Tue, 20 Feb 2018 04:36:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAEE780E17; Tue, 20 Feb 2018 04:36:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5EFE247FC; Tue, 20 Feb 2018 04:36:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4ap8l068799; Tue, 20 Feb 2018 04:36:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4apNW068795; Tue, 20 Feb 2018 04:36:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802200436.w1K4apNW068795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 04:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329625 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:36:52 -0000 Author: mav Date: Tue Feb 20 04:36:51 2018 New Revision: 329625 URL: https://svnweb.freebsd.org/changeset/base/329625 Log: MFV r307315: 7301 zpool export -f should be able to interrupt file freeing Reviewed by: Matthew Ahrens Reviewed by: Sanjay Nadkarni Reviewed by: Saso Kiselkov Reviewed by: John Kennedy Author: Alek Pinchuk Closes #175 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Feb 20 04:23:43 2018 (r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Feb 20 04:36:51 2018 (r329625) @@ -24,7 +24,7 @@ */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ -/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #include #include @@ -723,6 +723,22 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t return (0); } +/* + * If this objset is of type OST_ZFS return true if vfs's unmounted flag is set, + * otherwise return false. + * Used below in dmu_free_long_range_impl() to enable abort when unmounting + */ +/*ARGSUSED*/ +static boolean_t +dmu_objset_zfs_unmounting(objset_t *os) +{ +#ifdef _KERNEL + if (dmu_objset_type(os) == DMU_OST_ZFS) + return (zfs_get_vfs_flag_unmounted(os)); +#endif + return (B_FALSE); +} + static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, uint64_t length) @@ -748,6 +764,9 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui uint64_t chunk_end, chunk_begin, chunk_len; uint64_t long_free_dirty_all_txgs = 0; dmu_tx_t *tx; + + if (dmu_objset_zfs_unmounting(dn->dn_objset)) + return (SET_ERROR(EINTR)); chunk_end = chunk_begin = offset + length; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Feb 20 04:23:43 2018 (r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Feb 20 04:36:51 2018 (r329625) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_FS_ZFS_ZNODE_H @@ -322,6 +323,7 @@ extern int zfs_create_op_tables(); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); extern int zfs_get_stats(objset_t *os, nvlist_t *nv); +extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os); extern void zfs_znode_dmu_fini(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 04:23:43 2018 (r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 04:36:51 2018 (r329625) @@ -428,8 +428,8 @@ zfs_rmnode(znode_t *zp) error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); if (error) { /* - * Not enough space. Leave the file in the unlinked - * set. + * Not enough space or we were interrupted by unmount. + * Leave the file in the unlinked set. */ zfs_znode_dmu_fini(zp); zfs_znode_free(zp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Feb 20 04:23:43 2018 (r329624) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Feb 20 04:36:51 2018 (r329625) @@ -24,6 +24,7 @@ * All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1846,7 +1847,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) /* * Teardown the zfsvfs::z_os. * - * Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock' + * Note, if 'unmounting' is FALSE, we return with the 'z_teardown_lock' * and 'z_teardown_inactive_lock' held. */ static int @@ -1914,8 +1915,8 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } /* @@ -2505,6 +2506,29 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_ error = 0; } return (error); +} + +/* + * Return true if the coresponding vfs's unmounted flag is set. + * Otherwise return false. + * If this function returns true we know VFS unmount has been initiated. + */ +boolean_t +zfs_get_vfs_flag_unmounted(objset_t *os) +{ + zfsvfs_t *zfvp; + boolean_t unmounted = B_FALSE; + + ASSERT(dmu_objset_type(os) == DMU_OST_ZFS); + + mutex_enter(&os->os_user_ptr_lock); + zfvp = dmu_objset_get_user(os); + if (zfvp != NULL && zfvp->z_vfs != NULL && + (zfvp->z_vfs->mnt_kern_flag & MNTK_UNMOUNT)) + unmounted = B_TRUE; + mutex_exit(&os->os_user_ptr_lock); + + return (unmounted); } #ifdef _KERNEL From owner-svn-src-all@freebsd.org Tue Feb 20 04:56:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310CBF01053; Tue, 20 Feb 2018 04:56:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D63AB81AF6; Tue, 20 Feb 2018 04:56:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D139624B5D; Tue, 20 Feb 2018 04:56:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4u3rV078666; Tue, 20 Feb 2018 04:56:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4u3vA078665; Tue, 20 Feb 2018 04:56:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200456.w1K4u3vA078665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 04:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329626 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:56:04 -0000 Author: kevans Date: Tue Feb 20 04:56:03 2018 New Revision: 329626 URL: https://svnweb.freebsd.org/changeset/base/329626 Log: stand/lua: Refactor logos into drawer.logodefs table This refactor makes it straightforward to add new logos for drawing and organizes logo definitions in a logical manner. The graphic to be drawn for each logo may again be modified outside of drawer, but it must be done on a case-by-case basis as a modification to the loader_logo. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 04:36:51 2018 (r329625) +++ head/stand/lua/drawer.lua Tue Feb 20 04:56:03 2018 (r329626) @@ -38,6 +38,7 @@ local beastie; local fbsd_logo_v; local orb; local none; +local none_shifted = false; drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being @@ -59,9 +60,6 @@ drawer.menu_name_handlers = { drawer.brand_position = {x = 2, y = 1}; drawer.logo_position = {x = 46, y = 1}; -drawer.fbsd_logo_shift = {x = 5, y = 4}; -drawer.orb_shift = {x = 2, y = 4}; -drawer.none_shift = {x = 17, y = 0}; drawer.menu_position = {x = 6, y = 11}; drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; @@ -173,6 +171,42 @@ orb = { none = {""}; +drawer.logodefs = { + -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys + -- are: requires_color (boolean), logo (table depicting graphic), and + -- shift (table containing x and y). + ["beastie"] = { + requires_color = true, + logo = beastie_color, + }, + ["beastiebw"] = { + logo = beastie, + }, + ["fbsdbw"] = { + logo = fbsd_logo_v, + shift = {x = 5, y = 4}, + }, + ["orb"] = { + requires_color = true, + logo = orb_color, + shift = {x = 2, y = 4}, + }, + ["orbbw"] = { + logo = orb, + shift = {x = 2, y = 4}, + }, + ["tribute"] = { + logo = fbsd_logo, + }, + ["tributebw"] = { + logo = fbsd_logo, + }, + ["none"] = { + logo = none, + shift = {x = 17, y = 0}, + }, +}; + function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements @@ -286,6 +320,15 @@ function drawer.drawbrand() drawer.draw(x, y, logo); end +function shift_brand_text(shift) + drawer.brand_position.x = drawer.brand_position.x + shift.x; + drawer.brand_position.y = drawer.brand_position.y + shift.y; + drawer.menu_position.x = drawer.menu_position.x + shift.x; + drawer.menu_position.y = drawer.menu_position.y + shift.y; + drawer.box_pos_dim.x = drawer.box_pos_dim.x + shift.x; + drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; +end + function drawer.drawlogo() local x = tonumber(loader.getenv("loader_logo_x")) or drawer.logo_position.x; @@ -293,51 +336,32 @@ function drawer.drawlogo() drawer.logo_position.y; local logo = loader.getenv("loader_logo"); - local s = {x = 0, y = 0}; local colored = color.isEnabled(); - if (logo == "beastie") then - if (colored) then - logo = beastie_color; + -- Lookup + local logodef = drawer.logodefs[logo]; + + if (logodef ~= nil) and (logodef.logo == none) then + -- centre brand and text if no logo + if (not none_shifted) then + shift_brand_text(logodef.shift); + none_shifted = true; end - elseif (logo == "beastiebw") then - logo = beastie; - elseif (logo == "fbsdbw") then - logo = fbsd_logo_v; - s = drawer.fbsd_logo_shift; - elseif (logo == "orb") then + elseif (logodef == nil) or (logodef.logo == nil) or + ((not colored) and logodef.requires_color) then + -- Choose a sensible default if (colored) then - logo = orb_color; - end - s = drawer.orb_shift; - elseif (logo == "orbbw") then - logo = orb; - s = drawer.orb_shift; - elseif (logo == "tribute") then - logo = fbsd_logo; - elseif (logo == "tributebw") then - logo = fbsd_logo; - elseif (logo == "none") then - --centre brand and text if no logo - drawer.brand_position.x = drawer.brand_position.x + drawer.none_shift.x; - drawer.brand_position.y = drawer.brand_position.y + drawer.none_shift.y; - drawer.menu_position.x = drawer.menu_position.x + drawer.none_shift.x; - drawer.menu_position.y = drawer.menu_position.y + drawer.none_shift.y; - drawer.box_pos_dim.x = drawer.box_pos_dim.x + drawer.none_shift.x; - drawer.box_pos_dim.y = drawer.box_pos_dim.y + drawer.none_shift.y; - --prevent redraws from moving menu further - drawer.none_shift.x = 0; - drawer.none_shift.y = 0; - logo = none; - end - if (not logo) then - if (colored) then - logo = orb_color; + logodef = drawer.logodefs["orb"]; else - logo = orb; + logodef = drawer.logodefs["orbbw"]; end end - drawer.draw(x + s.x, y + s.y, logo); + logo = logodef.logo; + if (logodef.shift ~= nil) then + x = x + logodef.shift.x; + y = y + logodef.shift.y; + end + drawer.draw(x, y, logo); end return drawer; From owner-svn-src-all@freebsd.org Tue Feb 20 05:06:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5D4DF01E30; Tue, 20 Feb 2018 05:06:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96B1E821BD; Tue, 20 Feb 2018 05:06:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91B3224D12; Tue, 20 Feb 2018 05:06:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K56B3Q083639; Tue, 20 Feb 2018 05:06:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K56BDg083638; Tue, 20 Feb 2018 05:06:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200506.w1K56BDg083638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 05:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329627 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:06:12 -0000 Author: kevans Date: Tue Feb 20 05:06:11 2018 New Revision: 329627 URL: https://svnweb.freebsd.org/changeset/base/329627 Log: stand/lua: Refactor brands into drawer.branddefs Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 04:56:03 2018 (r329626) +++ head/stand/lua/drawer.lua Tue Feb 20 05:06:11 2018 (r329627) @@ -171,6 +171,15 @@ orb = { none = {""}; +drawer.branddefs = { + ["fbsd"] = { + graphic = fbsd_logo, + }, + ["none"] = { + graphic = none, + }, +}; + drawer.logodefs = { -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys -- are: requires_color (boolean), logo (table depicting graphic), and @@ -315,9 +324,11 @@ function drawer.drawbrand() local y = tonumber(loader.getenv("loader_brand_y")) or drawer.brand_position.y; - local logo = load("return " .. tostring(loader.getenv("loader_brand")))() or - fbsd_logo; - drawer.draw(x, y, logo); + local graphic = drawer.branddefs[loader.getenv("loader_brand")]; + if (graphic == nil) then + graphic = fbsd_logo; + end + drawer.draw(x, y, graphic); end function shift_brand_text(shift) From owner-svn-src-all@freebsd.org Tue Feb 20 05:07:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FFF5F02021; Tue, 20 Feb 2018 05:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63D6082375; Tue, 20 Feb 2018 05:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EAB324D16; Tue, 20 Feb 2018 05:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K57MbU083719; Tue, 20 Feb 2018 05:07:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K57MqT083716; Tue, 20 Feb 2018 05:07:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802200507.w1K57MqT083716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 05:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329628 - in head/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Commit-Revision: 329628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:07:22 -0000 Author: mav Date: Tue Feb 20 05:07:21 2018 New Revision: 329628 URL: https://svnweb.freebsd.org/changeset/base/329628 Log: MFC r316910: 7812 Remove gender specific language illumos/illumos-gate@48bbca816818409505a6e214d0911fda44e622e3 https://github.com/illumos/illumos-gate/commit/48bbca816818409505a6e214d0911fda44e622e3 https://www.illumos.org/issues/7812 This change removes all gendered language that did not refer specifically to an individual person or pet. The convention taken was to use variations on "they" when referring to users and/or human beings, while using "it" when referring to code, functions, and/or libraries. Additionally, we took the liberty to fix up any whitespace issues that were found in any files that were already being modified. Reviewed by: Matt Ahrens Reviewed by: Prakash Surya Reviewed by: Steve Gonczi Reviewed by: Chris Williamson Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Reviewed by: Dan McDonald Reviewed by: Robert Mustacchi Approved by: Richard Lowe Author: Daniel Hoffman Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Tue Feb 20 05:06:11 2018 (r329627) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Tue Feb 20 05:07:21 2018 (r329628) @@ -2379,7 +2379,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *bufle * 1. The nvlist has fixed allocator properties. * All other nvlist routines (like nvlist_add_*, ...) use * these properties. - * 2. When using nvlist_pack() the user can specify his own + * 2. When using nvlist_pack() the user can specify their own * allocator properties (e.g. by using KM_NOSLEEP). * * We use the user specified properties (2). A clearer solution Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 05:06:11 2018 (r329627) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Feb 20 05:07:21 2018 (r329628) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Feb 20 05:06:11 2018 (r329627) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Tue Feb 20 05:07:21 2018 (r329628) @@ -1812,7 +1812,7 @@ zio_reexecute(zio_t *pio) /* * Now that all children have been reexecuted, execute the parent. * We don't reexecute "The Godfather" I/O here as it's the - * responsibility of the caller to wait on him. + * responsibility of the caller to wait on it. */ if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) { pio->io_queued_timestamp = gethrtime(); From owner-svn-src-all@freebsd.org Tue Feb 20 05:10:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A70FEF025EB; Tue, 20 Feb 2018 05:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C48F82719; Tue, 20 Feb 2018 05:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B49324D1E; Tue, 20 Feb 2018 05:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K5ARCF083913; Tue, 20 Feb 2018 05:10:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K5ARiY083912; Tue, 20 Feb 2018 05:10:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200510.w1K5ARiY083912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 05:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329629 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:10:28 -0000 Author: kevans Date: Tue Feb 20 05:10:26 2018 New Revision: 329629 URL: https://svnweb.freebsd.org/changeset/base/329629 Log: stand/lua: Use 'graphic' instead of 'logo' for table depicting graphics This is a more sensible name that offers less redundancy when referring to it (vs. logodef.logo). Switch to it while the getting is good. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 05:07:21 2018 (r329628) +++ head/stand/lua/drawer.lua Tue Feb 20 05:10:26 2018 (r329629) @@ -182,36 +182,36 @@ drawer.branddefs = { drawer.logodefs = { -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys - -- are: requires_color (boolean), logo (table depicting graphic), and + -- are: requires_color (boolean), graphic (table depicting graphic), and -- shift (table containing x and y). ["beastie"] = { requires_color = true, - logo = beastie_color, + graphic = beastie_color, }, ["beastiebw"] = { - logo = beastie, + graphic = beastie, }, ["fbsdbw"] = { - logo = fbsd_logo_v, + graphic = fbsd_logo_v, shift = {x = 5, y = 4}, }, ["orb"] = { requires_color = true, - logo = orb_color, + graphic = orb_color, shift = {x = 2, y = 4}, }, ["orbbw"] = { - logo = orb, + graphic = orb, shift = {x = 2, y = 4}, }, ["tribute"] = { - logo = fbsd_logo, + graphic = fbsd_logo, }, ["tributebw"] = { - logo = fbsd_logo, + graphic = fbsd_logo, }, ["none"] = { - logo = none, + graphic = none, shift = {x = 17, y = 0}, }, }; @@ -352,13 +352,13 @@ function drawer.drawlogo() -- Lookup local logodef = drawer.logodefs[logo]; - if (logodef ~= nil) and (logodef.logo == none) then + if (logodef ~= nil) and (logodef.graphic == none) then -- centre brand and text if no logo if (not none_shifted) then shift_brand_text(logodef.shift); none_shifted = true; end - elseif (logodef == nil) or (logodef.logo == nil) or + elseif (logodef == nil) or (logodef.graphic == nil) or ((not colored) and logodef.requires_color) then -- Choose a sensible default if (colored) then @@ -367,12 +367,11 @@ function drawer.drawlogo() logodef = drawer.logodefs["orbbw"]; end end - logo = logodef.logo; if (logodef.shift ~= nil) then x = x + logodef.shift.x; y = y + logodef.shift.y; end - drawer.draw(x, y, logo); + drawer.draw(x, y, logodef.graphic); end return drawer; From owner-svn-src-all@freebsd.org Tue Feb 20 05:11:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92F3AF028DC; Tue, 20 Feb 2018 05:11:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44F9B82A0D; Tue, 20 Feb 2018 05:11:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F78E24D69; Tue, 20 Feb 2018 05:11:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K5BI6j087757; Tue, 20 Feb 2018 05:11:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K5BIvO087756; Tue, 20 Feb 2018 05:11:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200511.w1K5BIvO087756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 05:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329630 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:11:18 -0000 Author: kevans Date: Tue Feb 20 05:11:17 2018 New Revision: 329630 URL: https://svnweb.freebsd.org/changeset/base/329630 Log: stand/lua: Stick a copyright notice on drawer.lua Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 05:10:26 2018 (r329629) +++ head/stand/lua/drawer.lua Tue Feb 20 05:11:17 2018 (r329630) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (c) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Tue Feb 20 05:12:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F8ADF02B22; Tue, 20 Feb 2018 05:12:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2167982D35; Tue, 20 Feb 2018 05:12:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C59224EB3; Tue, 20 Feb 2018 05:12:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K5Cdvr088747; Tue, 20 Feb 2018 05:12:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K5Cd47088746; Tue, 20 Feb 2018 05:12:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200512.w1K5Cd47088746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 05:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329631 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:12:41 -0000 Author: kevans Date: Tue Feb 20 05:12:39 2018 New Revision: 329631 URL: https://svnweb.freebsd.org/changeset/base/329631 Log: stand/lua: Insert helpful comment for drawer.branddefs Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 05:11:17 2018 (r329630) +++ head/stand/lua/drawer.lua Tue Feb 20 05:12:39 2018 (r329631) @@ -173,6 +173,8 @@ orb = { none = {""}; drawer.branddefs = { + -- Indexed by valid values for loader_brand in loader.conf(5). Valid + -- keys are: graphic (table depicting graphic) ["fbsd"] = { graphic = fbsd_logo, }, From owner-svn-src-all@freebsd.org Tue Feb 20 05:21:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF1FBF03786; Tue, 20 Feb 2018 05:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF7F83388; Tue, 20 Feb 2018 05:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77FEE25030; Tue, 20 Feb 2018 05:21:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K5LwuB092171; Tue, 20 Feb 2018 05:21:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K5Lw5A092170; Tue, 20 Feb 2018 05:21:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200521.w1K5Lw5A092170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 05:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329632 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 329632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:21:59 -0000 Author: kevans Date: Tue Feb 20 05:21:58 2018 New Revision: 329632 URL: https://svnweb.freebsd.org/changeset/base/329632 Log: style.lua(9): Clarify local variable guideline The intent of this guideline is to avoid creating global variables in module scope. Its main purpose is to serve as a reminder that variables at module scope also need to be declared. We want to avoid global variables in general, but this is easier to mess up when designing things in the module scope. Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 ============================================================================== --- head/share/man/man9/style.lua.9 Tue Feb 20 05:12:39 2018 (r329631) +++ head/share/man/man9/style.lua.9 Tue Feb 20 05:21:58 2018 (r329632) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2018 +.Dd February 20, 2018 .Dt STYLE.LUA 9 .Os .Sh NAME @@ -86,7 +86,7 @@ should be done explicitly, rather than as a boolean ex Single-line conditional statements and loops should be avoided. .Pp .Ic local -variables should be preferred to module scope variables. +variables should be preferred to global variables in module scope. .Pp Multiple local variables should not be declared .Sy and From owner-svn-src-all@freebsd.org Tue Feb 20 05:35:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8B0BF044A6; Tue, 20 Feb 2018 05:35:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DDF083A6C; Tue, 20 Feb 2018 05:35:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64C9D251FA; Tue, 20 Feb 2018 05:35:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K5Z0HS098716; Tue, 20 Feb 2018 05:35:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K5Z0M8098715; Tue, 20 Feb 2018 05:35:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802200535.w1K5Z0M8098715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Feb 2018 05:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329633 - head/sbin/devmatch X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/devmatch X-SVN-Commit-Revision: 329633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 05:35:01 -0000 Author: imp Date: Tue Feb 20 05:35:00 2018 New Revision: 329633 URL: https://svnweb.freebsd.org/changeset/base/329633 Log: More verbose output. Modified: head/sbin/devmatch/devmatch.c Modified: head/sbin/devmatch/devmatch.c ============================================================================== --- head/sbin/devmatch/devmatch.c Tue Feb 20 05:21:58 2018 (r329632) +++ head/sbin/devmatch/devmatch.c Tue Feb 20 05:35:00 2018 (r329633) @@ -427,6 +427,8 @@ search_hints(const char *bus, const char *dev, const c asprintf(&descr, "%s: %s", *dev ? dev : "unattached", lastmod); else asprintf(&descr, "%s", lastmod); + if (verbose_flag) + printf("Matches --- %s ---\n", lastmod); if (descr != NULL && hit_index < DEVMATCH_MAX_HITS) { match_data[hit_index].descr = descr; From owner-svn-src-all@freebsd.org Tue Feb 20 06:38:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E86CF07A2F; Tue, 20 Feb 2018 06:38:56 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E938F85C07; Tue, 20 Feb 2018 06:38:55 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFA3325BF0; Tue, 20 Feb 2018 06:38:55 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K6ctfY028438; Tue, 20 Feb 2018 06:38:55 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K6ctta028437; Tue, 20 Feb 2018 06:38:55 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802200638.w1K6ctta028437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 20 Feb 2018 06:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329634 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 06:38:56 -0000 Author: wma Date: Tue Feb 20 06:38:55 2018 New Revision: 329634 URL: https://svnweb.freebsd.org/changeset/base/329634 Log: PowerNV: Send SIGILL on HEA illegal instruction exception Currently Hypervisor Emulation Assistance interrupt is unhandled. Executing an undefined instruction in userland triggers kernel panic. Handle this the same way as Facility Unavailable Interrupt - send SIGILL signal to userspace. Submitted by: Michal Stanek Obtained from: Semihalf Reviewed by: nwhitehorn, pdk@semihalf.com, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14437 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Tue Feb 20 05:35:00 2018 (r329633) +++ head/sys/powerpc/powerpc/trap.c Tue Feb 20 06:38:55 2018 (r329634) @@ -294,6 +294,7 @@ trap(struct trapframe *frame) break; case EXC_FAC: + case EXC_HEA: sig = SIGILL; ucode = ILL_ILLOPC; break; From owner-svn-src-all@freebsd.org Tue Feb 20 07:30:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5D32F0B180; Tue, 20 Feb 2018 07:30:57 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8713087BFD; Tue, 20 Feb 2018 07:30:57 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 820F72656D; Tue, 20 Feb 2018 07:30:57 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K7UvJO056664; Tue, 20 Feb 2018 07:30:57 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K7Uv7R056663; Tue, 20 Feb 2018 07:30:57 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802200730.w1K7Uv7R056663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 20 Feb 2018 07:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329635 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 07:30:58 -0000 Author: wma Date: Tue Feb 20 07:30:57 2018 New Revision: 329635 URL: https://svnweb.freebsd.org/changeset/base/329635 Log: PowerPC: Switch to more accurate unit to avoid division rounding On POWER8 architecture there is a timer with 512Mhz frequency. It has about 1,95ns period, but it is rounded to 1ns which is not accurate. Submitted by: Patryk Duda Obtained from: Semihalf Reviewed by: wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14433 Modified: head/sys/powerpc/powerpc/clock.c Modified: head/sys/powerpc/powerpc/clock.c ============================================================================== --- head/sys/powerpc/powerpc/clock.c Tue Feb 20 06:38:55 2018 (r329634) +++ head/sys/powerpc/powerpc/clock.c Tue Feb 20 07:30:57 2018 (r329635) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); * Initially we assume a processor with a bus frequency of 12.5 MHz. */ static int initialized = 0; -static u_long ns_per_tick = 80; +static uint64_t ps_per_tick = 80000; static u_long ticks_per_sec = 12500000; static u_long *decr_counts[MAXCPU]; @@ -178,7 +178,7 @@ decr_init(void) if (platform_smp_get_bsp(&cpu) != 0) platform_smp_first_cpu(&cpu); ticks_per_sec = platform_timebase_freq(&cpu); - ns_per_tick = 1000000000 / ticks_per_sec; + ps_per_tick = 1000000000000 / ticks_per_sec; set_cputicker(mftb, ticks_per_sec, 0); snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); @@ -307,7 +307,7 @@ DELAY(int n) TSENTER(); tb = mftb(); - ttb = tb + howmany(n * 1000, ns_per_tick); + ttb = tb + howmany((uint64_t)n * 1000000, ps_per_tick); while (tb < ttb) tb = mftb(); TSEXIT(); From owner-svn-src-all@freebsd.org Tue Feb 20 10:13:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55066F18F3C; Tue, 20 Feb 2018 10:13:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 051CB6E94B; Tue, 20 Feb 2018 10:13:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F41A427FFD; Tue, 20 Feb 2018 10:13:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KADFrX038159; Tue, 20 Feb 2018 10:13:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KADDfX038137; Tue, 20 Feb 2018 10:13:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802201013.w1KADDfX038137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Feb 2018 10:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329636 - in head/sys: amd64/amd64 arm/arm arm/nvidia/drm2 arm64/arm64 compat/linuxkpi/common/src dev/drm2/i915 dev/drm2/ttm i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm/nvidia/drm2 arm64/arm64 compat/linuxkpi/common/src dev/drm2/i915 dev/drm2/ttm i386/i386 mips/mips powerpc/aim powerpc/booke riscv/riscv vm X-SVN-Commit-Revision: 329636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 10:13:16 -0000 Author: kib Date: Tue Feb 20 10:13:13 2018 New Revision: 329636 URL: https://svnweb.freebsd.org/changeset/base/329636 Log: vm_wait() rework. Make vm_wait() take the vm_object argument which specifies the domain set to wait for the min condition pass. If there is no object associated with the wait, use curthread' policy domainset. The mechanics of the wait in vm_wait() and vm_wait_domain() is supplied by the new helper vm_wait_doms(), which directly takes the bitmask of the domains to wait for passing min condition. Eliminate pagedaemon_wait(). vm_domain_clear() handles the same operations. Eliminate VM_WAIT and VM_WAITPFAULT macros, the direct functions calls are enough. Eliminate several control state variables from vm_domain, unneeded after the vm_wait() conversion. Scetched and reviewed by: jeff Tested by: pho Sponsored by: The FreeBSD Foundation, Mellanox Technologies Differential revision: https://reviews.freebsd.org/D14384 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm/nvidia/drm2/tegra_bo.c head/sys/arm64/arm64/pmap.c head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/drm2/i915/i915_gem.c head/sys/dev/drm2/i915/i915_gem_gtt.c head/sys/dev/drm2/ttm/ttm_bo_vm.c head/sys/dev/drm2/ttm/ttm_page_alloc.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/mips/mips/uma_machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pageout.h head/sys/vm/vm_pagequeue.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/amd64/amd64/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -2675,7 +2675,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); PMAP_ASSERT_NOT_IN_DI(); - VM_WAIT; + vm_wait(NULL); PMAP_LOCK(pmap); } Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/arm/arm/pmap-v4.c Tue Feb 20 10:13:13 2018 (r329636) @@ -3248,7 +3248,7 @@ do_l2b_alloc: if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); - VM_WAIT; + vm_wait(NULL); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); goto do_l2b_alloc; Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/arm/arm/pmap-v6.c Tue Feb 20 10:13:13 2018 (r329636) @@ -2478,7 +2478,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int fla if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); - VM_WAIT; + vm_wait(NULL); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); } Modified: head/sys/arm/nvidia/drm2/tegra_bo.c ============================================================================== --- head/sys/arm/nvidia/drm2/tegra_bo.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/arm/nvidia/drm2/tegra_bo.c Tue Feb 20 10:13:13 2018 (r329636) @@ -114,7 +114,7 @@ retry: if (tries < 3) { if (!vm_page_reclaim_contig(pflags, npages, low, high, alignment, boundary)) - VM_WAIT; + vm_wait(NULL); tries++; goto retry; } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/arm64/arm64/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1409,7 +1409,7 @@ pmap_pinit(pmap_t pmap) */ while ((l0pt = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - VM_WAIT; + vm_wait(NULL); l0phys = VM_PAGE_TO_PHYS(l0pt); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(l0phys); @@ -1449,7 +1449,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); - VM_WAIT; + vm_wait(NULL); PMAP_LOCK(pmap); } Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Tue Feb 20 10:13:13 2018 (r329636) @@ -101,7 +101,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if (flags & M_WAITOK) { if (!vm_page_reclaim_contig(req, npages, 0, pmax, PAGE_SIZE, 0)) { - VM_WAIT; + vm_wait(NULL); } flags &= ~M_WAITOK; goto retry; Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/dev/drm2/i915/i915_gem.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1561,7 +1561,7 @@ retry: i915_gem_object_unpin(obj); DRM_UNLOCK(dev); VM_OBJECT_WUNLOCK(vm_obj); - VM_WAIT; + vm_wait(vm_obj); goto retry; } page->valid = VM_PAGE_BITS_ALL; Modified: head/sys/dev/drm2/i915/i915_gem_gtt.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem_gtt.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/dev/drm2/i915/i915_gem_gtt.c Tue Feb 20 10:13:13 2018 (r329636) @@ -589,7 +589,7 @@ retry: if (tries < 1) { if (!vm_page_reclaim_contig(req, 1, 0, 0xffffffff, PAGE_SIZE, 0)) - VM_WAIT; + vm_wait(NULL); tries++; goto retry; } Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Tue Feb 20 10:13:13 2018 (r329636) @@ -246,7 +246,7 @@ reserve: if (m1 == NULL) { if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { VM_OBJECT_WUNLOCK(vm_obj); - VM_WAIT; + vm_wait(vm_obj); VM_OBJECT_WLOCK(vm_obj); ttm_mem_io_unlock(man); ttm_bo_unreserve(bo); Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_page_alloc.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/dev/drm2/ttm/ttm_page_alloc.c Tue Feb 20 10:13:13 2018 (r329636) @@ -168,7 +168,7 @@ ttm_vm_page_alloc_dma32(int req, vm_memattr_t memattr) return (p); if (!vm_page_reclaim_contig(req, 1, 0, 0xffffffff, PAGE_SIZE, 0)) - VM_WAIT; + vm_wait(NULL); } } @@ -181,7 +181,7 @@ ttm_vm_page_alloc_any(int req, vm_memattr_t memattr) p = vm_page_alloc(NULL, 0, req); if (p != NULL) break; - VM_WAIT; + vm_wait(NULL); } pmap_page_set_memattr(p, memattr); return (p); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/i386/i386/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1893,10 +1893,9 @@ pmap_pinit(pmap_t pmap) m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) - VM_WAIT; - else { + vm_wait(NULL); + else ptdpg[i++] = m; - } } pmap_qenter((vm_offset_t)pmap->pm_pdir, ptdpg, NPGPTD); @@ -1945,7 +1944,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int fla if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); - VM_WAIT; + vm_wait(NULL); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); } Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/mips/mips/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1050,11 +1050,11 @@ pmap_grow_direct_page(int req) { #ifdef __mips_n64 - VM_WAIT; + vm_wait(NULL); #else if (!vm_page_reclaim_contig(req, 1, 0, MIPS_KSEG0_LARGEST_PHYS, PAGE_SIZE, 0)) - VM_WAIT; + vm_wait(NULL); #endif } Modified: head/sys/mips/mips/uma_machdep.c ============================================================================== --- head/sys/mips/mips/uma_machdep.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/mips/mips/uma_machdep.c Tue Feb 20 10:13:13 2018 (r329636) @@ -67,13 +67,11 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int 0, MIPS_KSEG0_LARGEST_PHYS, PAGE_SIZE, 0)) continue; #endif - if (m == NULL) { - if (wait & M_NOWAIT) - return (NULL); - else - VM_WAIT; - } else + if (m != NULL) break; + if ((wait & M_NOWAIT) != 0) + return (NULL); + vm_wait(NULL); } pa = VM_PAGE_TO_PHYS(m); Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/powerpc/aim/mmu_oea.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1124,7 +1124,7 @@ moea_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, vm_ if ((flags & PMAP_ENTER_NOSLEEP) != 0) return (KERN_RESOURCE_SHORTAGE); VM_OBJECT_ASSERT_UNLOCKED(m->object); - VM_WAIT; + vm_wait(NULL); } } Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1384,7 +1384,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v if ((flags & PMAP_ENTER_NOSLEEP) != 0) return (KERN_RESOURCE_SHORTAGE); VM_OBJECT_ASSERT_UNLOCKED(m->object); - VM_WAIT; + vm_wait(NULL); } /* Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/powerpc/booke/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -789,7 +789,7 @@ ptbl_alloc(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsi vm_wire_sub(i); return (NULL); } - VM_WAIT; + vm_wait(NULL); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); } @@ -1033,7 +1033,7 @@ ptbl_alloc(mmu_t mmu, pmap_t pmap, unsigned int pdir_i vm_wire_sub(i); return (NULL); } - VM_WAIT; + vm_wait(NULL); rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); } @@ -1346,7 +1346,7 @@ pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_i req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED; while ((m = vm_page_alloc(NULL, pidx, req)) == NULL) { PMAP_UNLOCK(pmap); - VM_WAIT; + vm_wait(NULL); PMAP_LOCK(pmap); } mtbl[i] = m; Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/riscv/riscv/pmap.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1203,7 +1203,7 @@ pmap_pinit(pmap_t pmap) */ while ((l1pt = vm_page_alloc(NULL, 0xdeadbeef, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - VM_WAIT; + vm_wait(NULL); l1phys = VM_PAGE_TO_PHYS(l1pt); pmap->pm_l1 = (pd_entry_t *)PHYS_TO_DMAP(l1phys); @@ -1252,7 +1252,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); rw_runlock(&pvh_global_lock); - VM_WAIT; + vm_wait(NULL); rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/vm/vm_fault.c Tue Feb 20 10:13:13 2018 (r329636) @@ -787,7 +787,7 @@ RetryFault:; } if (fs.m == NULL) { unlock_and_deallocate(&fs); - VM_WAITPFAULT; + vm_waitpfault(); goto RetryFault; } } @@ -1685,7 +1685,7 @@ again: if (dst_m == NULL) { VM_OBJECT_WUNLOCK(dst_object); VM_OBJECT_RUNLOCK(object); - VM_WAIT; + vm_wait(dst_object); VM_OBJECT_WLOCK(dst_object); goto again; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/vm/vm_page.c Tue Feb 20 10:13:13 2018 (r329636) @@ -2567,7 +2567,7 @@ CTASSERT(powerof2(NRUNS)); * Returns true if reclamation is successful and false otherwise. Since * relocation requires the allocation of physical pages, reclamation may * fail due to a shortage of free pages. When reclamation fails, callers - * are expected to perform VM_WAIT before retrying a failed allocation + * are expected to perform vm_wait() before retrying a failed allocation * operation, e.g., vm_page_alloc_contig(). * * The caller must always specify an allocation class through "req". @@ -2767,15 +2767,42 @@ vm_wait_severe(void) u_int vm_wait_count(void) { - u_int cnt; - int i; - cnt = 0; - for (i = 0; i < vm_ndomains; i++) - cnt += VM_DOMAIN(i)->vmd_waiters; - cnt += vm_severe_waiters + vm_min_waiters; + return (vm_severe_waiters + vm_min_waiters); +} - return (cnt); +static void +vm_wait_doms(const domainset_t *wdoms) +{ + + /* + * We use racey wakeup synchronization to avoid expensive global + * locking for the pageproc when sleeping with a non-specific vm_wait. + * To handle this, we only sleep for one tick in this instance. It + * is expected that most allocations for the pageproc will come from + * kmem or vm_page_grab* which will use the more specific and + * race-free vm_wait_domain(). + */ + if (curproc == pageproc) { + mtx_lock(&vm_domainset_lock); + vm_pageproc_waiters++; + msleep(&vm_pageproc_waiters, &vm_domainset_lock, PVM, + "pageprocwait", 1); + mtx_unlock(&vm_domainset_lock); + } else { + /* + * XXX Ideally we would wait only until the allocation could + * be satisfied. This condition can cause new allocators to + * consume all freed pages while old allocators wait. + */ + mtx_lock(&vm_domainset_lock); + if (DOMAINSET_SUBSET(&vm_min_domains, wdoms)) { + vm_min_waiters++; + msleep(&vm_min_domains, &vm_domainset_lock, PVM, + "vmwait", 0); + } + mtx_unlock(&vm_domainset_lock); + } } /* @@ -2788,6 +2815,7 @@ void vm_wait_domain(int domain) { struct vm_domain *vmd; + domainset_t wdom; vmd = VM_DOMAIN(domain); vm_domain_free_assert_locked(vmd); @@ -2797,50 +2825,40 @@ vm_wait_domain(int domain) msleep(&vmd->vmd_pageout_pages_needed, vm_domain_free_lockptr(vmd), PDROP | PSWP, "VMWait", 0); } else { + vm_domain_free_unlock(vmd); if (pageproc == NULL) panic("vm_wait in early boot"); - pagedaemon_wait(domain, PVM, "vmwait"); + DOMAINSET_ZERO(&wdom); + DOMAINSET_SET(vmd->vmd_domain, &wdom); + vm_wait_doms(&wdom); } } /* - * vm_wait: (also see VM_WAIT macro) + * vm_wait: * - * Sleep until free pages are available for allocation. - * - Called in various places after failed memory allocations. + * Sleep until free pages are available for allocation in the + * affinity domains of the obj. If obj is NULL, the domain set + * for the calling thread is used. + * Called in various places after failed memory allocations. */ void -vm_wait(void) +vm_wait(vm_object_t obj) { + struct domainset *d; + d = NULL; + /* - * We use racey wakeup synchronization to avoid expensive global - * locking for the pageproc when sleeping with a non-specific vm_wait. - * To handle this, we only sleep for one tick in this instance. It - * is expected that most allocations for the pageproc will come from - * kmem or vm_page_grab* which will use the more specific and - * race-free vm_wait_domain(). + * Carefully fetch pointers only once: the struct domainset + * itself is ummutable but the pointer might change. */ - if (curproc == pageproc) { - mtx_lock(&vm_domainset_lock); - vm_pageproc_waiters++; - msleep(&vm_pageproc_waiters, &vm_domainset_lock, PVM, - "pageprocwait", 1); - mtx_unlock(&vm_domainset_lock); - } else { - /* - * XXX Ideally we would wait only until the allocation could - * be satisfied. This condition can cause new allocators to - * consume all freed pages while old allocators wait. - */ - mtx_lock(&vm_domainset_lock); - if (vm_page_count_min()) { - vm_min_waiters++; - msleep(&vm_min_domains, &vm_domainset_lock, PVM, - "vmwait", 0); - } - mtx_unlock(&vm_domainset_lock); - } + if (obj != NULL) + d = obj->domain.dr_policy; + if (d == NULL) + d = curthread->td_domain.dr_policy; + + vm_wait_doms(&d->ds_mask); } /* @@ -2877,7 +2895,7 @@ vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_ } /* - * vm_waitpfault: (also see VM_WAITPFAULT macro) + * vm_waitpfault: * * Sleep until free pages are available for allocation. * - Called only in vm_fault so that processes page faulting @@ -3071,10 +3089,6 @@ vm_domain_free_wakeup(struct vm_domain *vmd) * high water mark. And wakeup scheduler process if we have * lots of memory. this process will swapin processes. */ - if (vmd->vmd_pages_needed && !vm_paging_min(vmd)) { - vmd->vmd_pages_needed = false; - wakeup(&vmd->vmd_free_count); - } if ((vmd->vmd_minset && !vm_paging_min(vmd)) || (vmd->vmd_severeset && !vm_paging_severe(vmd))) vm_domain_clear(vmd); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/vm/vm_pageout.c Tue Feb 20 10:13:13 2018 (r329636) @@ -1750,8 +1750,6 @@ vm_pageout_oom(int shortage) } sx_sunlock(&allproc_lock); if (bigproc != NULL) { - int i; - if (vm_panic_on_oom != 0) panic("out of swap space"); PROC_LOCK(bigproc); @@ -1759,8 +1757,6 @@ vm_pageout_oom(int shortage) sched_nice(bigproc, PRIO_MIN); _PRELE(bigproc); PROC_UNLOCK(bigproc); - for (i = 0; i < vm_ndomains; i++) - wakeup(&VM_DOMAIN(i)->vmd_free_count); } } @@ -1796,23 +1792,6 @@ vm_pageout_worker(void *arg) vm_domain_free_lock(vmd); /* - * Generally, after a level >= 1 scan, if there are enough - * free pages to wakeup the waiters, then they are already - * awake. A call to vm_page_free() during the scan awakened - * them. However, in the following case, this wakeup serves - * to bound the amount of time that a thread might wait. - * Suppose a thread's call to vm_page_alloc() fails, but - * before that thread calls VM_WAIT, enough pages are freed by - * other threads to alleviate the free page shortage. The - * thread will, nonetheless, wait until another page is freed - * or this wakeup is performed. - */ - if (vmd->vmd_pages_needed && !vm_paging_min(vmd)) { - vmd->vmd_pages_needed = false; - wakeup(&vmd->vmd_free_count); - } - - /* * Do not clear vmd_pageout_wanted until we reach our free page * target. Otherwise, we may be awakened over and over again, * wasting CPU time. @@ -1840,16 +1819,12 @@ vm_pageout_worker(void *arg) pass++; } else { /* - * Yes. If threads are still sleeping in VM_WAIT + * Yes. If threads are still sleeping in vm_wait() * then we immediately start a new scan. Otherwise, * sleep until the next wakeup or until pages need to * have their reference stats updated. */ - if (vmd->vmd_pages_needed) { - vm_domain_free_unlock(vmd); - if (pass == 0) - pass++; - } else if (mtx_sleep(&vmd->vmd_pageout_wanted, + if (mtx_sleep(&vmd->vmd_pageout_wanted, vm_domain_free_lockptr(vmd), PDROP | PVM, "psleep", hz) == 0) { VM_CNT_INC(v_pdwakeups); @@ -1999,34 +1974,4 @@ pagedaemon_wakeup(int domain) vmd->vmd_pageout_wanted = true; wakeup(&vmd->vmd_pageout_wanted); } -} - -/* - * Wake up the page daemon and wait for it to reclaim free pages. - * - * This function returns with the free queues mutex unlocked. - */ -void -pagedaemon_wait(int domain, int pri, const char *wmesg) -{ - struct vm_domain *vmd; - - vmd = VM_DOMAIN(domain); - vm_domain_free_assert_locked(vmd); - - /* - * vmd_pageout_wanted may have been set by an advisory wakeup, but if - * the page daemon is running on a CPU, the wakeup will have been lost. - * Thus, deliver a potentially spurious wakeup to ensure that the page - * daemon has been notified of the shortage. - */ - if (!vmd->vmd_pageout_wanted || !vmd->vmd_pages_needed) { - vmd->vmd_pageout_wanted = true; - wakeup(&vmd->vmd_pageout_wanted); - } - vmd->vmd_pages_needed = true; - vmd->vmd_waiters++; - msleep(&vmd->vmd_free_count, vm_domain_free_lockptr(vmd), PDROP | pri, - wmesg, 0); - vmd->vmd_waiters--; } Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/vm/vm_pageout.h Tue Feb 20 10:13:13 2018 (r329636) @@ -93,11 +93,8 @@ extern int vm_pageout_page_count; * Signal pageout-daemon and wait for it. */ -void pagedaemon_wait(int domain, int pri, const char *wmesg); void pagedaemon_wakeup(int domain); -#define VM_WAIT vm_wait() -#define VM_WAITPFAULT vm_waitpfault() -void vm_wait(void); +void vm_wait(vm_object_t obj); void vm_waitpfault(void); void vm_wait_domain(int domain); void vm_wait_min(void); Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Tue Feb 20 07:30:57 2018 (r329635) +++ head/sys/vm/vm_pagequeue.h Tue Feb 20 10:13:13 2018 (r329636) @@ -93,8 +93,6 @@ struct vm_domain { int vmd_pageout_pages_needed; /* page daemon waiting for pages? */ int vmd_pageout_deficit; /* Estimated number of pages deficit */ - int vmd_waiters; /* Pageout waiters. */ - bool vmd_pages_needed; /* Are threads waiting for free pages? */ bool vmd_pageout_wanted; /* pageout daemon wait channel */ bool vmd_minset; /* Are we in vm_min_domains? */ bool vmd_severeset; /* Are we in vm_severe_domains? */ From owner-svn-src-all@freebsd.org Tue Feb 20 10:34:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01A19F1A74E; Tue, 20 Feb 2018 10:34:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A86B56F6CC; Tue, 20 Feb 2018 10:34:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F460383; Tue, 20 Feb 2018 10:34:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KAYFx3048341; Tue, 20 Feb 2018 10:34:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KAYFE5048340; Tue, 20 Feb 2018 10:34:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802201034.w1KAYFE5048340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Feb 2018 10:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329637 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 10:34:16 -0000 Author: kib Date: Tue Feb 20 10:34:15 2018 New Revision: 329637 URL: https://svnweb.freebsd.org/changeset/base/329637 Log: MFC r329215: Do not leak rv->psind in some specific situations. Modified: stable/11/sys/vm/vm_reserv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_reserv.c ============================================================================== --- stable/11/sys/vm/vm_reserv.c Tue Feb 20 10:13:13 2018 (r329636) +++ stable/11/sys/vm/vm_reserv.c Tue Feb 20 10:34:15 2018 (r329637) @@ -746,6 +746,7 @@ vm_reserv_break(vm_reserv_t rv, vm_page_t m) ("vm_reserv_break: reserv %p's inpartpopq is TRUE", rv)); LIST_REMOVE(rv, objq); rv->object = NULL; + rv->pages->psind = 0; if (m != NULL) { /* * Since the reservation is being broken, there is no harm in From owner-svn-src-all@freebsd.org Tue Feb 20 10:35:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B5B7F1A949; Tue, 20 Feb 2018 10:35:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A5746F8B4; Tue, 20 Feb 2018 10:35:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4540A385; Tue, 20 Feb 2018 10:35:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KAZEbk048439; Tue, 20 Feb 2018 10:35:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KAZETN048438; Tue, 20 Feb 2018 10:35:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802201035.w1KAZETN048438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 20 Feb 2018 10:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329638 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 10:35:14 -0000 Author: kib Date: Tue Feb 20 10:35:13 2018 New Revision: 329638 URL: https://svnweb.freebsd.org/changeset/base/329638 Log: MFC r329216: linuxkpi: Do not leak pages on put. Modified: stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/mm.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Tue Feb 20 10:34:15 2018 (r329637) +++ stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Tue Feb 20 10:35:13 2018 (r329638) @@ -243,7 +243,8 @@ static inline void put_page(struct vm_page *page) { vm_page_lock(page); - vm_page_unwire(page, PQ_ACTIVE); + if (vm_page_unwire(page, PQ_ACTIVE) && page->object == NULL) + vm_page_free(page); vm_page_unlock(page); } From owner-svn-src-all@freebsd.org Tue Feb 20 10:52:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B13A8F1BEA0; Tue, 20 Feb 2018 10:52:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FECC7043A; Tue, 20 Feb 2018 10:52:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AFB468D; Tue, 20 Feb 2018 10:52:07 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KAq7Um057925; Tue, 20 Feb 2018 10:52:07 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KAq7jQ057924; Tue, 20 Feb 2018 10:52:07 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802201052.w1KAq7jQ057924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Feb 2018 10:52:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329639 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 10:52:07 -0000 Author: mjg Date: Tue Feb 20 10:52:07 2018 New Revision: 329639 URL: https://svnweb.freebsd.org/changeset/base/329639 Log: Make killpg1 perform process validity checks without proc lock held. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Feb 20 10:35:13 2018 (r329638) +++ head/sys/kern/kern_sig.c Tue Feb 20 10:52:07 2018 (r329639) @@ -1677,12 +1677,11 @@ killpg1(struct thread *td, int sig, int pgid, int all, */ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || p == td->td_proc || p->p_state == PRS_NEW) { - PROC_UNLOCK(p); continue; } + PROC_LOCK(p); err = p_cansignal(td, p, sig); if (err == 0) { if (sig) From owner-svn-src-all@freebsd.org Tue Feb 20 10:58:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E2E4F1C67D; Tue, 20 Feb 2018 10:58:40 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C0A9E70785; Tue, 20 Feb 2018 10:58:39 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id DC6D825D3A80; Tue, 20 Feb 2018 10:58:37 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 20942D1F7F1; Tue, 20 Feb 2018 10:58:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id aCYBBLT18PjW; Tue, 20 Feb 2018 10:58:35 +0000 (UTC) Received: from [10.248.122.60] (fresh-ayiya.sbone.de [IPv6:fde9:577b:c1a9:f001::2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 3A427D1F7E5; Tue, 20 Feb 2018 10:58:35 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Mateusz Guzik" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329639 - head/sys/kern Date: Tue, 20 Feb 2018 10:58:33 +0000 X-Mailer: MailMate (2.0BETAr6103) Message-ID: <2A592C68-C6B3-4BAA-975C-02D325292C02@lists.zabbadoz.net> In-Reply-To: <201802201052.w1KAq7jQ057924@repo.freebsd.org> References: <201802201052.w1KAq7jQ057924@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 10:58:40 -0000 On 20 Feb 2018, at 10:52, Mateusz Guzik wrote: > Author: mjg > Date: Tue Feb 20 10:52:07 2018 > New Revision: 329639 > URL: https://svnweb.freebsd.org/changeset/base/329639 > > Log: > Make killpg1 perform process validity checks without proc lock held. I appreciate all these locking improvements! I would feel a lot more easy about them if the commit message would also detail why these changes are possible (e.g. only read-only variables accessed, or variables only ever accessed thread local, ..) and not just what the change is (which the diff also tells). Also, are there people reviewing all these changes? /bz > Modified: > head/sys/kern/kern_sig.c > > Modified: head/sys/kern/kern_sig.c > ============================================================================== > --- head/sys/kern/kern_sig.c Tue Feb 20 10:35:13 2018 (r329638) > +++ head/sys/kern/kern_sig.c Tue Feb 20 10:52:07 2018 (r329639) > @@ -1677,12 +1677,11 @@ killpg1(struct thread *td, int sig, int pgid, > int all, > */ > sx_slock(&allproc_lock); > FOREACH_PROC_IN_SYSTEM(p) { > - PROC_LOCK(p); > if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || > p == td->td_proc || p->p_state == PRS_NEW) { > - PROC_UNLOCK(p); > continue; > } > + PROC_LOCK(p); > err = p_cansignal(td, p, sig); > if (err == 0) { > if (sig) From owner-svn-src-all@freebsd.org Tue Feb 20 11:42:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F10FF20F19; Tue, 20 Feb 2018 11:42:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA6DA7255B; Tue, 20 Feb 2018 11:42:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w1KBgf9c070176 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Feb 2018 13:42:44 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w1KBgf9c070176 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w1KBgfXx070175; Tue, 20 Feb 2018 13:42:41 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Feb 2018 13:42:41 +0200 From: Konstantin Belousov To: "Bjoern A. Zeeb" Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329639 - head/sys/kern Message-ID: <20180220114241.GH94212@kib.kiev.ua> References: <201802201052.w1KAq7jQ057924@repo.freebsd.org> <2A592C68-C6B3-4BAA-975C-02D325292C02@lists.zabbadoz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2A592C68-C6B3-4BAA-975C-02D325292C02@lists.zabbadoz.net> User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 11:42:53 -0000 On Tue, Feb 20, 2018 at 10:58:33AM +0000, Bjoern A. Zeeb wrote: > On 20 Feb 2018, at 10:52, Mateusz Guzik wrote: > > > Author: mjg > > Date: Tue Feb 20 10:52:07 2018 > > New Revision: 329639 > > URL: https://svnweb.freebsd.org/changeset/base/329639 > > > > Log: > > Make killpg1 perform process validity checks without proc lock held. > > I appreciate all these locking improvements! > > I would feel a lot more easy about them if the commit message would also > detail why these changes are possible (e.g. only read-only variables > accessed, or variables only ever accessed thread local, ..) and not just > what the change is (which the diff also tells). Removing PRS_NEW is certainly not safe. > > Also, are there people reviewing all these changes? > From owner-svn-src-all@freebsd.org Tue Feb 20 14:36:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D66F06E14; Tue, 20 Feb 2018 14:36:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB90879AC4; Tue, 20 Feb 2018 14:36:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1D412A1A; Tue, 20 Feb 2018 14:36:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KEaSoH067846; Tue, 20 Feb 2018 14:36:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KEaSXn067843; Tue, 20 Feb 2018 14:36:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201436.w1KEaSXn067843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 14:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329640 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 14:36:29 -0000 Author: kevans Date: Tue Feb 20 14:36:28 2018 New Revision: 329640 URL: https://svnweb.freebsd.org/changeset/base/329640 Log: stand/lua: Consistently declare local functions at module scope Declare these adjacent to the local definitions at the top of the module, and make sure they're actually declared local to pollute global namespace a little bit less. Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/screen.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 10:52:07 2018 (r329639) +++ head/stand/lua/drawer.lua Tue Feb 20 14:36:28 2018 (r329640) @@ -41,6 +41,24 @@ local orb; local none; local none_shifted = false; +local menu_entry_name = function(drawing_menu, entry) + local name_handler = drawer.menu_name_handlers[entry.entry_type]; + + if (name_handler ~= nil) then + return name_handler(drawing_menu, entry); + end + return entry.name(); +end + +local shift_brand_text = function(shift) + drawer.brand_position.x = drawer.brand_position.x + shift.x; + drawer.brand_position.y = drawer.brand_position.y + shift.y; + drawer.menu_position.x = drawer.menu_position.x + shift.x; + drawer.menu_position.y = drawer.menu_position.y + shift.y; + drawer.box_pos_dim.x = drawer.box_pos_dim.x + shift.x; + drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; +end + drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being -- drawn as parameters, and return the name of the item. @@ -228,15 +246,6 @@ function drawer.drawscreen(menu_opts) return drawer.drawmenu(menu_opts); end -function menu_entry_name(drawing_menu, entry) - local name_handler = drawer.menu_name_handlers[entry.entry_type]; - - if (name_handler ~= nil) then - return name_handler(drawing_menu, entry); - end - return entry.name(); -end - function drawer.drawmenu(m) x = drawer.menu_position.x; y = drawer.menu_position.y; @@ -332,15 +341,6 @@ function drawer.drawbrand() graphic = fbsd_logo; end drawer.draw(x, y, graphic); -end - -function shift_brand_text(shift) - drawer.brand_position.x = drawer.brand_position.x + shift.x; - drawer.brand_position.y = drawer.brand_position.y + shift.y; - drawer.menu_position.x = drawer.menu_position.x + shift.x; - drawer.menu_position.y = drawer.menu_position.y + shift.y; - drawer.box_pos_dim.x = drawer.box_pos_dim.x + shift.x; - drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; end function drawer.drawlogo() Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 10:52:07 2018 (r329639) +++ head/stand/lua/menu.lua Tue Feb 20 14:36:28 2018 (r329640) @@ -36,12 +36,22 @@ local drawer = require("drawer"); local menu = {}; -local OnOff; local skip; local run; local autoboot; local carousel_choices = {}; +local OnOff = function(str, b) + if (b) then + return str .. color.escapef(color.GREEN) .. "On" .. + color.escapef(color.WHITE); + else + return str .. color.escapef(color.RED) .. "off" .. + color.escapef(color.WHITE); + end +end + + menu.handlers = { -- Menu handlers take the current menu and selected entry as parameters, -- and should return a boolean indicating whether execution should @@ -459,16 +469,6 @@ function menu.autoboot() until time <= 0; core.boot(); -end - -function OnOff(str, b) - if (b) then - return str .. color.escapef(color.GREEN) .. "On" .. - color.escapef(color.WHITE); - else - return str .. color.escapef(color.RED) .. "off" .. - color.escapef(color.WHITE); - end end return menu; Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Tue Feb 20 10:52:07 2018 (r329639) +++ head/stand/lua/screen.lua Tue Feb 20 14:36:28 2018 (r329640) @@ -32,7 +32,7 @@ local core = require("core"); local screen = {}; -- XXX TODO: This should be fixed in the interpreter to not print decimals -function intstring(num) +local intstring = function(num) local str = tostring(num); local decimal = str:find("%."); From owner-svn-src-all@freebsd.org Tue Feb 20 14:46:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFE17F0792B; Tue, 20 Feb 2018 14:45:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F89F7A0AF; Tue, 20 Feb 2018 14:45:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A89B2BC6; Tue, 20 Feb 2018 14:45:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KEjxKM072789; Tue, 20 Feb 2018 14:45:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KEjwOa072782; Tue, 20 Feb 2018 14:45:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201445.w1KEjwOa072782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 14:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329641 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 14:46:00 -0000 Author: kevans Date: Tue Feb 20 14:45:58 2018 New Revision: 329641 URL: https://svnweb.freebsd.org/changeset/base/329641 Log: stand/lua: Consistently organize modules We follow pretty closely the following structure of a module: 1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment. Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/password.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/color.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -30,6 +30,7 @@ local core = require("core"); local color = {}; +-- Module exports color.BLACK = 0; color.RED = 1; color.GREEN = 2; Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/config.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -28,52 +28,9 @@ -- local config = {}; --- Which variables we changed -config.env_changed = {}; --- Values to restore env to (nil to unset) -config.env_restore = {}; local modules = {}; -function config.restoreEnv() - for k, v in pairs(config.env_changed) do - local restore_value = config.env_restore[k]; - if (restore_value ~= nil) then - loader.setenv(k, restore_value); - else - loader.unsetenv(k); - end - end - - config.env_changed = {}; - config.env_restore = {}; -end - -function config.setenv(k, v) - -- Do we need to track this change? - if (config.env_changed[k] == nil) then - config.env_changed[k] = true; - config.env_restore[k] = loader.getenv(k); - end - - return loader.setenv(k, v); -end - -function config.setKey(k, n, v) - if (modules[k] == nil) then - modules[k] = {}; - end - modules[k][n] = v; -end - -function config.lsModules() - print("== Listing modules"); - for k, v in pairs(modules) do - print(k, v.load); - end - print("== List of modules ended"); -end - local pattern_table = { [1] = { str = "^%s*(#.*)", @@ -162,6 +119,52 @@ local pattern_table = { } }; +-- Module exports +-- Which variables we changed +config.env_changed = {}; +-- Values to restore env to (nil to unset) +config.env_restore = {}; + +function config.restoreEnv() + for k, v in pairs(config.env_changed) do + local restore_value = config.env_restore[k]; + if (restore_value ~= nil) then + loader.setenv(k, restore_value); + else + loader.unsetenv(k); + end + end + + config.env_changed = {}; + config.env_restore = {}; +end + +function config.setenv(k, v) + -- Do we need to track this change? + if (config.env_changed[k] == nil) then + config.env_changed[k] = true; + config.env_restore[k] = loader.getenv(k); + end + + return loader.setenv(k, v); +end + +function config.setKey(k, n, v) + if (modules[k] == nil) then + modules[k] = {}; + end + modules[k][n] = v; +end + +function config.lsModules() + print("== Listing modules"); + for k, v in pairs(modules) do + print(k, v.load); + end + print("== List of modules ended"); +end + + function config.isValidComment(c) if (c ~= nil) then local s = c:match("^%s*#.*"); @@ -432,6 +435,5 @@ function config.loadelf() print("Could not load one or more modules!"); end end - return config; Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/core.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -30,6 +30,7 @@ local config = require('config'); local core = {}; +-- Module exports -- Commonly appearing constants core.KEY_BACKSPACE = 8; core.KEY_ENTER = 13; Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/drawer.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -59,29 +59,6 @@ local shift_brand_text = function(shift) drawer.box_pos_dim.y = drawer.box_pos_dim.y + shift.y; end -drawer.menu_name_handlers = { - -- Menu name handlers should take the menu being drawn and entry being - -- drawn as parameters, and return the name of the item. - -- This is designed so that everything, including menu separators, may - -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) - local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = entry.items(); - - if (#choices < caridx) then - caridx = 1; - end - return entry.name(caridx, choices[caridx], choices); - end, -}; - -drawer.brand_position = {x = 2, y = 1}; -drawer.logo_position = {x = 46, y = 1}; -drawer.menu_position = {x = 6, y = 11}; -drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; - fbsd_logo = { " ______ ____ _____ _____ ", " | ____| | _ \\ / ____| __ \\ ", @@ -189,6 +166,30 @@ orb = { }; none = {""}; + +-- Module exports +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + +drawer.brand_position = {x = 2, y = 1}; +drawer.logo_position = {x = 46, y = 1}; +drawer.menu_position = {x = 6, y = 11}; +drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; drawer.branddefs = { -- Indexed by valid values for loader_brand in loader.conf(5). Valid Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/menu.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -51,7 +51,7 @@ local OnOff = function(str, b) end end - +-- Module exports menu.handlers = { -- Menu handlers take the current menu and selected entry as parameters, -- and should return a boolean indicating whether execution should Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/password.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -32,6 +32,7 @@ local screen = require("screen"); local password = {}; +-- Module exports function password.read() local str = ""; local n = 0; Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Tue Feb 20 14:36:28 2018 (r329640) +++ head/stand/lua/screen.lua Tue Feb 20 14:45:58 2018 (r329641) @@ -42,6 +42,7 @@ local intstring = function(num) return str; end +-- Module exports function screen.clear() if (core.isSerialBoot()) then return; From owner-svn-src-all@freebsd.org Tue Feb 20 14:59:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B91EF08AF5; Tue, 20 Feb 2018 14:59:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E247B7A8D3; Tue, 20 Feb 2018 14:59:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD1B22D6C; Tue, 20 Feb 2018 14:59:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KExTpS077794; Tue, 20 Feb 2018 14:59:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KExT0q077793; Tue, 20 Feb 2018 14:59:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802201459.w1KExT0q077793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Feb 2018 14:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329642 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 329642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 14:59:30 -0000 Author: ian Date: Tue Feb 20 14:59:29 2018 New Revision: 329642 URL: https://svnweb.freebsd.org/changeset/base/329642 Log: Adjust whitespace of things added in the past couple years to match the original style of the file. No functional changes. Modified: head/sys/arm/freescale/imx/imx6_ccmreg.h Modified: head/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccmreg.h Tue Feb 20 14:45:58 2018 (r329641) +++ head/sys/arm/freescale/imx/imx6_ccmreg.h Tue Feb 20 14:59:29 2018 (r329642) @@ -31,113 +31,113 @@ #ifndef IMX6_CCMREG_H #define IMX6_CCMREG_H -#define CCM_CACCR 0x010 -#define CCM_CBCDR 0x014 -#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 -#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) -#define CCM_CSCMR1 0x01C -#define SSI1_CLK_SEL_S 10 -#define SSI2_CLK_SEL_S 12 -#define SSI3_CLK_SEL_S 14 -#define SSI_CLK_SEL_M 0x3 -#define SSI_CLK_SEL_508_PFD 0 -#define SSI_CLK_SEL_454_PFD 1 -#define SSI_CLK_SEL_PLL4 2 -#define CCM_CSCMR2 0x020 -#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 -#define CCM_CS1CDR 0x028 -#define SSI1_CLK_PODF_SHIFT 0 -#define SSI1_CLK_PRED_SHIFT 6 -#define SSI3_CLK_PODF_SHIFT 16 -#define SSI3_CLK_PRED_SHIFT 22 -#define SSI_CLK_PODF_MASK 0x3f -#define SSI_CLK_PRED_MASK 0x7 -#define CCM_CS2CDR 0x02C -#define SSI2_CLK_PODF_SHIFT 0 -#define SSI2_CLK_PRED_SHIFT 6 -#define LDB_DI0_CLK_SEL_SHIFT 9 -#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) -#define CCM_CHSCCDR 0x034 -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 -#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) -#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 -#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) -#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 -#define CHSCCDR_CLK_SEL_LDB_DI0 3 -#define CHSCCDR_PODF_DIVIDE_BY_3 2 -#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 -#define CCM_CSCDR2 0x038 -#define CCM_CLPCR 0x054 -#define CCM_CLPCR_LPM_MASK 0x03 -#define CCM_CLPCR_LPM_RUN 0x00 -#define CCM_CLPCR_LPM_WAIT 0x01 -#define CCM_CLPCR_LPM_STOP 0x02 -#define CCM_CGPR 0x064 -#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) -#define CCM_CCGR0 0x068 -#define CCGR0_AIPS_TZ1 (0x3 << 0) -#define CCGR0_AIPS_TZ2 (0x3 << 2) -#define CCGR0_ABPHDMA (0x3 << 4) -#define CCM_CCGR1 0x06C -#define CCGR1_ENET (0x3 << 10) -#define CCGR1_EPIT1 (0x3 << 12) -#define CCGR1_EPIT2 (0x3 << 14) -#define CCGR1_GPT (0x3 << 20) -#define CCGR1_GPT_SERIAL (0x3 << 22) -#define CCM_CCGR2 0x070 -#define CCGR2_HDMI_TX (0x3 << 0) -#define CCGR2_HDMI_TX_ISFR (0x3 << 4) -#define CCGR2_I2C1 (0x3 << 6) -#define CCGR2_I2C2 (0x3 << 8) -#define CCGR2_I2C3 (0x3 << 10) -#define CCGR2_IIM (0x3 << 12) -#define CCGR2_IOMUX_IPT (0x3 << 14) -#define CCGR2_IPMUX1 (0x3 << 16) -#define CCGR2_IPMUX2 (0x3 << 18) -#define CCGR2_IPMUX3 (0x3 << 20) -#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) -#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) -#define CCGR2_IPSYNC_VDOA (0x3 << 26) -#define CCM_CCGR3 0x074 -#define CCGR3_IPU1_IPU (0x3 << 0) -#define CCGR3_IPU1_DI0 (0x3 << 2) -#define CCGR3_IPU1_DI1 (0x3 << 4) -#define CCGR3_IPU2_IPU (0x3 << 6) -#define CCGR3_IPU2_DI0 (0x3 << 8) -#define CCGR3_IPU2_DI1 (0x3 << 10) -#define CCGR3_LDB_DI0 (0x3 << 12) -#define CCGR3_LDB_DI1 (0x3 << 14) -#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) -#define CCGR3_CG11 (0x3 << 22) -#define CCGR3_MMDC_CORE_IPG (0x3 << 24) -#define CCGR3_CG13 (0x3 << 26) -#define CCGR3_OCRAM (0x3 << 28) -#define CCM_CCGR4 0x078 -#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) -#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) -#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) -#define CCM_CCGR5 0x07C -#define CCGR5_SATA (0x3 << 4) -#define CCGR5_SDMA (0x3 << 6) -#define CCGR5_SSI1 (0x3 << 18) -#define CCGR5_SSI2 (0x3 << 20) -#define CCGR5_SSI3 (0x3 << 22) -#define CCGR5_UART (0x3 << 24) -#define CCGR5_UART_SERIAL (0x3 << 26) -#define CCM_CCGR6 0x080 -#define CCGR6_USBOH3 (0x3 << 0) -#define CCGR6_USDHC1 (0x3 << 2) -#define CCGR6_USDHC2 (0x3 << 4) -#define CCGR6_USDHC3 (0x3 << 6) -#define CCGR6_USDHC4 (0x3 << 8) -#define CCM_CMEOR 0x088 - -#define CCM_ANALOG_PLL_ENET 0x000040e0 -#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) -#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ -#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) -#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ -#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) +#define CCM_CACCR 0x010 +#define CCM_CBCDR 0x014 +#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 +#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) +#define CCM_CSCMR1 0x01C +#define SSI1_CLK_SEL_S 10 +#define SSI2_CLK_SEL_S 12 +#define SSI3_CLK_SEL_S 14 +#define SSI_CLK_SEL_M 0x3 +#define SSI_CLK_SEL_508_PFD 0 +#define SSI_CLK_SEL_454_PFD 1 +#define SSI_CLK_SEL_PLL4 2 +#define CCM_CSCMR2 0x020 +#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 +#define CCM_CS1CDR 0x028 +#define SSI1_CLK_PODF_SHIFT 0 +#define SSI1_CLK_PRED_SHIFT 6 +#define SSI3_CLK_PODF_SHIFT 16 +#define SSI3_CLK_PRED_SHIFT 22 +#define SSI_CLK_PODF_MASK 0x3f +#define SSI_CLK_PRED_MASK 0x7 +#define CCM_CS2CDR 0x02C +#define SSI2_CLK_PODF_SHIFT 0 +#define SSI2_CLK_PRED_SHIFT 6 +#define LDB_DI0_CLK_SEL_SHIFT 9 +#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) +#define CCM_CHSCCDR 0x034 +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 +#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) +#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 +#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) +#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 +#define CHSCCDR_CLK_SEL_LDB_DI0 3 +#define CHSCCDR_PODF_DIVIDE_BY_3 2 +#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 +#define CCM_CSCDR2 0x038 +#define CCM_CLPCR 0x054 +#define CCM_CLPCR_LPM_MASK 0x03 +#define CCM_CLPCR_LPM_RUN 0x00 +#define CCM_CLPCR_LPM_WAIT 0x01 +#define CCM_CLPCR_LPM_STOP 0x02 +#define CCM_CGPR 0x064 +#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) +#define CCM_CCGR0 0x068 +#define CCGR0_AIPS_TZ1 (0x3 << 0) +#define CCGR0_AIPS_TZ2 (0x3 << 2) +#define CCGR0_ABPHDMA (0x3 << 4) +#define CCM_CCGR1 0x06C +#define CCGR1_ENET (0x3 << 10) +#define CCGR1_EPIT1 (0x3 << 12) +#define CCGR1_EPIT2 (0x3 << 14) +#define CCGR1_GPT (0x3 << 20) +#define CCGR1_GPT_SERIAL (0x3 << 22) +#define CCM_CCGR2 0x070 +#define CCGR2_HDMI_TX (0x3 << 0) +#define CCGR2_HDMI_TX_ISFR (0x3 << 4) +#define CCGR2_I2C1 (0x3 << 6) +#define CCGR2_I2C2 (0x3 << 8) +#define CCGR2_I2C3 (0x3 << 10) +#define CCGR2_IIM (0x3 << 12) +#define CCGR2_IOMUX_IPT (0x3 << 14) +#define CCGR2_IPMUX1 (0x3 << 16) +#define CCGR2_IPMUX2 (0x3 << 18) +#define CCGR2_IPMUX3 (0x3 << 20) +#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) +#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) +#define CCGR2_IPSYNC_VDOA (0x3 << 26) +#define CCM_CCGR3 0x074 +#define CCGR3_IPU1_IPU (0x3 << 0) +#define CCGR3_IPU1_DI0 (0x3 << 2) +#define CCGR3_IPU1_DI1 (0x3 << 4) +#define CCGR3_IPU2_IPU (0x3 << 6) +#define CCGR3_IPU2_DI0 (0x3 << 8) +#define CCGR3_IPU2_DI1 (0x3 << 10) +#define CCGR3_LDB_DI0 (0x3 << 12) +#define CCGR3_LDB_DI1 (0x3 << 14) +#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) +#define CCGR3_CG11 (0x3 << 22) +#define CCGR3_MMDC_CORE_IPG (0x3 << 24) +#define CCGR3_CG13 (0x3 << 26) +#define CCGR3_OCRAM (0x3 << 28) +#define CCM_CCGR4 0x078 +#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) +#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) +#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) +#define CCM_CCGR5 0x07C +#define CCGR5_SATA (0x3 << 4) +#define CCGR5_SDMA (0x3 << 6) +#define CCGR5_SSI1 (0x3 << 18) +#define CCGR5_SSI2 (0x3 << 20) +#define CCGR5_SSI3 (0x3 << 22) +#define CCGR5_UART (0x3 << 24) +#define CCGR5_UART_SERIAL (0x3 << 26) +#define CCM_CCGR6 0x080 +#define CCGR6_USBOH3 (0x3 << 0) +#define CCGR6_USDHC1 (0x3 << 2) +#define CCGR6_USDHC2 (0x3 << 4) +#define CCGR6_USDHC3 (0x3 << 6) +#define CCGR6_USDHC4 (0x3 << 8) +#define CCM_CMEOR 0x088 + +#define CCM_ANALOG_PLL_ENET 0x000040e0 +#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) +#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ +#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) +#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ +#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) #endif From owner-svn-src-all@freebsd.org Tue Feb 20 16:10:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9430EF10331; Tue, 20 Feb 2018 16:10:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EC787DDBE; Tue, 20 Feb 2018 16:10:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id d14so17019023qtg.1; Tue, 20 Feb 2018 08:10:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/4PLTBUDbNjmERDBh3iHgv3CBQbfxYQ8HaOESp7LDe8=; b=MSgnPpTEMi5kk6+Gy3objQLNT5ftXoBlrO2T+YvPwHW3j6IumU1tsuFSfwxYEgjQOA mUiLfoCk9clr7dB+fpT9ygNdgUDR0w1FYFOVk6FuDBbJJBiCC1oTrpkuPsSawgTqI5Vm vMFx7mosrUL2Cz6h9yveG7uP1mDOHeiIjfZJ5yMY8n6E0bKdS8cpx7TgaTPF32SJ1Ke5 TeFKlo8s+lLjQV6zW2zXCvb9Fw997kR02hW0vVRR+LTqwncs4tseblWq5B33NfWtkL+i /aDXgq4gAlbeky4n6hpsVfgmgAzUaSVNe52vPsWQcUANP8AVz2JeENxb6CR4QHIjPI7r 8TlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/4PLTBUDbNjmERDBh3iHgv3CBQbfxYQ8HaOESp7LDe8=; b=HUm4986ZGIGCWbArn7tMCSj1DdNwBh2D8EoxfCAQInWlxW3wywcHZLPVDGJ5umj6kM ySznuioPwyIvoAaMd7h1q91/PnvNawKtVn59ooQw9GucZ1gPbf+zULDjr7NcN7p5IQwP XzhO13u8tADKYrV4gO/o0AMHE0Px8QvuK7EGSctfTWialu4afRmZxjdq24vD0O6qM0bA 8ohKAIUSSOb2/yDhzzq38BrEfUS9+5wY7jShNYlLJcyUqu/Ws0CxcT0ljBIzmE3JNtgC 6E0PAMKFcJgnIKI/BCUUl6ICcBwyQzMCwSRX4BaSY47gN5qbgktrK7srjk/50njMeYM/ Qf4A== X-Gm-Message-State: APf1xPBwN4n6MkJZoKrhOi4qlT2tBCuaJtVTNAcdiov+r/XIkPIjtbGj IZKuDgO53YronY75nFgXoy+mFv4/GBzKgTQUCy5L5A== X-Google-Smtp-Source: AH8x225sWyYT/4sPk3q1JiOwjL0FOqK0Y2LZR3oxTS/WlcIie5yErHPI8Ba93tLNhWC9DMlgmsmhqB8w4ya76Q/V7Q0= X-Received: by 10.200.16.11 with SMTP id z11mr197762qti.292.1519143052725; Tue, 20 Feb 2018 08:10:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.35.42 with HTTP; Tue, 20 Feb 2018 08:10:52 -0800 (PST) In-Reply-To: <20180220114241.GH94212@kib.kiev.ua> References: <201802201052.w1KAq7jQ057924@repo.freebsd.org> <2A592C68-C6B3-4BAA-975C-02D325292C02@lists.zabbadoz.net> <20180220114241.GH94212@kib.kiev.ua> From: Mateusz Guzik Date: Tue, 20 Feb 2018 17:10:52 +0100 Message-ID: Subject: Re: svn commit: r329639 - head/sys/kern To: Konstantin Belousov Cc: "Bjoern A. Zeeb" , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 16:10:53 -0000 On Tue, Feb 20, 2018 at 12:42 PM, Konstantin Belousov wrote: > On Tue, Feb 20, 2018 at 10:58:33AM +0000, Bjoern A. Zeeb wrote: > > On 20 Feb 2018, at 10:52, Mateusz Guzik wrote: > > > > > Author: mjg > > > Date: Tue Feb 20 10:52:07 2018 > > > New Revision: 329639 > > > URL: https://svnweb.freebsd.org/changeset/base/329639 > > > > > > Log: > > > Make killpg1 perform process validity checks without proc lock held. > > > > I appreciate all these locking improvements! > > > > I would feel a lot more easy about them if the commit message would also > > detail why these changes are possible (e.g. only read-only variables > > accessed, or variables only ever accessed thread local, ..) and not just > > what the change is (which the diff also tells). > Removing PRS_NEW is certainly not safe. > > As in doing unlocked? I don't see why. You mean it can't be safely tested once without the lock or it needs to be re-checked after locked? Due to allproc held at most it can transition from PRS_NEW to PRS_NORMAL. Thus if non-PRS_NEW is spotted, there is no need to recheck locked. As for racing the other way, the loop was already racy against fork. The only difference I see from that standapoint is that if the race catches the target locked, it will wait and have higher chances of seeing it fully formed. That is with previous code: fork: killpg xlock(&allproc); p->p_state = PRS_NEW; PROC_LOCK(p); xunlock(&allproc); ... PROC_UNLOCK(p); slock(&allproc); PROC_LOCK(p); if (p->p_state == PRS_NEW) /* tests true */ PROC_UNLOCK(p); sunlock(&allproc); ... PROC_LOCK(p); p->p_state = PRS_NORMAL; PROC_UNLOCK(p); For this case proc locking in killpg played no role. It can catch the process still locked from the area protected by allproc, which makes no difference in the outcome. For when it catches later: fork: killpg xlock(&allproc); p->p_state = PRS_NEW; PROC_LOCK(p); xunlock(&allproc); ... PROC_UNLOCK(p); ... PROC_LOCK(p); slock(&allproc); PROC_LOCK(p); starts.. p->p_state = PRS_NORMAL; PROC_UNLOCK(p); PROC_LOCK(p); ..finishes if (p->p_state == PRS_NEW) /* * tests false, signal * is delivered */ PROC_UNLOCK(p); sunlock(&allproc); But that was not guaranteed to begin with. The new code will simply miss this case, just like both old and new can miss it in other variations. Am I missing something here? -- Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Feb 20 16:27:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B58DF11AFB; Tue, 20 Feb 2018 16:27:27 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C6E37EDD5; Tue, 20 Feb 2018 16:27:26 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w1KGRB2N034302 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Feb 2018 18:27:14 +0200 (EET) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w1KGRB2N034302 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w1KGRBIV034301; Tue, 20 Feb 2018 18:27:11 +0200 (EET) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Tue, 20 Feb 2018 18:27:11 +0200 From: Konstantin Belousov To: Mateusz Guzik Cc: "Bjoern A. Zeeb" , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329639 - head/sys/kern Message-ID: <20180220162711.GK94212@kib.kiev.ua> References: <201802201052.w1KAq7jQ057924@repo.freebsd.org> <2A592C68-C6B3-4BAA-975C-02D325292C02@lists.zabbadoz.net> <20180220114241.GH94212@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 16:27:27 -0000 On Tue, Feb 20, 2018 at 05:10:52PM +0100, Mateusz Guzik wrote: > On Tue, Feb 20, 2018 at 12:42 PM, Konstantin Belousov > wrote: > > > On Tue, Feb 20, 2018 at 10:58:33AM +0000, Bjoern A. Zeeb wrote: > > > On 20 Feb 2018, at 10:52, Mateusz Guzik wrote: > > > > > > > Author: mjg > > > > Date: Tue Feb 20 10:52:07 2018 > > > > New Revision: 329639 > > > > URL: https://svnweb.freebsd.org/changeset/base/329639 > > > > > > > > Log: > > > > Make killpg1 perform process validity checks without proc lock held. > > > > > > I appreciate all these locking improvements! > > > > > > I would feel a lot more easy about them if the commit message would also > > > detail why these changes are possible (e.g. only read-only variables > > > accessed, or variables only ever accessed thread local, ..) and not just > > > what the change is (which the diff also tells). > > Removing PRS_NEW is certainly not safe. > > > > > As in doing unlocked? I don't see why. You mean it can't be safely > tested once without the lock or it needs to be re-checked after locked? The p_state field is read unlocked and it is possible to not see the last update to it. I believe that it must be re-checked after the proc lock is acquired. > > Due to allproc held at most it can transition from PRS_NEW to PRS_NORMAL. > Thus if non-PRS_NEW is spotted, there is no need to recheck locked. > > As for racing the other way, the loop was already racy against fork. > The only difference I see from that standapoint is that if the race > catches the target locked, it will wait and have higher chances of > seeing it fully formed. > > That is with previous code: > > fork: killpg > > xlock(&allproc); > p->p_state = PRS_NEW; > PROC_LOCK(p); > xunlock(&allproc); > ... > PROC_UNLOCK(p); > slock(&allproc); > PROC_LOCK(p); > if (p->p_state == PRS_NEW) > /* tests true */ > PROC_UNLOCK(p); > sunlock(&allproc); > > ... > PROC_LOCK(p); > p->p_state = PRS_NORMAL; > PROC_UNLOCK(p); > > For this case proc locking in killpg played no role. > > It can catch the process still locked from the area protected by > allproc, which makes no difference in the outcome. > > For when it catches later: > > fork: killpg > xlock(&allproc); > p->p_state = PRS_NEW; > PROC_LOCK(p); > xunlock(&allproc); > ... > PROC_UNLOCK(p); > ... > PROC_LOCK(p); > slock(&allproc); > PROC_LOCK(p); starts.. > p->p_state = PRS_NORMAL; > PROC_UNLOCK(p); > PROC_LOCK(p); ..finishes > if (p->p_state == PRS_NEW) > /* > * tests false, signal > * is delivered > */ > PROC_UNLOCK(p); > sunlock(&allproc); > > But that was not guaranteed to begin with. The new code will simply miss > this case, just like both old and new can miss it in other variations. > > Am I missing something here? p_state is declared to be locked by the proc lock (and proc slock, but I think this is a comment bug). Relying on occational allproc protection is wrong, or re-declare it as being double-protected both by proc lock and allproc. > > -- > Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Feb 20 17:29:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27285F175C7; Tue, 20 Feb 2018 17:29:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C256481C46; Tue, 20 Feb 2018 17:28:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD3704AC4; Tue, 20 Feb 2018 17:28:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KHSxOt054660; Tue, 20 Feb 2018 17:28:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KHSxZR054659; Tue, 20 Feb 2018 17:28:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802201728.w1KHSxZR054659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 20 Feb 2018 17:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329643 - head/stand/liblua X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/liblua X-SVN-Commit-Revision: 329643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 17:29:00 -0000 Author: imp Date: Tue Feb 20 17:28:59 2018 New Revision: 329643 URL: https://svnweb.freebsd.org/changeset/base/329643 Log: Implement loader.command This is just like loader.perform, except it takes pre-parsed arguments. Review: https://reviews.freebsd.org/D14448 Modified: head/stand/liblua/lutils.c Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Tue Feb 20 14:59:29 2018 (r329642) +++ head/stand/liblua/lutils.c Tue Feb 20 17:28:59 2018 (r329643) @@ -34,7 +34,32 @@ __FBSDID("$FreeBSD$"); #include "lutils.h" #include "bootstrap.h" +/* + * Like loader.perform, except args are passed already parsed + * on the stack. + */ static int +lua_command(lua_State *L) +{ + int i; + int res = 1; + int argc = lua_gettop(L); + char **argv; + + argv = malloc(sizeof(char *) * (argc + 1)); + if (argv == NULL) + return 0; + for (i = 0; i < argc; i++) + argv[i] = (char *)(intptr_t)luaL_checkstring(L, i + 1); + argv[argc] = NULL; + res = interp_builtin_cmd(argc, argv); + free(argv); + lua_pushinteger(L, res); + + return 1; +} + +static int lua_perform(lua_State *L) { int argc; @@ -213,6 +238,7 @@ lua_readfile(lua_State *L) #define REG_SIMPLE(n) { #n, lua_ ## n } static const struct luaL_Reg loaderlib[] = { REG_SIMPLE(delay), + REG_SIMPLE(command), REG_SIMPLE(getenv), REG_SIMPLE(perform), REG_SIMPLE(printc), From owner-svn-src-all@freebsd.org Tue Feb 20 17:46:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 156C2F18DBB; Tue, 20 Feb 2018 17:46:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC54782968; Tue, 20 Feb 2018 17:46:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B74CC4E15; Tue, 20 Feb 2018 17:46:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KHkopb064758; Tue, 20 Feb 2018 17:46:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KHko6n064756; Tue, 20 Feb 2018 17:46:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201746.w1KHko6n064756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 17:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329644 - in head/stand: common lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: common lua X-SVN-Commit-Revision: 329644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 17:46:51 -0000 Author: kevans Date: Tue Feb 20 17:46:50 2018 New Revision: 329644 URL: https://svnweb.freebsd.org/changeset/base/329644 Log: lualoader: Add ability to intercept cli commands If we failed to execute the input line as pure lua, run the command through parse for consistent argument parsing. Pass the parsed arguments through to a global "cli_execute" written in Lua, which is expected to either handle it or pass it back through to interp_builtin_cmd (via loader.command). lua-handled cli commands will then exist as globals in whatever module they most belong in, and invocations at the loader prompt will magically dispatch to them if they exist. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14450 Modified: head/stand/common/interp_lua.c head/stand/lua/loader.lua Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Tue Feb 20 17:28:59 2018 (r329643) +++ head/stand/common/interp_lua.c Tue Feb 20 17:46:50 2018 (r329644) @@ -128,7 +128,7 @@ interp_init(void) int interp_run(const char *line) { - int argc; + int argc, nargc; char **argv; lua_State *luap; struct interp_lua_softc *softc = &lua_softc; @@ -137,19 +137,39 @@ interp_run(const char *line) luap = softc->luap; LDBG("executing line..."); if ((status = luaL_dostring(luap, line)) != 0) { + lua_pop(luap, 1); /* - * If we could not parse the line as Lua syntax, - * try parsing it as a loader command. + * The line wasn't executable as lua; run it through parse to + * to get consistent parsing of command line arguments, then + * run it through cli_execute. If that fails, then we'll try it + * as a builtin. */ - lua_pop(luap, 1); if (parse(&argc, &argv, line) == 0) { - status = interp_builtin_cmd(argc, argv); - if (status != CMD_OK) + lua_getglobal(luap, "cli_execute"); + for (nargc = 0; nargc < argc; ++nargc) { + lua_pushstring(luap, argv[nargc]); + } + status = lua_pcall(luap, argc, 1, 0); + lua_pop(luap, 1); + if (status != 0) { + /* + * Lua cli_execute will pass the function back + * through loader.command, which is a proxy to + * interp_builtin_cmd. If we failed to interpret + * the command, though, then there's a chance + * that didn't happen. Call interp_builtin_cmd + * directly if our lua_pcall was not successful. + */ + status = interp_builtin_cmd(argc, argv); + } + if (status != 0) { printf("Command failed\n"); + status = CMD_ERROR; + } free(argv); } else { printf("Failed to parse \'%s\'\n", line); - status = -1; + status = CMD_ERROR; } } Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Tue Feb 20 17:28:59 2018 (r329643) +++ head/stand/lua/loader.lua Tue Feb 20 17:46:50 2018 (r329644) @@ -1,5 +1,6 @@ -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (c) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -29,6 +30,24 @@ config = require("config"); menu = require("menu"); password = require("password"); + +-- Declares a global function cli_execute that attempts to dispatch the +-- arguments passed as a lua function. This gives lua a chance to intercept +-- builtin CLI commands like "boot" +function cli_execute(...) + local cmd_name, cmd_args = ...; + local cmd = _G[cmd_name]; + if (cmd ~= nil) and (type(cmd) == "function") then + -- Pass argv wholesale into cmd. We could omit argv[0] since the + -- traditional reasons for including it don't necessarily apply, + -- it may not be totally redundant if we want to have one global + -- handling multiple commands + cmd(...); + else + loader.command(...); + end + +end config.load(); password.check(); From owner-svn-src-all@freebsd.org Tue Feb 20 18:04:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EA12F1ACAC; Tue, 20 Feb 2018 18:04:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2958683856; Tue, 20 Feb 2018 18:04:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 244EA5175; Tue, 20 Feb 2018 18:04:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KI49hw074404; Tue, 20 Feb 2018 18:04:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KI48I3074401; Tue, 20 Feb 2018 18:04:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201804.w1KI48I3074401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 18:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329645 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:04:09 -0000 Author: kevans Date: Tue Feb 20 18:04:08 2018 New Revision: 329645 URL: https://svnweb.freebsd.org/changeset/base/329645 Log: lualoader: Move carousel storage out into config Carousel storage doesn't need to happen in the menu module, and indeed storing it there introduces a circular reference between drawer and menu that only works because of global pollution in loader.lua. Carousel choices generally map to config entries anyways, making it as good of place as any to store these. Move {get,set}CarouselIndex functionality out into config so that drawer and menu may both use it. If we had more carousel functionality, it might make sense to create a carousel module, but this is not the case. Modified: head/stand/lua/config.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Feb 20 17:46:50 2018 (r329644) +++ head/stand/lua/config.lua Tue Feb 20 18:04:08 2018 (r329645) @@ -31,7 +31,10 @@ local config = {}; local modules = {}; -local pattern_table = { +local pattern_table; +local carousel_choices = {}; + +pattern_table = { [1] = { str = "^%s*(#.*)", process = function(k, v) end @@ -124,6 +127,19 @@ local pattern_table = { config.env_changed = {}; -- Values to restore env to (nil to unset) config.env_restore = {}; + +-- The first item in every carousel is always the default item. +function config.getCarouselIndex(id) + local val = carousel_choices[id]; + if (val == nil) then + return 1; + end + return val; +end + +function config.setCarouselIndex(id, idx) + carousel_choices[id] = idx; +end function config.restoreEnv() for k, v in pairs(config.env_changed) do Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 17:46:50 2018 (r329644) +++ head/stand/lua/drawer.lua Tue Feb 20 18:04:08 2018 (r329645) @@ -28,6 +28,7 @@ -- local color = require("color"); +local config = require("config"); local core = require("core"); local screen = require("screen"); @@ -176,7 +177,7 @@ drawer.menu_name_handlers = { -- types not specified here is to call and use entry.name(). [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); + local caridx = config.getCarouselIndex(carid); local choices = entry.items(); if (#choices < caridx) then Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 17:46:50 2018 (r329644) +++ head/stand/lua/menu.lua Tue Feb 20 18:04:08 2018 (r329645) @@ -39,7 +39,6 @@ local menu = {}; local skip; local run; local autoboot; -local carousel_choices = {}; local OnOff = function(str, b) if (b) then @@ -65,12 +64,12 @@ menu.handlers = { [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry) -- carousel (rotating) functionality local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); + local caridx = config.getCarouselIndex(carid); local choices = entry.items(); if (#choices > 0) then caridx = (caridx % #choices) + 1; - menu.setCarouselIndex(carid, caridx); + config.setCarouselIndex(carid, caridx); entry.func(caridx, choices[caridx], choices); end end, @@ -326,19 +325,6 @@ menu.welcome = { }, }, }; - --- The first item in every carousel is always the default item. -function menu.getCarouselIndex(id) - local val = carousel_choices[id]; - if (val == nil) then - return 1; - end - return val; -end - -function menu.setCarouselIndex(id, idx) - carousel_choices[id] = idx; -end function menu.run(m) From owner-svn-src-all@freebsd.org Tue Feb 20 18:05:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A719F1AEC2; Tue, 20 Feb 2018 18:05:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CFF683A1D; Tue, 20 Feb 2018 18:05:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17E0B5178; Tue, 20 Feb 2018 18:05:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KI5L7m074496; Tue, 20 Feb 2018 18:05:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KI5LS9074495; Tue, 20 Feb 2018 18:05:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201805.w1KI5LS9074495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 18:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329646 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:05:22 -0000 Author: kevans Date: Tue Feb 20 18:05:21 2018 New Revision: 329646 URL: https://svnweb.freebsd.org/changeset/base/329646 Log: lualoader: Eliminate global namespace pollution in loader.lua Modified: head/stand/lua/loader.lua Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Tue Feb 20 18:04:08 2018 (r329645) +++ head/stand/lua/loader.lua Tue Feb 20 18:05:21 2018 (r329646) @@ -27,9 +27,9 @@ -- $FreeBSD$ -- -config = require("config"); -menu = require("menu"); -password = require("password"); +local config = require("config"); +local menu = require("menu"); +local password = require("password"); -- Declares a global function cli_execute that attempts to dispatch the -- arguments passed as a lua function. This gives lua a chance to intercept From owner-svn-src-all@freebsd.org Tue Feb 20 18:08:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D437AF1B441; Tue, 20 Feb 2018 18:08:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8419C83D5D; Tue, 20 Feb 2018 18:08:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E7C55181; Tue, 20 Feb 2018 18:08:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KI8wIe074656; Tue, 20 Feb 2018 18:08:58 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KI8wjA074652; Tue, 20 Feb 2018 18:08:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802201808.w1KI8wjA074652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 20 Feb 2018 18:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329647 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 329647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:08:59 -0000 Author: brooks Date: Tue Feb 20 18:08:57 2018 New Revision: 329647 URL: https://svnweb.freebsd.org/changeset/base/329647 Log: Reduce duplication in dynamic syscall registration code. Remove the unused syscall_(de)register() functions in favor of the better documented and easier to use syscall_helper_(un)register(9) functions. The default and freebsd32 versions differed in which array of struct sysents they used and a few missing updates to the 32-bit code as features were added to the main code. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14337 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_util.h head/sys/kern/kern_syscalls.c head/sys/sys/sysent.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Feb 20 18:05:21 2018 (r329646) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Feb 20 18:08:57 2018 (r329647) @@ -3089,120 +3089,24 @@ freebsd32_xxx(struct thread *td, struct freebsd32_xxx_ #endif int -syscall32_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent, int flags) -{ - - if ((flags & ~SY_THR_STATIC) != 0) - return (EINVAL); - - if (*offset == NO_SYSCALL) { - int i; - - for (i = 1; i < SYS_MAXSYSCALL; ++i) - if (freebsd32_sysent[i].sy_call == - (sy_call_t *)lkmnosys) - break; - if (i == SYS_MAXSYSCALL) - return (ENFILE); - *offset = i; - } else if (*offset < 0 || *offset >= SYS_MAXSYSCALL) - return (EINVAL); - else if (freebsd32_sysent[*offset].sy_call != (sy_call_t *)lkmnosys && - freebsd32_sysent[*offset].sy_call != (sy_call_t *)lkmressys) - return (EEXIST); - - *old_sysent = freebsd32_sysent[*offset]; - freebsd32_sysent[*offset] = *new_sysent; - atomic_store_rel_32(&freebsd32_sysent[*offset].sy_thrcnt, flags); - return (0); -} - -int -syscall32_deregister(int *offset, struct sysent *old_sysent) -{ - - if (*offset == 0) - return (0); - - freebsd32_sysent[*offset] = *old_sysent; - return (0); -} - -int syscall32_module_handler(struct module *mod, int what, void *arg) { - struct syscall_module_data *data = (struct syscall_module_data*)arg; - modspecific_t ms; - int error; - switch (what) { - case MOD_LOAD: - error = syscall32_register(data->offset, data->new_sysent, - &data->old_sysent, SY_THR_STATIC_KLD); - if (error) { - /* Leave a mark so we know to safely unload below. */ - data->offset = NULL; - return error; - } - ms.intval = *data->offset; - MOD_XLOCK; - module_setspecific(mod, &ms); - MOD_XUNLOCK; - if (data->chainevh) - error = data->chainevh(mod, what, data->chainarg); - return (error); - case MOD_UNLOAD: - /* - * MOD_LOAD failed, so just return without calling the - * chained handler since we didn't pass along the MOD_LOAD - * event. - */ - if (data->offset == NULL) - return (0); - if (data->chainevh) { - error = data->chainevh(mod, what, data->chainarg); - if (error) - return (error); - } - error = syscall32_deregister(data->offset, &data->old_sysent); - return (error); - default: - error = EOPNOTSUPP; - if (data->chainevh) - error = data->chainevh(mod, what, data->chainarg); - return (error); - } + return (kern_syscall_module_handler(freebsd32_sysent, mod, what, arg)); } int syscall32_helper_register(struct syscall_helper_data *sd, int flags) { - struct syscall_helper_data *sd1; - int error; - for (sd1 = sd; sd1->syscall_no != NO_SYSCALL; sd1++) { - error = syscall32_register(&sd1->syscall_no, &sd1->new_sysent, - &sd1->old_sysent, flags); - if (error != 0) { - syscall32_helper_unregister(sd); - return (error); - } - sd1->registered = 1; - } - return (0); + return (kern_syscall_helper_register(freebsd32_sysent, sd, flags)); } int syscall32_helper_unregister(struct syscall_helper_data *sd) { - struct syscall_helper_data *sd1; - for (sd1 = sd; sd1->registered != 0; sd1++) { - syscall32_deregister(&sd1->syscall_no, &sd1->old_sysent); - sd1->registered = 0; - } - return (0); + return (kern_syscall_helper_unregister(freebsd32_sysent, sd)); } register_t * Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Tue Feb 20 18:05:21 2018 (r329646) +++ head/sys/compat/freebsd32/freebsd32_util.h Tue Feb 20 18:08:57 2018 (r329647) @@ -106,9 +106,6 @@ SYSCALL32_MODULE(syscallname, #define SYSCALL32_INIT_HELPER_COMPAT(syscallname) \ SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, 0) -int syscall32_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent, int flags); -int syscall32_deregister(int *offset, struct sysent *old_sysent); int syscall32_module_handler(struct module *mod, int what, void *arg); int syscall32_helper_register(struct syscall_helper_data *sd, int flags); int syscall32_helper_unregister(struct syscall_helper_data *sd); Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Tue Feb 20 18:05:21 2018 (r329646) +++ head/sys/kern/kern_syscalls.c Tue Feb 20 18:08:57 2018 (r329647) @@ -109,8 +109,8 @@ syscall_thread_exit(struct thread *td, struct sysent * } int -syscall_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent, int flags) +kern_syscall_register(struct sysent *sysents, int *offset, + struct sysent *new_sysent, struct sysent *old_sysent, int flags) { int i; @@ -119,53 +119,62 @@ syscall_register(int *offset, struct sysent *new_sysen if (*offset == NO_SYSCALL) { for (i = 1; i < SYS_MAXSYSCALL; ++i) - if (sysent[i].sy_call == (sy_call_t *)lkmnosys) + if (sysents[i].sy_call == (sy_call_t *)lkmnosys) break; if (i == SYS_MAXSYSCALL) return (ENFILE); *offset = i; } else if (*offset < 0 || *offset >= SYS_MAXSYSCALL) return (EINVAL); - else if (sysent[*offset].sy_call != (sy_call_t *)lkmnosys && - sysent[*offset].sy_call != (sy_call_t *)lkmressys) + else if (sysents[*offset].sy_call != (sy_call_t *)lkmnosys && + sysents[*offset].sy_call != (sy_call_t *)lkmressys) return (EEXIST); - KASSERT(sysent[*offset].sy_thrcnt == SY_THR_ABSENT, + KASSERT(sysents[*offset].sy_thrcnt == SY_THR_ABSENT, ("dynamic syscall is not protected")); - *old_sysent = sysent[*offset]; + *old_sysent = sysents[*offset]; new_sysent->sy_thrcnt = SY_THR_ABSENT; - sysent[*offset] = *new_sysent; - atomic_store_rel_32(&sysent[*offset].sy_thrcnt, flags); + sysents[*offset] = *new_sysent; + atomic_store_rel_32(&sysents[*offset].sy_thrcnt, flags); return (0); } int -syscall_deregister(int *offset, struct sysent *old_sysent) +kern_syscall_deregister(struct sysent *sysents, int offset, + const struct sysent *old_sysent) { struct sysent *se; - if (*offset == 0) + if (offset == 0) return (0); /* XXX? */ - se = &sysent[*offset]; + se = &sysents[offset]; if ((se->sy_thrcnt & SY_THR_STATIC) != 0) return (EINVAL); syscall_thread_drain(se); - sysent[*offset] = *old_sysent; + sysent[offset] = *old_sysent; return (0); } int syscall_module_handler(struct module *mod, int what, void *arg) { + + return (kern_syscall_module_handler(sysent, mod, what, arg)); +} + +int +kern_syscall_module_handler(struct sysent *sysents, struct module *mod, + int what, void *arg) +{ struct syscall_module_data *data = arg; modspecific_t ms; int error; switch (what) { case MOD_LOAD: - error = syscall_register(data->offset, data->new_sysent, - &data->old_sysent, data->flags); + error = kern_syscall_register(sysents, data->offset, + data->new_sysent, &data->old_sysent, data->flags); if (error) { /* Leave a mark so we know to safely unload below. */ data->offset = NULL; @@ -191,7 +200,8 @@ syscall_module_handler(struct module *mod, int what, v if (error) return error; } - error = syscall_deregister(data->offset, &data->old_sysent); + error = kern_syscall_deregister(sysents, *data->offset, + &data->old_sysent); return (error); default: if (data->chainevh) @@ -205,14 +215,22 @@ syscall_module_handler(struct module *mod, int what, v int syscall_helper_register(struct syscall_helper_data *sd, int flags) { + + return (kern_syscall_helper_register(sysent, sd, flags)); +} + +int +kern_syscall_helper_register(struct sysent *sysents, + struct syscall_helper_data *sd, int flags) +{ struct syscall_helper_data *sd1; int error; for (sd1 = sd; sd1->syscall_no != NO_SYSCALL; sd1++) { - error = syscall_register(&sd1->syscall_no, &sd1->new_sysent, - &sd1->old_sysent, flags); + error = kern_syscall_register(sysents, &sd1->syscall_no, + &sd1->new_sysent, &sd1->old_sysent, flags); if (error != 0) { - syscall_helper_unregister(sd); + kern_syscall_helper_unregister(sysents, sd); return (error); } sd1->registered = 1; @@ -223,10 +241,19 @@ syscall_helper_register(struct syscall_helper_data *sd int syscall_helper_unregister(struct syscall_helper_data *sd) { + + return (kern_syscall_helper_unregister(sysent, sd)); +} + +int +kern_syscall_helper_unregister(struct sysent *sysents, + struct syscall_helper_data *sd) +{ struct syscall_helper_data *sd1; for (sd1 = sd; sd1->registered != 0; sd1++) { - syscall_deregister(&sd1->syscall_no, &sd1->old_sysent); + kern_syscall_deregister(sysents, sd1->syscall_no, + &sd1->old_sysent); sd1->registered = 0; } return (0); Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Tue Feb 20 18:05:21 2018 (r329646) +++ head/sys/sys/sysent.h Tue Feb 20 18:08:57 2018 (r329647) @@ -262,12 +262,20 @@ struct syscall_helper_data { .syscall_no = NO_SYSCALL \ } -int syscall_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent, int flags); -int syscall_deregister(int *offset, struct sysent *old_sysent); int syscall_module_handler(struct module *mod, int what, void *arg); int syscall_helper_register(struct syscall_helper_data *sd, int flags); int syscall_helper_unregister(struct syscall_helper_data *sd); +/* Implementation, exposed for COMPAT code */ +int kern_syscall_register(struct sysent *sysents, int *offset, + struct sysent *new_sysent, struct sysent *old_sysent, int flags); +int kern_syscall_deregister(struct sysent *sysents, int offset, + const struct sysent *old_sysent); +int kern_syscall_module_handler(struct sysent *sysents, + struct module *mod, int what, void *arg); +int kern_syscall_helper_register(struct sysent *sysents, + struct syscall_helper_data *sd, int flags); +int kern_syscall_helper_unregister(struct sysent *sysents, + struct syscall_helper_data *sd); struct proc; const char *syscallname(struct proc *p, u_int code); From owner-svn-src-all@freebsd.org Tue Feb 20 18:12:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4BFCF1B80E; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74518841DC; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F311530D; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KIC7lA079316; Tue, 20 Feb 2018 18:12:07 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KIC7xv079315; Tue, 20 Feb 2018 18:12:07 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802201812.w1KIC7xv079315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 20 Feb 2018 18:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329648 - stable/11/sys/arm/allwinner X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/allwinner X-SVN-Commit-Revision: 329648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:12:08 -0000 Author: gonzo Date: Tue Feb 20 18:12:07 2018 New Revision: 329648 URL: https://svnweb.freebsd.org/changeset/base/329648 Log: MFC r325410: Increase TX_MAX_SEGS from 10 to 20 for the if_awg.c driver Under certain traffic pattern awg driver does not recover from TX queue full condition. The actual source of the problem is not identified yet but jmcneill@ agreed that bumping TX_MAX_SEGS to 20 is OK as a workaround for the problem (NetBSD has it set to 128). Also add some diagnostic printfs to prevent silent failure of bus_dma functions in the future PR will be kept open until root cause of the issue is identified and fixed PR: 219927 Submitted by: Tom Vijlbrief Approved by: jmcneill Modified: stable/11/sys/arm/allwinner/if_awg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/if_awg.c ============================================================================== --- stable/11/sys/arm/allwinner/if_awg.c Tue Feb 20 18:08:57 2018 (r329647) +++ stable/11/sys/arm/allwinner/if_awg.c Tue Feb 20 18:12:07 2018 (r329648) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); #define TX_SKIP(n, o) (((n) + (o)) & (TX_DESC_COUNT - 1)) #define RX_NEXT(n) (((n) + 1) & (RX_DESC_COUNT - 1)) -#define TX_MAX_SEGS 10 +#define TX_MAX_SEGS 20 #define SOFT_RST_RETRY 1000 #define MII_BUSY_RETRY 1000 @@ -148,6 +148,7 @@ struct awg_softc { struct resource *res[2]; struct mtx mtx; if_t ifp; + device_t dev; device_t miibus; struct callout stat_ch; struct task link_task; @@ -375,14 +376,18 @@ awg_setup_txbuf(struct awg_softc *sc, int index, struc sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { m = m_collapse(m, M_NOWAIT, TX_MAX_SEGS); - if (m == NULL) + if (m == NULL) { + device_printf(sc->dev, "awg_setup_txbuf: m_collapse failed\n"); return (0); + } *mp = m; error = bus_dmamap_load_mbuf_sg(sc->tx.buf_tag, sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT); } - if (error != 0) + if (error != 0) { + device_printf(sc->dev, "awg_setup_txbuf: bus_dmamap_load_mbuf_sg failed\n"); return (0); + } bus_dmamap_sync(sc->tx.buf_tag, sc->tx.buf_map[index].map, BUS_DMASYNC_PREWRITE); @@ -1324,6 +1329,7 @@ awg_attach(device_t dev) int error; sc = device_get_softc(dev); + sc->dev = dev; node = ofw_bus_get_node(dev); if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) { From owner-svn-src-all@freebsd.org Tue Feb 20 18:21:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B50F1C5FF; Tue, 20 Feb 2018 18:21:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE69784AAC; Tue, 20 Feb 2018 18:21:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D97975487; Tue, 20 Feb 2018 18:21:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KILUIJ079716; Tue, 20 Feb 2018 18:21:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KILUUg079715; Tue, 20 Feb 2018 18:21:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802201821.w1KILUUg079715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 20 Feb 2018 18:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329649 - head/stand/liblua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/stand/liblua X-SVN-Commit-Revision: 329649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:21:31 -0000 Author: cem Date: Tue Feb 20 18:21:30 2018 New Revision: 329649 URL: https://svnweb.freebsd.org/changeset/base/329649 Log: Lua lfs.attributes: Provide a more consistent error return In the remaining error case, return a 3-tuple consistent with the other error return case. Document how to invoke lfs.attributes() and detect/decode error return in example comments. Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14451 Modified: head/stand/liblua/lfs.c Modified: head/stand/liblua/lfs.c ============================================================================== --- head/stand/liblua/lfs.c Tue Feb 20 18:12:07 2018 (r329648) +++ head/stand/liblua/lfs.c Tue Feb 20 18:21:30 2018 (r329649) @@ -80,13 +80,20 @@ __FBSDID("$FreeBSD$"); * (etc.) * * The other available API is lfs.attributes(), which functions somewhat like - * stat(2) and returns a table of values: + * stat(2) and returns a table of values. Example code: * - * for k, v in pairs(lfs.attributes("/boot")) do + * attrs, errormsg, errorcode = lfs.attributes("/boot") + * if attrs == nil then + * print(errormsg) + * return errorcode + * end + * + * for k, v in pairs(attrs) do * print(k .. ":\t" .. v) * end + * return 0 * - * Prints: + * Prints (on success): * gid: 0 * change: 140737488342640 * mode: directory @@ -277,7 +284,9 @@ lua_attributes(lua_State *L) path = luaL_checkstring(L, 1); if (path == NULL) { lua_pushnil(L); - return 1; + lua_pushfstring(L, "cannot convert first argument to string"); + lua_pushinteger(L, EINVAL); + return 3; } rc = stat(path, &sb); From owner-svn-src-all@freebsd.org Tue Feb 20 18:24:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B310F1CBD4; Tue, 20 Feb 2018 18:24:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4E5284EC3; Tue, 20 Feb 2018 18:24:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFCC654E6; Tue, 20 Feb 2018 18:24:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KIOKu1084830; Tue, 20 Feb 2018 18:24:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KIOKPT084829; Tue, 20 Feb 2018 18:24:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201824.w1KIOKPT084829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 18:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329650 - head/stand/liblua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/liblua X-SVN-Commit-Revision: 329650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:24:21 -0000 Author: kevans Date: Tue Feb 20 18:24:20 2018 New Revision: 329650 URL: https://svnweb.freebsd.org/changeset/base/329650 Log: liblua: Add loader.machine and loader.machine_arch properties Provisioned from MACHINE/MACHINE_ARCH on the system, expose loader.machine and loader.machine_arch respectively. These may be used to hide ACPI option on non-applicable archs. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14446 Modified: head/stand/liblua/lutils.c Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Tue Feb 20 18:21:30 2018 (r329649) +++ head/stand/liblua/lutils.c Tue Feb 20 18:24:20 2018 (r329650) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "lua.h" #include "lauxlib.h" #include "lstd.h" @@ -263,6 +265,11 @@ int luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); + /* Add loader.machine and loader.machine_arch properties */ + lua_pushstring(L, MACHINE); + lua_setfield(L, -2, "machine"); + lua_pushstring(L, MACHINE_ARCH); + lua_setfield(L, -2, "machine_arch"); return 1; } From owner-svn-src-all@freebsd.org Tue Feb 20 18:33:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75A61F1D9EC; Tue, 20 Feb 2018 18:33:46 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 295598588F; Tue, 20 Feb 2018 18:33:46 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 244E95691; Tue, 20 Feb 2018 18:33:46 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KIXkQT089597; Tue, 20 Feb 2018 18:33:46 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KIXkfk089596; Tue, 20 Feb 2018 18:33:46 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201802201833.w1KIXkfk089596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 20 Feb 2018 18:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329651 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 329651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:33:46 -0000 Author: shurd Date: Tue Feb 20 18:33:45 2018 New Revision: 329651 URL: https://svnweb.freebsd.org/changeset/base/329651 Log: IFLIB: do not remove dmamap on buffer unload Dmamap is created only on IFC attach. If we remove it on buffer release, we won't be able to do ifconfig down&up. Only destroy when in detach. Reported by: wma Reviewed by: wma Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14060 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Feb 20 18:24:20 2018 (r329650) +++ head/sys/net/iflib.c Tue Feb 20 18:33:45 2018 (r329651) @@ -1984,7 +1984,8 @@ iflib_fl_bufs_free(iflib_fl_t fl) if (fl->ifl_sds.ifsd_map != NULL) { bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; bus_dmamap_unload(fl->ifl_desc_tag, sd_map); - bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); + if (fl->ifl_rxq->ifr_ctx->ifc_in_detach) + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); } if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); From owner-svn-src-all@freebsd.org Tue Feb 20 19:21:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF43BF232BC; Tue, 20 Feb 2018 19:21:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A579D680FC; Tue, 20 Feb 2018 19:21:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A073E5EB7; Tue, 20 Feb 2018 19:21:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KJLYc9015271; Tue, 20 Feb 2018 19:21:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KJLYV6015269; Tue, 20 Feb 2018 19:21:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802201921.w1KJLYV6015269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 19:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329654 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 19:21:35 -0000 Author: kevans Date: Tue Feb 20 19:21:34 2018 New Revision: 329654 URL: https://svnweb.freebsd.org/changeset/base/329654 Log: lualoader: Ignore ACPI bits on !i386 Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 18:45:38 2018 (r329653) +++ head/stand/lua/core.lua Tue Feb 20 19:21:34 2018 (r329654) @@ -218,6 +218,10 @@ function core.isSerialBoot() return false; end +function core.isSystem386() + return (loader.machine_arch == "i386"); +end + -- This may be a better candidate for a 'utility' module. function core.shallowCopyTable(tbl) local new_tbl = {}; @@ -235,7 +239,7 @@ end -- generally be set upon execution of the kernel. Because of this, we can't (or -- don't really want to) detect/disable ACPI on !i386 reliably. Just set it -- enabled if we detect it and leave well enough alone if we don't. -if (core.getACPIPresent(false)) then +if (core.isSystem386()) and (core.getACPIPresent(false)) then core.setACPI(true); end return core; Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 18:45:38 2018 (r329653) +++ head/stand/lua/menu.lua Tue Feb 20 19:21:34 2018 (r329654) @@ -128,6 +128,7 @@ menu.boot_options = { -- acpi { entry_type = core.MENU_ENTRY, + visible = core.isSystem386, name = function() return OnOff(color.highlight("A") .. "CPI :", core.acpi); From owner-svn-src-all@freebsd.org Tue Feb 20 19:33:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E6D6F2420D; Tue, 20 Feb 2018 19:33:34 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5077C68D5A; Tue, 20 Feb 2018 19:33:34 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B57260AC; Tue, 20 Feb 2018 19:33:34 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KJXY5E023880; Tue, 20 Feb 2018 19:33:34 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KJXY2G023879; Tue, 20 Feb 2018 19:33:34 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201802201933.w1KJXY2G023879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Tue, 20 Feb 2018 19:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329655 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: n_hibma X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 329655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 19:33:34 -0000 Author: n_hibma Date: Tue Feb 20 19:33:33 2018 New Revision: 329655 URL: https://svnweb.freebsd.org/changeset/base/329655 Log: Merge rev. 329197 from HEAD: DSCP values passed to setdscp need to be lowercase. Modified: stable/11/sbin/ipfw/ipfw.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Tue Feb 20 19:21:34 2018 (r329654) +++ stable/11/sbin/ipfw/ipfw.8 Tue Feb 20 19:33:33 2018 (r329655) @@ -1070,49 +1070,49 @@ Set specified DiffServ codepoint for an IPv4/IPv6 pack Processing continues at the next rule. Supported values are: .Pp -.Cm CS0 +.Cm cs0 .Pq Dv 000000 , -.Cm CS1 +.Cm cs1 .Pq Dv 001000 , -.Cm CS2 +.Cm cs2 .Pq Dv 010000 , -.Cm CS3 +.Cm cs3 .Pq Dv 011000 , -.Cm CS4 +.Cm cs4 .Pq Dv 100000 , -.Cm CS5 +.Cm cs5 .Pq Dv 101000 , -.Cm CS6 +.Cm cs6 .Pq Dv 110000 , -.Cm CS7 +.Cm cs7 .Pq Dv 111000 , -.Cm AF11 +.Cm af11 .Pq Dv 001010 , -.Cm AF12 +.Cm af12 .Pq Dv 001100 , -.Cm AF13 +.Cm af13 .Pq Dv 001110 , -.Cm AF21 +.Cm af21 .Pq Dv 010010 , -.Cm AF22 +.Cm af22 .Pq Dv 010100 , -.Cm AF23 +.Cm af23 .Pq Dv 010110 , -.Cm AF31 +.Cm af31 .Pq Dv 011010 , -.Cm AF32 +.Cm af32 .Pq Dv 011100 , -.Cm AF33 +.Cm af33 .Pq Dv 011110 , -.Cm AF41 +.Cm af41 .Pq Dv 100010 , -.Cm AF42 +.Cm af42 .Pq Dv 100100 , -.Cm AF43 +.Cm af43 .Pq Dv 100110 , -.Cm EF +.Cm ef .Pq Dv 101110 , -.Cm BE +.Cm be .Pq Dv 000000 . Additionally, DSCP value can be specified by number (0..64). It is also possible to use the From owner-svn-src-all@freebsd.org Tue Feb 20 19:39:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 318D6F248EB; Tue, 20 Feb 2018 19:39:49 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBB17691E2; Tue, 20 Feb 2018 19:39:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D68AD60BD; Tue, 20 Feb 2018 19:39:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KJdmfi024262; Tue, 20 Feb 2018 19:39:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KJdmkE024258; Tue, 20 Feb 2018 19:39:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802201939.w1KJdmkE024258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 20 Feb 2018 19:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329656 - in head/stand: common liblua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: common liblua X-SVN-Commit-Revision: 329656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 19:39:49 -0000 Author: cem Date: Tue Feb 20 19:39:48 2018 New Revision: 329656 URL: https://svnweb.freebsd.org/changeset/base/329656 Log: loader.lua: Expose errno table to lua Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14454 Added: head/stand/liblua/lerrno.c - copied, changed from r329649, head/stand/liblua/lfs.c head/stand/liblua/lerrno.h - copied, changed from r329615, head/stand/liblua/lfs.h Modified: head/stand/common/interp_lua.c head/stand/liblua/Makefile Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Tue Feb 20 19:33:33 2018 (r329655) +++ head/stand/common/interp_lua.c Tue Feb 20 19:39:48 2018 (r329656) @@ -39,8 +39,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include +#include struct interp_lua_softc { lua_State *luap; @@ -86,6 +88,7 @@ static const luaL_Reg loadedlibs[] = { // {LUA_MATHLIBNAME, luaopen_math}, // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, + {"errno", luaopen_errno}, {"io", luaopen_io}, {"lfs", luaopen_lfs}, {"loader", luaopen_loader}, Modified: head/stand/liblua/Makefile ============================================================================== --- head/stand/liblua/Makefile Tue Feb 20 19:33:33 2018 (r329655) +++ head/stand/liblua/Makefile Tue Feb 20 19:39:48 2018 (r329656) @@ -21,7 +21,7 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lfs.c lstd.c lutils.c +SRCS+= lerrno.c lfs.c lstd.c lutils.c WARNS= 3 Copied and modified: head/stand/liblua/lerrno.c (from r329649, head/stand/liblua/lfs.c) ============================================================================== --- head/stand/liblua/lfs.c Tue Feb 20 18:21:30 2018 (r329649, copy source) +++ head/stand/liblua/lerrno.c Tue Feb 20 19:39:48 2018 (r329656) @@ -22,321 +22,159 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * Portions derived from https://github.com/keplerproject/luafilesystem under - * the terms of the MIT license: - * - * Copyright (c) 2003-2014 Kepler Project. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. */ #include __FBSDID("$FreeBSD$"); +#define _WANT_KERNEL_ERRNO 1 +#include + #include #include "lauxlib.h" -#include "lfs.h" -#include "lstd.h" -#include "lutils.h" -#include "bootstrap.h" +#include "lerrno.h" #ifndef nitems #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #endif /* - * The goal is to emulate a subset of the upstream Lua FileSystem library, as - * faithfully as possible in the boot environment. Only APIs that seem useful - * need to emulated. - * - * Example usage: - * - * for file in lfs.dir("/boot") do - * print("\t"..file) - * end - * - * Prints: - * . - * .. - * (etc.) - * - * The other available API is lfs.attributes(), which functions somewhat like - * stat(2) and returns a table of values. Example code: - * - * attrs, errormsg, errorcode = lfs.attributes("/boot") - * if attrs == nil then - * print(errormsg) - * return errorcode - * end - * - * for k, v in pairs(attrs) do - * print(k .. ":\t" .. v) - * end - * return 0 - * - * Prints (on success): - * gid: 0 - * change: 140737488342640 - * mode: directory - * rdev: 0 - * ino: 4199275 - * dev: 140737488342544 - * modification: 140737488342576 - * size: 512 - * access: 140737488342560 - * permissions: 755 - * nlink: 58283552 - * uid: 1001 + * Populated with: + * $ egrep "^#define.E" sys/sys/errno.h | \ + * awk '{ print "\tENTRY(" $2 ")," }' >> lerrno.c */ +#define ENTRY(name) { #name, name } +static const struct err_name_number { + const char *err_name; + int err_num; +} errnoconstants[] = { + ENTRY(EPERM), + ENTRY(ENOENT), + ENTRY(ESRCH), + ENTRY(EINTR), + ENTRY(EIO), + ENTRY(ENXIO), + ENTRY(E2BIG), + ENTRY(ENOEXEC), + ENTRY(EBADF), + ENTRY(ECHILD), + ENTRY(EDEADLK), + ENTRY(ENOMEM), + ENTRY(EACCES), + ENTRY(EFAULT), + ENTRY(ENOTBLK), + ENTRY(EBUSY), + ENTRY(EEXIST), + ENTRY(EXDEV), + ENTRY(ENODEV), + ENTRY(ENOTDIR), + ENTRY(EISDIR), + ENTRY(EINVAL), + ENTRY(ENFILE), + ENTRY(EMFILE), + ENTRY(ENOTTY), + ENTRY(ETXTBSY), + ENTRY(EFBIG), + ENTRY(ENOSPC), + ENTRY(ESPIPE), + ENTRY(EROFS), + ENTRY(EMLINK), + ENTRY(EPIPE), + ENTRY(EDOM), + ENTRY(ERANGE), + ENTRY(EAGAIN), + ENTRY(EWOULDBLOCK), + ENTRY(EINPROGRESS), + ENTRY(EALREADY), + ENTRY(ENOTSOCK), + ENTRY(EDESTADDRREQ), + ENTRY(EMSGSIZE), + ENTRY(EPROTOTYPE), + ENTRY(ENOPROTOOPT), + ENTRY(EPROTONOSUPPORT), + ENTRY(ESOCKTNOSUPPORT), + ENTRY(EOPNOTSUPP), + ENTRY(ENOTSUP), + ENTRY(EPFNOSUPPORT), + ENTRY(EAFNOSUPPORT), + ENTRY(EADDRINUSE), + ENTRY(EADDRNOTAVAIL), + ENTRY(ENETDOWN), + ENTRY(ENETUNREACH), + ENTRY(ENETRESET), + ENTRY(ECONNABORTED), + ENTRY(ECONNRESET), + ENTRY(ENOBUFS), + ENTRY(EISCONN), + ENTRY(ENOTCONN), + ENTRY(ESHUTDOWN), + ENTRY(ETOOMANYREFS), + ENTRY(ETIMEDOUT), + ENTRY(ECONNREFUSED), + ENTRY(ELOOP), + ENTRY(ENAMETOOLONG), + ENTRY(EHOSTDOWN), + ENTRY(EHOSTUNREACH), + ENTRY(ENOTEMPTY), + ENTRY(EPROCLIM), + ENTRY(EUSERS), + ENTRY(EDQUOT), + ENTRY(ESTALE), + ENTRY(EREMOTE), + ENTRY(EBADRPC), + ENTRY(ERPCMISMATCH), + ENTRY(EPROGUNAVAIL), + ENTRY(EPROGMISMATCH), + ENTRY(EPROCUNAVAIL), + ENTRY(ENOLCK), + ENTRY(ENOSYS), + ENTRY(EFTYPE), + ENTRY(EAUTH), + ENTRY(ENEEDAUTH), + ENTRY(EIDRM), + ENTRY(ENOMSG), + ENTRY(EOVERFLOW), + ENTRY(ECANCELED), + ENTRY(EILSEQ), + ENTRY(ENOATTR), + ENTRY(EDOOFUS), + ENTRY(EBADMSG), + ENTRY(EMULTIHOP), + ENTRY(ENOLINK), + ENTRY(EPROTO), + ENTRY(ENOTCAPABLE), + ENTRY(ECAPMODE), + ENTRY(ENOTRECOVERABLE), + ENTRY(EOWNERDEAD), + ENTRY(ELAST), + ENTRY(ERESTART), + ENTRY(EJUSTRETURN), + ENTRY(ENOIOCTL), + ENTRY(EDIRIOCTL), + ENTRY(ERELOOKUP), +}; +#undef ENTRY -#define DIR_METATABLE "directory iterator metatable" - -static int -lua_dir_iter_next(lua_State *L) -{ - struct dirent *entry; - DIR *dp, **dpp; - - dpp = (DIR **)luaL_checkudata(L, 1, DIR_METATABLE); - dp = *dpp; - luaL_argcheck(L, dp != NULL, 1, "closed directory"); - - entry = readdirfd(dp->fd); - if (entry == NULL) { - closedir(dp); - *dpp = NULL; - return 0; - } - - lua_pushstring(L, entry->d_name); - return 1; -} - -static int -lua_dir_iter_close(lua_State *L) -{ - DIR *dp, **dpp; - - dpp = (DIR **)lua_touserdata(L, 1); - dp = *dpp; - if (dp == NULL) - return 0; - - closedir(dp); - *dpp = NULL; - return 0; -} - -static int -lua_dir(lua_State *L) -{ - const char *path; - DIR *dp; - - if (lua_gettop(L) != 1) { - lua_pushnil(L); - return 1; - } - - path = luaL_checkstring(L, 1); - dp = opendir(path); - if (dp == NULL) { - lua_pushnil(L); - return 1; - } - - lua_pushcfunction(L, lua_dir_iter_next); - *(DIR **)lua_newuserdata(L, sizeof(DIR **)) = dp; - luaL_getmetatable(L, DIR_METATABLE); - lua_setmetatable(L, -2); - return 2; -} - static void -register_metatable(lua_State *L) +lerrno_register(lua_State *L) { - /* - * Create so-called metatable for iterator object returned by - * lfs.dir(). - */ - luaL_newmetatable(L, DIR_METATABLE); - - lua_newtable(L); - lua_pushcfunction(L, lua_dir_iter_next); - lua_setfield(L, -2, "next"); - lua_pushcfunction(L, lua_dir_iter_close); - lua_setfield(L, -2, "close"); - - /* Magically associate anonymous method table with metatable. */ - lua_setfield(L, -2, "__index"); - /* Implement magic destructor method */ - lua_pushcfunction(L, lua_dir_iter_close); - lua_setfield(L, -2, "__gc"); - - lua_pop(L, 1); -} - -#define PUSH_INTEGER(lname, stname) \ -static void \ -push_st_ ## lname (lua_State *L, struct stat *sb) \ -{ \ - lua_pushinteger(L, (lua_Integer)sb->st_ ## stname); \ -} -PUSH_INTEGER(dev, dev) -PUSH_INTEGER(ino, ino) -PUSH_INTEGER(nlink, nlink) -PUSH_INTEGER(uid, uid) -PUSH_INTEGER(gid, gid) -PUSH_INTEGER(rdev, rdev) -PUSH_INTEGER(access, atime) -PUSH_INTEGER(modification, mtime) -PUSH_INTEGER(change, ctime) -PUSH_INTEGER(size, size) -#undef PUSH_INTEGER - -static void -push_st_mode(lua_State *L, struct stat *sb) -{ - const char *mode_s; - mode_t mode; - - mode = (sb->st_mode & S_IFMT); - if (S_ISREG(mode)) - mode_s = "file"; - else if (S_ISDIR(mode)) - mode_s = "directory"; - else if (S_ISLNK(mode)) - mode_s = "link"; - else if (S_ISSOCK(mode)) - mode_s = "socket"; - else if (S_ISFIFO(mode)) - mode_s = "fifo"; - else if (S_ISCHR(mode)) - mode_s = "char device"; - else if (S_ISBLK(mode)) - mode_s = "block device"; - else - mode_s = "other"; - - lua_pushstring(L, mode_s); -} - -static void -push_st_permissions(lua_State *L, struct stat *sb) -{ - char buf[20]; - - /* - * XXX - * Could actually format as "-rwxrwxrwx" -- do we care? - */ - snprintf(buf, sizeof(buf), "%o", sb->st_mode & ~S_IFMT); - lua_pushstring(L, buf); -} - -#define PUSH_ENTRY(n) { #n, push_st_ ## n } -struct stat_members { - const char *name; - void (*push)(lua_State *, struct stat *); -} members[] = { - PUSH_ENTRY(mode), - PUSH_ENTRY(dev), - PUSH_ENTRY(ino), - PUSH_ENTRY(nlink), - PUSH_ENTRY(uid), - PUSH_ENTRY(gid), - PUSH_ENTRY(rdev), - PUSH_ENTRY(access), - PUSH_ENTRY(modification), - PUSH_ENTRY(change), - PUSH_ENTRY(size), - PUSH_ENTRY(permissions), -}; -#undef PUSH_ENTRY - -static int -lua_attributes(lua_State *L) -{ - struct stat sb; - const char *path, *member; size_t i; - int rc; - path = luaL_checkstring(L, 1); - if (path == NULL) { - lua_pushnil(L); - lua_pushfstring(L, "cannot convert first argument to string"); - lua_pushinteger(L, EINVAL); - return 3; + for (i = 0; i < nitems(errnoconstants); i++) { + lua_pushinteger(L, errnoconstants[i].err_num); + lua_setfield(L, -2, errnoconstants[i].err_name); } - - rc = stat(path, &sb); - if (rc != 0) { - lua_pushnil(L); - lua_pushfstring(L, - "cannot obtain information from file '%s': %s", path, - strerror(errno)); - lua_pushinteger(L, errno); - return 3; - } - - if (lua_isstring(L, 2)) { - member = lua_tostring(L, 2); - for (i = 0; i < nitems(members); i++) { - if (strcmp(members[i].name, member) != 0) - continue; - - members[i].push(L, &sb); - return 1; - } - return luaL_error(L, "invalid attribute name '%s'", member); - } - - /* Create or reuse existing table */ - lua_settop(L, 2); - if (!lua_istable(L, 2)) - lua_newtable(L); - - /* Export all stat data to caller */ - for (i = 0; i < nitems(members); i++) { - lua_pushstring(L, members[i].name); - members[i].push(L, &sb); - lua_rawset(L, -3); - } - return 1; } -#define REG_SIMPLE(n) { #n, lua_ ## n } -static const struct luaL_Reg fslib[] = { - REG_SIMPLE(attributes), - REG_SIMPLE(dir), +static const struct luaL_Reg errnolib[] = { + /* Extra bogus entry required by luaL_newlib API */ { NULL, NULL }, }; -#undef REG_SIMPLE int -luaopen_lfs(lua_State *L) +luaopen_errno(lua_State *L) { - register_metatable(L); - luaL_newlib(L, fslib); + luaL_newlib(L, errnolib); + lerrno_register(L); return 1; } Copied and modified: head/stand/liblua/lerrno.h (from r329615, head/stand/liblua/lfs.h) ============================================================================== --- head/stand/liblua/lfs.h Tue Feb 20 02:18:30 2018 (r329615, copy source) +++ head/stand/liblua/lerrno.h Tue Feb 20 19:39:48 2018 (r329656) @@ -30,4 +30,4 @@ #include -int luaopen_lfs(lua_State *L); +int luaopen_errno(lua_State *L); From owner-svn-src-all@freebsd.org Tue Feb 20 19:54:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8B5EF25A6F; Tue, 20 Feb 2018 19:54:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5008369DA8; Tue, 20 Feb 2018 19:54:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4205063F9; Tue, 20 Feb 2018 19:54:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KJs7Pl033828; Tue, 20 Feb 2018 19:54:07 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KJs7cu033827; Tue, 20 Feb 2018 19:54:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802201954.w1KJs7cu033827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 20 Feb 2018 19:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329657 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 329657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 19:54:07 -0000 Author: asomers Date: Tue Feb 20 19:54:06 2018 New Revision: 329657 URL: https://svnweb.freebsd.org/changeset/base/329657 Log: Fix memory leaks in zdb introduced by r329508 Reported by: Coverity CID: 1386185 MFC after: 3 weeks X-MFC-With: 329508 Sponsored by: Spectra Logic Corp Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Feb 20 19:39:48 2018 (r329656) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Feb 20 19:54:06 2018 (r329657) @@ -3570,6 +3570,7 @@ zdb_read_block(char *thing, spa_t *spa) s = "offset must be a multiple of sector size"; if (s) { (void) printf("Invalid block specifier: %s - %s\n", thing, s); + free(flagstr); free(dup); return; } @@ -3595,6 +3596,7 @@ zdb_read_block(char *thing, spa_t *spa) blkptr_offset = strtoull(p, &p, 16); if (*p != ':' && *p != '\0') { (void) printf("***Invalid flag arg: '%s'\n", s); + free(flagstr); free(dup); return; } From owner-svn-src-all@freebsd.org Tue Feb 20 20:04:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16ABCF2669A; Tue, 20 Feb 2018 20:04:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74AE96A5EA; Tue, 20 Feb 2018 20:04:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f169.google.com with SMTP id t126so16234299iof.4; Tue, 20 Feb 2018 12:04:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=KLQIBAfwPDn7fbufCIPjUDrwyOCzZOJazSticwGkNSI=; b=uWuJw78hXkEbRx4eEMUVkm+k25olO7fO1pgjgOD+Kyli9RrNsAristRw1gp25b7lB4 5lFiaw9jc0DRir4pQ/b+ixvFPBiP8UAwwvPRg1T5ZZ9DLAwfBr3/C2BMBb5QqjdMcuJl /6A22HTX/KtgRVdp3p25pgbeiCyMPjlQIgEV9wlJcnbAbRJiqsB/BRIiJwmmKCz9+HVu yR3nIcY/0iwgmBN7BhzFZ+ofLW1bY270tjUQZW/dOTm51ZFPkj9yzXioBRdp9SFxtYgA G5soqnf4kL/KnYsFGuB8m93rBJ4LTmg7J4YDbVtoPak5bU30ERsfQ9H7GYM2X+Ogg0Jp lWsw== X-Gm-Message-State: APf1xPAdyCp0YLafvF6KNQJDCHbYid04xoBuAz1erhNmEM5fm4A012x3 ZG3/F6G/4j0Y2ts6+TA9w6iAAq9q X-Google-Smtp-Source: AG47ELu3/79r2oX0sKTt8cBPuBJhpsBele9rahpvrf3G8T6EZvFYcLTEoznVh/blcgAQJpHx2u0GVQ== X-Received: by 10.107.59.130 with SMTP id i124mr1045034ioa.129.1519156650108; Tue, 20 Feb 2018 11:57:30 -0800 (PST) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com. [209.85.223.175]) by smtp.gmail.com with ESMTPSA id k66sm23020452itk.5.2018.02.20.11.57.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 11:57:29 -0800 (PST) Received: by mail-io0-f175.google.com with SMTP id u84so16237058iod.9; Tue, 20 Feb 2018 11:57:29 -0800 (PST) X-Received: by 10.107.41.16 with SMTP id p16mr1066096iop.173.1519156649473; Tue, 20 Feb 2018 11:57:29 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Tue, 20 Feb 2018 11:57:28 -0800 (PST) In-Reply-To: <201802160517.w1G5H1XH047278@repo.freebsd.org> References: <201802160517.w1G5H1XH047278@repo.freebsd.org> From: Conrad Meyer Date: Tue, 20 Feb 2018 11:57:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329360 - in head/sys: amd64/vmm/amd contrib/dev/acpica/include To: Anish Gupta Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:04:23 -0000 Hi Anish, Some coverity nits inline: On Thu, Feb 15, 2018 at 9:17 PM, Anish Gupta wrote: > Author: anish > Date: Fri Feb 16 05:17:00 2018 > New Revision: 329360 > URL: https://svnweb.freebsd.org/changeset/base/329360 > > Log: > This change fixes duplicate detection of same IOMMU/AMD-Vi device for R= yzen with EFR support. > > IVRS can have entry of type legacy and non-legacy present at same time = for same AMD-Vi device. ivhd driver will ignore legacy if new IVHD type is = present as specified in AMD-Vi specification. Earlier both of IVHD entries = used and two ivhd devices were created. > Add support for new IVHD type 0x11 and 0x40 in ACPI. Create new struct = of type acpi_ivrs_hardware_new for these new type of IVHDs. Legacy type 0x1= 0 will continue to use acpi_ivrs_hardware. > > Reviewed by: avg > Approved by: grehan > Differential Revision:https://reviews.freebsd.org/D13160 > > Modified: > head/sys/amd64/vmm/amd/amdvi_hw.c > head/sys/amd64/vmm/amd/amdvi_priv.h > head/sys/amd64/vmm/amd/ivrs_drv.c > head/sys/contrib/dev/acpica/include/actbl2.h > > ... > Modified: head/sys/amd64/vmm/amd/ivrs_drv.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/vmm/amd/ivrs_drv.c Fri Feb 16 04:59:21 2018 (= r329359) > +++ head/sys/amd64/vmm/amd/ivrs_drv.c Fri Feb 16 05:17:00 2018 (= r329360) > ... > @@ -196,11 +205,26 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE * ivhd, struct am= dvi > softc->start_dev_rid =3D ~0; > softc->end_dev_rid =3D 0; > > - /* > - * XXX The following actually depends on Header.Type and > - * is only true for 0x10. > - */ > - p =3D (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE); > + switch (ivhd->Header.Type) { > + case ACPI_IVRS_TYPE_HARDWARE_EXT1: > + case ACPI_IVRS_TYPE_HARDWARE_EXT2: > + p =3D (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE= _NEW); > + de =3D (ACPI_IVRS_DE_HEADER *) ((uint8_t *)ivhd + > + sizeof(ACPI_IVRS_HARDWARE_NEW)); > + break; > + > + case ACPI_IVRS_TYPE_HARDWARE: > + p =3D (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE= ); > + de =3D (ACPI_IVRS_DE_HEADER *) ((uint8_t *)ivhd + > + sizeof(ACPI_IVRS_HARDWARE)); Coverity points out that initializing 'de' in these cases is pointless, as the value is never used before it is overridden in the immediately subsequent loop. > ... > @@ -285,14 +309,30 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE * ivhd, struct am= dvi > return (0); > } > > +static bool > +ivhd_is_newer(ACPI_IVRS_HEADER *old, ACPI_IVRS_HEADER *new) > +{ > + /* > + * Newer IVRS header type take precedence. > + */ > + if ((old->DeviceId =3D=3D new->DeviceId) && > + (old->Type =3D=3D ACPI_IVRS_TYPE_HARDWARE) && > + ((new->Type =3D=3D ACPI_IVRS_TYPE_HARDWARE_EXT1) || > + (new->Type =3D=3D ACPI_IVRS_TYPE_HARDWARE_EXT1))) { Coverity also points out that both sides of this OR are the same, ACPI_IVRS_TYPE_HARDWARE_EXT1. Logically this is redundant but probably indicates a typo? Perhaps one should be ACPI_IVRS_TYPE_HARDWARE_EXT2? Thanks, Conrad From owner-svn-src-all@freebsd.org Tue Feb 20 20:14:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35F8CF27127; Tue, 20 Feb 2018 20:14:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D91996AC27; Tue, 20 Feb 2018 20:14:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3DA0673F; Tue, 20 Feb 2018 20:14:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKEBLm044015; Tue, 20 Feb 2018 20:14:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKEBxW044014; Tue, 20 Feb 2018 20:14:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202014.w1KKEBxW044014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329658 - head/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/ztest X-SVN-Commit-Revision: 329658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:14:12 -0000 Author: mav Date: Tue Feb 20 20:14:11 2018 New Revision: 329658 URL: https://svnweb.freebsd.org/changeset/base/329658 Log: MFV r316872: 7502 ztest should run zdb with -G (debug mode) illumos/illumos-gate@c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://github.com/illumos/illumos-gate/commit/c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://www.illumos.org/issues/7502 Right now ztest executes zdb without -G, so when it has errors, the messages are often not very helpful: Executing zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest zdb: can't open 'ztest': Operation not supported ztest: '/usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest' exit code 1 With -G, we'd have: /usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache -G ztest zdb: can't open 'ztest': Operation not supported ZFS_DBGMSG(zdb): spa_open_common: opening ztest spa_load(ztest): LOADING spa_load(ztest): FAILED: unable to parse config [error=48] spa_load(ztest): UNLOADING Which indicates where the error came from Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Gordon Ross Author: Pavel Zakharov Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Feb 20 19:54:06 2018 (r329657) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Feb 20 20:14:11 2018 (r329658) @@ -5277,7 +5277,7 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", From owner-svn-src-all@freebsd.org Tue Feb 20 20:17:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CE0CF27539; Tue, 20 Feb 2018 20:17:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCB76B017; Tue, 20 Feb 2018 20:17:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F2C6744; Tue, 20 Feb 2018 20:17:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKHKQO044373; Tue, 20 Feb 2018 20:17:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKHK9B044372; Tue, 20 Feb 2018 20:17:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202017.w1KKHK9B044372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329659 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:17:20 -0000 Author: mav Date: Tue Feb 20 20:17:19 2018 New Revision: 329659 URL: https://svnweb.freebsd.org/changeset/base/329659 Log: MFV r316873: 7233 dir_is_empty should open directory with CLOEXEC illumos/illumos-gate@d420209d9c807f782c1d31f5683be74798142198 https://github.com/illumos/illumos-gate/commit/d420209d9c807f782c1d31f5683be74798142198 https://www.illumos.org/issues/7233 This fixes a race where one thread is executing zfs_mount() while another thread forks and execs. If the fork occurs while the directory is open, the child process will inherit (but not necessarily close immediately) the open fd for the directory, preventing the mount. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Richard Lowe Author: Alex Reece Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:14:11 2018 (r329658) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:17:19 2018 (r329659) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright (c) 2014, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -187,9 +188,16 @@ dir_is_empty(const char *dirname) { DIR *dirp; struct dirent64 *dp; + int dirfd; - if ((dirp = opendir(dirname)) == NULL) + if ((dirfd = openat(AT_FDCWD, dirname, + O_RDONLY | O_NDELAY | O_LARGEFILE | O_CLOEXEC, 0)) < 0) { return (B_TRUE); + } + + if ((dirp = fdopendir(dirfd)) == NULL) { + return (B_TRUE); + } while ((dp = readdir64(dirp)) != NULL) { From owner-svn-src-all@freebsd.org Tue Feb 20 20:19:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FB7AF2787B; Tue, 20 Feb 2018 20:19:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA0146B38D; Tue, 20 Feb 2018 20:19:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4C2C6746; Tue, 20 Feb 2018 20:19:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKJcu7044515; Tue, 20 Feb 2018 20:19:38 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKJcjm044514; Tue, 20 Feb 2018 20:19:38 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802202019.w1KKJcjm044514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Feb 2018 20:19:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329660 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:19:39 -0000 Author: mjg Date: Tue Feb 20 20:19:38 2018 New Revision: 329660 URL: https://svnweb.freebsd.org/changeset/base/329660 Log: Fix reaping on process fd close broken after r329449 The only consumer of proc_reap other than proc_to_reap was not updated to not PROC_SLOCK. Reported by: Juan Ramon Molina Menor Modified: head/sys/kern/sys_procdesc.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Tue Feb 20 20:17:19 2018 (r329659) +++ head/sys/kern/sys_procdesc.c Tue Feb 20 20:19:38 2018 (r329660) @@ -398,7 +398,6 @@ procdesc_close(struct file *fp, struct thread *td) * process's reference to the process descriptor when it * calls back into procdesc_reap(). */ - PROC_SLOCK(p); proc_reap(curthread, p, NULL, 0); } else { /* From owner-svn-src-all@freebsd.org Tue Feb 20 20:26:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4169F28520; Tue, 20 Feb 2018 20:26:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2209C6C5C5; Tue, 20 Feb 2018 20:26:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C788B68ED; Tue, 20 Feb 2018 20:26:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKQmRT051154; Tue, 20 Feb 2018 20:26:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKQmVm051153; Tue, 20 Feb 2018 20:26:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202026.w1KKQmVm051153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:26:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329661 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:26:51 -0000 Author: mav Date: Tue Feb 20 20:26:48 2018 New Revision: 329661 URL: https://svnweb.freebsd.org/changeset/base/329661 Log: MFV r316875: 7336 vfork and O_CLOEXEC causes zfs_mount EBUSY illumos/illumos-gate@873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://github.com/illumos/illumos-gate/commit/873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://www.illumos.org/issues/7336 We can run into a problem where we call into zfs_mount, which in turn calls is_dir_empty, which opens the directory to try and make sure it's empty. The issue with the current approach is that it holds the directory open while it traverses it with readdir, which, due to subtle interaction with the Java JVM, vfork, and exec can cause a tricky race condition resulting in zfs_mount failures. The approach to resolving the issue in this patch is to drop the usage of readdir altogether, and instead rely on the fact that ZFS stores the number of entries contained in a directory using the st_size field of the stat structure. Thus, if the directory in question is a ZFS directory, we can check to see if it's empty by calling stat() and inspecting the st_size field of structure returned. =============================================================================== The root cause appears to be an interesting race between vfork, exec, and zfs_mount's usage of O_CLOEXEC when calling openat. Here's what is going on: 1. We call zfs_mount, and this in turn calls openat to check if the directory is empty, which results in opening the directory we're trying to mount onto, and increment v_count. 2. As we're in the middle of reading the directory, vfork is called by the JVM and proceeds to exec the jspawnhelper utility. As a result of the vfork, we take an additional hold on the directory, which increments v_count a second time. The semantics of vfork mean the parent process will wait for the child process to exit or exec before the parent can continue; at this point the parent is in the middle of zfs_mount, reading the directory to determine if it's empty or not. 3. The child process exec-ing jspawnhelper gets to the relvm call within exec_args (which is called by exec_common). relvm is the function that releases the parent process, allowing the parent to proceed. The problem is, at this point of calling relvm, the child hasn't yet called close_exec which is responsible for closing the file descriptors inherited from the parent process Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Robert Mustacchi Approved by: Dan McDonald Author: Prakash Surya Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:19:38 2018 (r329660) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:26:48 2018 (r329661) @@ -78,6 +78,7 @@ #include #include #include +#include #include @@ -178,14 +179,33 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint } #ifdef illumos -/* - * Returns true if the specified directory is empty. If we can't open the - * directory at all, return true so that the mount can fail with a more - * informative error message. - */ static boolean_t -dir_is_empty(const char *dirname) +dir_is_empty_stat(const char *dirname) { + struct stat st; + + /* + * We only want to return false if the given path is a non empty + * directory, all other errors are handled elsewhere. + */ + if (stat(dirname, &st) < 0 || !S_ISDIR(st.st_mode)) { + return (B_TRUE); + } + + /* + * An empty directory will still have two entries in it, one + * entry for each of "." and "..". + */ + if (st.st_size > 2) { + return (B_FALSE); + } + + return (B_TRUE); +} + +static boolean_t +dir_is_empty_readdir(const char *dirname) +{ DIR *dirp; struct dirent64 *dp; int dirfd; @@ -211,6 +231,42 @@ dir_is_empty(const char *dirname) (void) closedir(dirp); return (B_TRUE); +} + +/* + * Returns true if the specified directory is empty. If we can't open the + * directory at all, return true so that the mount can fail with a more + * informative error message. + */ +static boolean_t +dir_is_empty(const char *dirname) +{ + struct statvfs64 st; + + /* + * If the statvfs call fails or the filesystem is not a ZFS + * filesystem, fall back to the slow path which uses readdir. + */ + if ((statvfs64(dirname, &st) != 0) || + (strcmp(st.f_basetype, "zfs") != 0)) { + return (dir_is_empty_readdir(dirname)); + } + + /* + * At this point, we know the provided path is on a ZFS + * filesystem, so we can use stat instead of readdir to + * determine if the directory is empty or not. We try to avoid + * using readdir because that requires opening "dirname"; this + * open file descriptor can potentially end up in a child + * process if there's a concurrent fork, thus preventing the + * zfs_mount() from otherwise succeeding (the open file + * descriptor inherited by the child process will cause the + * parent's mount to fail with EBUSY). The performance + * implications of replacing the open, read, and close with a + * single stat is nice; but is not the main motivation for the + * added complexity. + */ + return (dir_is_empty_stat(dirname)); } #endif From owner-svn-src-all@freebsd.org Tue Feb 20 20:29:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8FA0F28AF8; Tue, 20 Feb 2018 20:29:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BC916D455; Tue, 20 Feb 2018 20:29:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 669C56906; Tue, 20 Feb 2018 20:29:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKTfEZ052716; Tue, 20 Feb 2018 20:29:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKTfvM052715; Tue, 20 Feb 2018 20:29:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202029.w1KKTfvM052715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 20:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329662 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:29:41 -0000 Author: kevans Date: Tue Feb 20 20:29:41 2018 New Revision: 329662 URL: https://svnweb.freebsd.org/changeset/base/329662 Log: lualoader: Replace invalid construct with valid construct It only worked by coincidence, but it did work. Store varargs in a table instead and work off of that. Modified: head/stand/lua/loader.lua Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Tue Feb 20 20:26:48 2018 (r329661) +++ head/stand/lua/loader.lua Tue Feb 20 20:29:41 2018 (r329662) @@ -35,7 +35,14 @@ local password = require("password"); -- arguments passed as a lua function. This gives lua a chance to intercept -- builtin CLI commands like "boot" function cli_execute(...) - local cmd_name, cmd_args = ...; + local argv = {...}; + -- Just in case... + if (#argv == 0) then + loader.command(...); + return; + end + + local cmd_name = argv[1]; local cmd = _G[cmd_name]; if (cmd ~= nil) and (type(cmd) == "function") then -- Pass argv wholesale into cmd. We could omit argv[0] since the From owner-svn-src-all@freebsd.org Tue Feb 20 20:30:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A14F28CCB; Tue, 20 Feb 2018 20:30:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D98D6D694; Tue, 20 Feb 2018 20:30:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ED9C6913; Tue, 20 Feb 2018 20:30:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKUfnf052820; Tue, 20 Feb 2018 20:30:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKUfvJ052818; Tue, 20 Feb 2018 20:30:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202030.w1KKUfvJ052818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329663 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:30:42 -0000 Author: mav Date: Tue Feb 20 20:30:40 2018 New Revision: 329663 URL: https://svnweb.freebsd.org/changeset/base/329663 Log: MFV r316876: 7542 zfs_unmount failed with EZFS_UNSHARENFSFAILED illumos/illumos-gate@09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://github.com/illumos/illumos-gate/commit/09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://www.illumos.org/issues/7542 libshare keeps a cached copy of the sharetab listing in memory, which can become out of date if shares are destroyed or created while leaving a libzfs handle open. This results in a spurious unmounting failure when an NFS share exists but isn't in the stale libshare cache. Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Matt Amdur Approved by: Robert Mustacchi Author: Chris Williamson Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Tue Feb 20 20:29:41 2018 (r329662) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Tue Feb 20 20:30:40 2018 (r329663) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ @@ -72,7 +72,6 @@ struct libzfs_handle { int libzfs_printerr; int libzfs_storeerr; /* stuff error messages into buffer */ void *libzfs_sharehdl; /* libshare handle */ - uint_t libzfs_shareflags; boolean_t libzfs_mnttab_enable; avl_tree_t libzfs_mnttab_cache; int libzfs_pool_iter; @@ -81,8 +80,6 @@ struct libzfs_handle { char libzfs_chassis_id[256]; boolean_t libzfs_prop_debug; }; - -#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */ struct zfs_handle { libzfs_handle_t *zfs_hdl; Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:29:41 2018 (r329662) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Feb 20 20:30:40 2018 (r329663) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -672,8 +672,6 @@ _zfs_init_libshare(void) int zfs_init_libshare(libzfs_handle_t *zhandle, int service) { - int ret = SA_OK; - #ifdef illumos /* * libshare is either not installed or we're in a branded zone. The @@ -684,31 +682,28 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic if (_sa_init == NULL) return (SA_OK); - if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { - /* - * We had a cache miss. Most likely it is a new ZFS - * dataset that was just created. We want to make sure - * so check timestamps to see if a different process - * has updated any of the configuration. If there was - * some non-ZFS change, we need to re-initialize the - * internal cache. - */ - zhandle->libzfs_shareflags &= ~ZFSSHARE_MISS; - if (_sa_needs_refresh != NULL && - _sa_needs_refresh(zhandle->libzfs_sharehdl)) { - zfs_uninit_libshare(zhandle); - zhandle->libzfs_sharehdl = _sa_init(service); - } + /* + * Attempt to refresh libshare. This is necessary if there was a cache + * miss for a new ZFS dataset that was just created, or if state of the + * sharetab file has changed since libshare was last initialized. We + * want to make sure so check timestamps to see if a different process + * has updated any of the configuration. If there was some non-ZFS + * change, we need to re-initialize the internal cache. + */ + if (_sa_needs_refresh != NULL && + _sa_needs_refresh(zhandle->libzfs_sharehdl)) { + zfs_uninit_libshare(zhandle); + zhandle->libzfs_sharehdl = _sa_init(service); } - if (ret == SA_OK && zhandle && zhandle->libzfs_sharehdl == NULL) + if (zhandle && zhandle->libzfs_sharehdl == NULL) zhandle->libzfs_sharehdl = _sa_init(service); - if (ret == SA_OK && zhandle->libzfs_sharehdl == NULL) - ret = SA_NO_MEMORY; + if (zhandle->libzfs_sharehdl == NULL) + return (SA_NO_MEMORY); #endif - return (ret); + return (SA_OK); } /* @@ -864,7 +859,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t * zfs_get_name(zhp)); return (-1); } - hdl->libzfs_shareflags |= ZFSSHARE_MISS; share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint); } From owner-svn-src-all@freebsd.org Tue Feb 20 20:34:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EAA1F00245; Tue, 20 Feb 2018 20:34:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C831E6DC8E; Tue, 20 Feb 2018 20:34:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C21246A9C; Tue, 20 Feb 2018 20:34:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKY4H2057676; Tue, 20 Feb 2018 20:34:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKY4NC057675; Tue, 20 Feb 2018 20:34:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202034.w1KKY4NC057675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329664 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:34:05 -0000 Author: mav Date: Tue Feb 20 20:34:04 2018 New Revision: 329664 URL: https://svnweb.freebsd.org/changeset/base/329664 Log: MFV r316893: 7604 if volblocksize property is the default, it displays as "-" rather than 8K illumos/illumos-gate@4d86c0eab246bdfddc2dd52410ba808433bd6266 https://github.com/illumos/illumos-gate/commit/4d86c0eab246bdfddc2dd52410ba808433bd6266 https://www.illumos.org/issues/7604 If a zvol has the default setting for the "volblocksize" property, it is 8KB. However, it is displayed as "-" (not present), rather than "8K". The problem was introduced by: commit 25228e830e86924a41243343b1de9daf2d7dd43a Author: Matthew Ahrens <mahrens@delphix.com> Date: Thu Nov 17 14:37:24 2016 -0800 7571 non-present readonly numeric ZFS props do not have default value which changed changed get_numeric_property() to indicate that readonly default properties are not present. However, zfs_prop_readonly() returns TRUE for both readonly and set-once properties (e.g. volblocksize). Amusingly, that commit essentially reverted: 6900484 default volblocksize is no longer being reported correctly from November 2009. However, that change was not correct either; the correct solution is to only do this check for "truly readonly" (i.e. not setonce) properties. $ zfs list -t volume -o name,volblocksize NAME VOLBLOCK domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ archive - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ datafile - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ external - rpool/dump 128K rpool/swap 4K rpool/swap1 =============================================================================== Reviewed by: Pavel Zakharov Reviewed by: Paul Dagnelie Reviewed by: John Kennedy Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Feb 20 20:30:40 2018 (r329663) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Feb 20 20:34:04 2018 (r329664) @@ -2161,9 +2161,12 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t pro /* * If we tried to use a default value for a * readonly property, it means that it was not - * present. + * present. Note this only applies to "truly" + * readonly properties, not set-once properties + * like volblocksize. */ if (zfs_prop_readonly(prop) && + !zfs_prop_setonce(prop) && *source != NULL && (*source)[0] == '\0') { *source = NULL; return (-1); From owner-svn-src-all@freebsd.org Tue Feb 20 20:37:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD919F0060D; Tue, 20 Feb 2018 20:37:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7002D6DF3A; Tue, 20 Feb 2018 20:37:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 518416AA0; Tue, 20 Feb 2018 20:37:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKb1ND057854; Tue, 20 Feb 2018 20:37:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKb1lh057853; Tue, 20 Feb 2018 20:37:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202037.w1KKb1lh057853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329665 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:37:02 -0000 Author: mav Date: Tue Feb 20 20:37:01 2018 New Revision: 329665 URL: https://svnweb.freebsd.org/changeset/base/329665 Log: MFV r316901: 7730 libzfs`add_config() leaks config nvl when reading spare/l2cache devices illumos/illumos-gate@105686550ee9cbf5d033166a8a2a5a763667d436 https://github.com/illumos/illumos-gate/commit/105686550ee9cbf5d033166a8a2a5a763667d436 https://www.illumos.org/issues/7730 antares:root:~# mdb /usr/sbin/zpool > ::sysbp _exit > ::run import pool: data id: 2093977168778024605 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: data ONLINE c6t0d0 ONLINE c6t1d0 ONLINE cache c6t2d0 mdb: stop on entry to _exit mdb: target stopped at: 0xfee556ba: nop mdb: You've got symbols! Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 ] > ::findleaks -d BYTES LEAKED VMEM_SEG CALLER 4096 10 fda7b000 MMAP 8192 1 fea8d000 MMAP 8192 1 fe76d000 MMAP 8192 1 fe66e000 MMAP 4096 1 fe570000 MMAP 8192 1 fe470000 MMAP 4096 1 fe372000 MMAP 4096 1 fe273000 MMAP Reviewed by: Matthew Ahrens Reviewed by: Serapheim Dimitropoulos Approved by: Robert Mustacchi Author: Yuri Pankov Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Tue Feb 20 20:34:04 2018 (r329664) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Tue Feb 20 20:37:01 2018 (r329665) @@ -240,9 +240,12 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, cons free(ne); return (-1); } + ne->ne_guid = vdev_guid; ne->ne_next = pl->names; pl->names = ne; + + nvlist_free(config); return (0); } From owner-svn-src-all@freebsd.org Tue Feb 20 20:39:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D263CF009D5; Tue, 20 Feb 2018 20:39:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82B7A6E1B0; Tue, 20 Feb 2018 20:39:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D8786AC5; Tue, 20 Feb 2018 20:39:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKdYnR058004; Tue, 20 Feb 2018 20:39:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKdYXx058003; Tue, 20 Feb 2018 20:39:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802202039.w1KKdYXx058003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Feb 2018 20:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329666 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:39:35 -0000 Author: mjg Date: Tue Feb 20 20:39:34 2018 New Revision: 329666 URL: https://svnweb.freebsd.org/changeset/base/329666 Log: mtx: add debug assertions to mtx_spin_wait_unlocked Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue Feb 20 20:37:01 2018 (r329665) +++ head/sys/kern/kern_mutex.c Tue Feb 20 20:39:34 2018 (r329666) @@ -1231,6 +1231,14 @@ mtx_spin_wait_unlocked(struct mtx *m) { struct lock_delay_arg lda; + KASSERT(m->mtx_lock != MTX_DESTROYED, + ("%s() of destroyed mutex %p", __func__, m)); + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin, + ("%s() of sleep mutex %p (%s)", __func__, m, + m->lock_object.lo_name)); + KASSERT(!mtx_owned(m), ("%s() waiting on myself on lock %p (%s)", __func__, m, + m->lock_object.lo_name)); + lda.spin_cnt = 0; while (atomic_load_acq_ptr(&m->mtx_lock) != MTX_UNOWNED) { From owner-svn-src-all@freebsd.org Tue Feb 20 20:40:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A35B4F00C8F; Tue, 20 Feb 2018 20:40:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 554196E498; Tue, 20 Feb 2018 20:40:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 503176AE3; Tue, 20 Feb 2018 20:40:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKeul4058125; Tue, 20 Feb 2018 20:40:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKeuhN058123; Tue, 20 Feb 2018 20:40:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202040.w1KKeuhN058123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329667 - in head/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Commit-Revision: 329667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:40:57 -0000 Author: mav Date: Tue Feb 20 20:40:55 2018 New Revision: 329667 URL: https://svnweb.freebsd.org/changeset/base/329667 Log: MFV r316902: 7745 print error if lzc_* is called before libzfs_core_init illumos/illumos-gate@7c13517fff71be473e47531ef4330160c042bedc https://github.com/illumos/illumos-gate/commit/7c13517fff71be473e47531ef4330160c042bedc https://www.illumos.org/issues/7745 The problem is that consumers of `libZFS_Core` that forget to call `libzfs_core_init()` before calling any other function of the library are having a hard time realizing their mistake. The library's internal file descriptor is declared as global static, which is ok, but it is not initialized explicitly; therefore, it defaults to 0, which is a valid file descriptor. If `libzfs_core_init()`, which explicitly initializes the correct fd, is skipped, the ioctl functions return errors that do not have anything to do with `libZFS_Core`, where the problem is actually located. Even though assertions for that existed within `libZFS_Core` for debug builds, they were never enabled because the `-DDEBUG` flag was missing from the compiler flags. This patch applies the following changes: 1. It adds `-DDEBUG` for debug builds of `libZFS_Core` and `libzfs`, to enable their assertions on debug builds. 2. It corrects an assertion within `libzfs`, where a function had been spelled incorrectly (`zpool_prop_unsupported()`) and nobody knew because the `-DDEBUG` flag was missing, and the preprocessor was taking that part of the code away. 3. The library's internal fd is initialized to `-1` and `VERIFY` assertions have been placed to check that the fd is not equal to `-1` before issuing any ioctl. It is important here to note, that the `VERIFY` assertions exist in both debug and non-debug builds. 4. In `libzfs_core_fini` we make sure to never increment the refcount of our fd below 0, and also reset the fd to `-1` when no one refers to it. The reason for this, is for the rare case that the consumer closes all references but then calls one of the library's functions without using `libzfs_core_init()` first, and in the mean time, a previous call to `open()` decided to reuse our previous fd. This scenario would have passed our assertion in Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Serapheim Dimitropoulos Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Feb 20 20:39:34 2018 (r329666) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Feb 20 20:40:55 2018 (r329667) @@ -273,6 +273,15 @@ cksummer(void *arg) ofp = fdopen(dda->inputfd, "r"); while (ssread(drr, sizeof (*drr), ofp) != 0) { + /* + * kernel filled in checksum, we are going to write same + * record, but need to regenerate checksum. + */ + if (drr->drr_type != DRR_BEGIN) { + bzero(&drr->drr_u.drr_checksum.drr_checksum, + sizeof (drr->drr_u.drr_checksum.drr_checksum)); + } + switch (drr->drr_type) { case DRR_BEGIN: { Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Feb 20 20:39:34 2018 (r329666) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Feb 20 20:40:55 2018 (r329667) @@ -94,7 +94,7 @@ extern int zfs_ioctl_version; #endif -static int g_fd; +static int g_fd = -1; static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; static int g_refcount; @@ -120,9 +120,14 @@ libzfs_core_fini(void) { (void) pthread_mutex_lock(&g_lock); ASSERT3S(g_refcount, >, 0); - g_refcount--; - if (g_refcount == 0) + + if (g_refcount > 0) + g_refcount--; + + if (g_refcount == 0 && g_fd != -1) { (void) close(g_fd); + g_fd = -1; + } (void) pthread_mutex_unlock(&g_lock); } @@ -139,6 +144,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, size_t size; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); @@ -411,6 +417,9 @@ lzc_exists(const char *dataset) */ zfs_cmd_t zc = { 0 }; + ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); + (void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name)); return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0); } @@ -656,6 +665,7 @@ recv_impl(const char *snapname, nvlist_t *props, const int error; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); /* zc_name is name of containing filesystem */ (void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name)); From owner-svn-src-all@freebsd.org Tue Feb 20 20:46:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0AE1F012CE; Tue, 20 Feb 2018 20:46:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8202D6E878; Tue, 20 Feb 2018 20:46:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C6346C7A; Tue, 20 Feb 2018 20:46:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KKkRBU063175; Tue, 20 Feb 2018 20:46:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KKkRcZ063174; Tue, 20 Feb 2018 20:46:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802202046.w1KKkRcZ063174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Feb 2018 20:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329668 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:46:28 -0000 Author: mav Date: Tue Feb 20 20:46:27 2018 New Revision: 329668 URL: https://svnweb.freebsd.org/changeset/base/329668 Log: MFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup() illumos/illumos-gate@d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://github.com/illumos/illumos-gate/commit/d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://www.illumos.org/issues/7990 The snapspec_cb() callback function in libzfs does not need to call zfs_strdup(). Reviewed by: Yuri Pankov Reviewed by: Toomas Soome Approved by: Matthew Ahrens Author: Marcel Telka Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Tue Feb 20 20:40:55 2018 (r329667) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Tue Feb 20 20:46:27 2018 (r329668) @@ -317,26 +317,23 @@ static int snapspec_cb(zfs_handle_t *zhp, void *arg) { snapspec_arg_t *ssa = arg; - char *shortsnapname; + const char *shortsnapname; int err = 0; if (ssa->ssa_seenlast) return (0); - shortsnapname = zfs_strdup(zhp->zfs_hdl, - strchr(zfs_get_name(zhp), '@') + 1); + shortsnapname = strchr(zfs_get_name(zhp), '@') + 1; if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) ssa->ssa_seenfirst = B_TRUE; + if (strcmp(shortsnapname, ssa->ssa_last) == 0) + ssa->ssa_seenlast = B_TRUE; if (ssa->ssa_seenfirst) { err = ssa->ssa_func(zhp, ssa->ssa_arg); } else { zfs_close(zhp); } - - if (strcmp(shortsnapname, ssa->ssa_last) == 0) - ssa->ssa_seenlast = B_TRUE; - free(shortsnapname); return (err); } From owner-svn-src-all@freebsd.org Tue Feb 20 20:48:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF51F01537 for ; Tue, 20 Feb 2018 20:48:04 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com [IPv6:2a00:1450:400c:c0c::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B671D6EA33 for ; Tue, 20 Feb 2018 20:48:03 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wr0-x22c.google.com with SMTP id n7so18173841wrn.5 for ; Tue, 20 Feb 2018 12:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+3yB7Js63sx1UsT2sY7zUqVCOBfcHD6D14RqU61HEZk=; b=KiO0bGTYhe1jDsnmTPXdKnok+Pi4TrEjUe9ovyLu3vwVyTKW2ljtfsH6Z9GmDlk+kZ BwI5IIOlOsR1r99TmvhXYx1cV1g0ecEQIkoysHirYsUUWg/Jcib6KvC6czPLbHeA1cuV x0N2CdL8arFn1RsSFVYDK4dQgAc40Zpgywm1gIBlBHEfG37o1tHx4T7UK1VLaiv6IVC4 Ky+K8u6QqIqPTUYXQKWX26Uhu+Eq+gHZHj062AbKBrwsmdlam2D79B5QF0RA2Sxi94QC BejKm2KzBcyK76T3bvkflOV2XVgDD5GIjs34N7WWbt06qMGTVphq52wui5WXqO0TIliH gcGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+3yB7Js63sx1UsT2sY7zUqVCOBfcHD6D14RqU61HEZk=; b=LSIBM/iVX2Xpxqubsh2uzAfsnKprf0lH7xr13eYarxCRVmf3aupKcGApEtLOUkiE8C E6D4I+2Vd4LwGroENjYHY5BcS6h3WfhFOQxYE/jW2JEqCCIt0MYi4kemo1S+zTH2agia vqJUKOERqyHyydXbsuZJWGL++o4uZwjou7kbVCNYrQ/9YJlXIPeyIp//bZr7bZ9qoiRa Cj8Opd5fUXO7rUUBj76tm2PpXV7JwU0i0x66YuQrx5FkNVTap/0+pTW13ri/X787f9KL N4yMDxxnncxpWDycq8SDu/j2JMAOOOrOfwa9MuekYofmbzARnzLFtM/HjSWJV9iMeb60 rdog== X-Gm-Message-State: APf1xPCeEHQa+4sINjdVEEIkup+Pxbb2cqa02uB3yobR6s42MaaZYvyH KMRFhnmTCW4jq/EVgkTRMnBb7swPD0nAtB6GIj+rEw== X-Google-Smtp-Source: AH8x22516WONfdaz7zt3KMvVIiVQLwiFSTLUMW5I3Qk2X2kRHFEQRetr+0+3MYx5+HsHGdz1xPgyqInyhn3wjSdAgTE= X-Received: by 10.80.170.131 with SMTP id q3mr1912313edc.43.1519159682742; Tue, 20 Feb 2018 12:48:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.148.97 with HTTP; Tue, 20 Feb 2018 12:48:02 -0800 (PST) In-Reply-To: <201802201821.w1KILUUg079715@repo.freebsd.org> References: <201802201821.w1KILUUg079715@repo.freebsd.org> From: Oliver Pinter Date: Tue, 20 Feb 2018 21:48:02 +0100 Message-ID: Subject: Re: svn commit: r329649 - head/stand/liblua To: Conrad Meyer Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 20:48:04 -0000 On Tuesday, February 20, 2018, Conrad Meyer wrote: > Author: cem > Date: Tue Feb 20 18:21:30 2018 > New Revision: 329649 > URL: https://svnweb.freebsd.org/changeset/base/329649 > > Log: > Lua lfs.attributes: Provide a more consistent error return > > In the remaining error case, return a 3-tuple consistent with the other > error return case. > > Document how to invoke lfs.attributes() and detect/decode error return in > example comments. > > Reviewed by: kevans > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14451 > > Modified: > head/stand/liblua/lfs.c > > Modified: head/stand/liblua/lfs.c > ============================================================ > ================== > --- head/stand/liblua/lfs.c Tue Feb 20 18:12:07 2018 (r329648) > +++ head/stand/liblua/lfs.c Tue Feb 20 18:21:30 2018 (r329649) > @@ -80,13 +80,20 @@ __FBSDID("$FreeBSD$"); > * (etc.) > * > * The other available API is lfs.attributes(), which functions somewhat > like > - * stat(2) and returns a table of values: > + * stat(2) and returns a table of values. Example code: > * > - * for k, v in pairs(lfs.attributes("/boot")) do > + * attrs, errormsg, errorcode = lfs.attributes("/boot") > + * if attrs == nil then > + * print(errormsg) > + * return errorcode > + * end > + * > + * for k, v in pairs(attrs) do > * print(k .. ":\t" .. v) > * end > + * return 0 Hi! Missing ; at the end of lines here. > * > - * Prints: > + * Prints (on success): > * gid: 0 > * change: 140737488342640 > * mode: directory > @@ -277,7 +284,9 @@ lua_attributes(lua_State *L) > path = luaL_checkstring(L, 1); > if (path == NULL) { > lua_pushnil(L); > - return 1; > + lua_pushfstring(L, "cannot convert first argument to > string"); > + lua_pushinteger(L, EINVAL); > + return 3; > } > > rc = stat(path, &sb); > _______________________________________________ > 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-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Tue Feb 20 21:13:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 036C1F03641; Tue, 20 Feb 2018 21:13:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8A896FD64; Tue, 20 Feb 2018 21:13:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A30F67158; Tue, 20 Feb 2018 21:13:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLDLiD078440; Tue, 20 Feb 2018 21:13:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLDLCw078439; Tue, 20 Feb 2018 21:13:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202113.w1KLDLCw078439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 21:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329669 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:13:22 -0000 Author: kevans Date: Tue Feb 20 21:13:21 2018 New Revision: 329669 URL: https://svnweb.freebsd.org/changeset/base/329669 Log: lualoader: Prefer selected kernel to currently loaded Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Feb 20 20:46:27 2018 (r329668) +++ head/stand/lua/config.lua Tue Feb 20 21:13:21 2018 (r329669) @@ -430,7 +430,7 @@ function config.reload(file) end function config.loadelf() - local kernel = config.kernel_loaded or config.kernel_selected; + local kernel = config.kernel_selected or config.kernel_loaded; local loaded = false; print("Loading kernel..."); From owner-svn-src-all@freebsd.org Tue Feb 20 21:15:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A28F038DF; Tue, 20 Feb 2018 21:15:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0539370005; Tue, 20 Feb 2018 21:15:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00143715B; Tue, 20 Feb 2018 21:15:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLFhmn078711; Tue, 20 Feb 2018 21:15:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLFhcP078710; Tue, 20 Feb 2018 21:15:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202115.w1KLFhcP078710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 21:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329670 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:15:44 -0000 Author: kevans Date: Tue Feb 20 21:15:43 2018 New Revision: 329670 URL: https://svnweb.freebsd.org/changeset/base/329670 Log: lualoader: Don't try so hard to load a kernel If the user's selected a kernel, we really should be trying to load that one instead of falling back to some default kernel. This should generally be a no-op and most desirable, unless you really enjoyed surprises. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Feb 20 21:13:21 2018 (r329669) +++ head/stand/lua/config.lua Tue Feb 20 21:15:43 2018 (r329670) @@ -437,11 +437,6 @@ function config.loadelf() loaded = config.loadkernel(kernel); if (not loaded) then - loaded = config.loadkernel(); - end - - if (not loaded) then - -- Ultimately failed to load kernel print("Failed to load any kernel"); return; end From owner-svn-src-all@freebsd.org Tue Feb 20 21:23:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1D9DF0429F; Tue, 20 Feb 2018 21:23:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5434706C6; Tue, 20 Feb 2018 21:23:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A00917307; Tue, 20 Feb 2018 21:23:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLN11r083389; Tue, 20 Feb 2018 21:23:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLN19M083388; Tue, 20 Feb 2018 21:23:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202123.w1KLN19M083388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 21:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329671 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:23:02 -0000 Author: kevans Date: Tue Feb 20 21:23:01 2018 New Revision: 329671 URL: https://svnweb.freebsd.org/changeset/base/329671 Log: lualoader: Prepare for interception of "boot" CLI cmd core.boot and core.autoboot may both take arguments; add a helper to cleanly append an argstring to the given loader command. Also provide a popFrontTable() that we'll use pop the command name off of an argv table. We don't have the table library included, and including it is non-trivial, so we'll implement this one function that we need in lua for the time being. Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 21:15:43 2018 (r329670) +++ head/stand/lua/core.lua Tue Feb 20 21:23:01 2018 (r329671) @@ -30,6 +30,13 @@ local config = require('config'); local core = {}; +local compose_loader_cmd = function(cmd_name, argstr) + if (argstr ~= nil) then + cmd_name = cmd_name .. " " .. argstr; + end + return cmd_name; +end + -- Module exports -- Commonly appearing constants core.KEY_BACKSPACE = 8; @@ -182,14 +189,14 @@ function core.setDefaults() core.setVerbose(false); end -function core.autoboot() +function core.autoboot(argstr) config.loadelf(); - loader.perform("autoboot"); + loader.perform(compose_loader_cmd("autoboot", argstr)); end -function core.boot() +function core.boot(argstr) config.loadelf(); - loader.perform("boot"); + loader.perform(compose_loader_cmd("boot", argstr)); end function core.isSingleUserBoot() @@ -233,6 +240,29 @@ function core.shallowCopyTable(tbl) end end return new_tbl; +end + +-- XXX This should go away if we get the table lib into shape for importing. +-- As of now, it requires some 'os' functions, so we'll implement this in lua +-- for our uses +function core.popFrontTable(tbl) + -- Shouldn't reasonably happen + if (#tbl == 0) then + return nil, nil; + elseif (#tbl == 1) then + return tbl[1], {}; + end + + local first_value = tbl[1]; + local new_tbl = {}; + -- This is not a cheap operation + for k, v in ipairs(tbl) do + if (k > 1) then + new_tbl[k - 1] = v; + end + end + + return first_value, new_tbl; end -- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will From owner-svn-src-all@freebsd.org Tue Feb 20 21:27:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD973F04851; Tue, 20 Feb 2018 21:27:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8208970AA1; Tue, 20 Feb 2018 21:27:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD0D730F; Tue, 20 Feb 2018 21:27:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLRHZP083756; Tue, 20 Feb 2018 21:27:17 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLRHhi083755; Tue, 20 Feb 2018 21:27:17 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802202127.w1KLRHhi083755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 20 Feb 2018 21:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329672 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:27:18 -0000 Author: jeff Date: Tue Feb 20 21:27:17 2018 New Revision: 329672 URL: https://svnweb.freebsd.org/changeset/base/329672 Log: Fix the broken subqueue assignment for the cleanq. Reported by: pho Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Feb 20 21:23:01 2018 (r329671) +++ head/sys/kern/vfs_bio.c Tue Feb 20 21:27:17 2018 (r329672) @@ -1717,7 +1717,7 @@ bd_init(struct bufdomain *bd) domain = bd - bdclean; bd->bd_cleanq = &bd->bd_subq[mp_ncpus]; - bq_init(bd->bd_cleanq, QUEUE_CLEAN, -1, "bufq clean lock"); + bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_ncpus, "bufq clean lock"); for (i = 0; i <= mp_maxid; i++) bq_init(&bd->bd_subq[i], QUEUE_CLEAN, i, "bufq clean subqueue lock"); From owner-svn-src-all@freebsd.org Tue Feb 20 21:32:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04F13F051C4; Tue, 20 Feb 2018 21:32:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A15A271207; Tue, 20 Feb 2018 21:32:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C3F974AB; Tue, 20 Feb 2018 21:32:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLWaI6088454; Tue, 20 Feb 2018 21:32:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLWaYY088452; Tue, 20 Feb 2018 21:32:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202132.w1KLWaYY088452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 21:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329673 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:32:38 -0000 Author: kevans Date: Tue Feb 20 21:32:36 2018 New Revision: 329673 URL: https://svnweb.freebsd.org/changeset/base/329673 Log: lualoader: Intercept boot cli command This should be functional and roughly equivalent to the Forth version. Stop doing a loadelf() on menu exit now that we can DTRT with boot invocations. autoboot interception will follow not long after. Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 21:27:17 2018 (r329672) +++ head/stand/lua/core.lua Tue Feb 20 21:32:36 2018 (r329673) @@ -37,6 +37,38 @@ local compose_loader_cmd = function(cmd_name, argstr) return cmd_name; end +-- Parses arguments to boot and returns two values: kernel_name, argstr +-- Defaults to nil and "" respectively. +local parse_boot_args = function(argv) + if (#argv == 0) then + return nil, ""; + end + local kernel_name; + local argstr = ""; + + for k, v in ipairs(argv) do + if (v:sub(1,1) ~= "-") then + kernel_name = v; + else + argstr = argstr .. " " .. v; + end + end + return kernel_name, argstr; +end + +-- Globals +function boot(...) + local argv = {...}; + local cmd_name = ""; + cmd_name, argv = core.popFrontTable(argv); + local kernel, argstr = parse_boot_args(argv); + if (kernel ~= nil) then + loader.perform("unload"); + config.selectkernel(kernel); + end + core.boot(argstr); +end + -- Module exports -- Commonly appearing constants core.KEY_BACKSPACE = 8; Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Tue Feb 20 21:27:17 2018 (r329672) +++ head/stand/lua/menu.lua Tue Feb 20 21:32:36 2018 (r329673) @@ -390,7 +390,6 @@ function menu.run(m) if (m == menu.welcome) then screen.defcursor(); print("Exiting menu!"); - config.loadelf(); return false; end From owner-svn-src-all@freebsd.org Tue Feb 20 21:37:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 979E7F05A8E; Tue, 20 Feb 2018 21:37:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A3AE71676; Tue, 20 Feb 2018 21:37:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 453E874BE; Tue, 20 Feb 2018 21:37:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLbuOn088699; Tue, 20 Feb 2018 21:37:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLbuXw088698; Tue, 20 Feb 2018 21:37:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202137.w1KLbuXw088698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 21:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329674 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:37:56 -0000 Author: kevans Date: Tue Feb 20 21:37:55 2018 New Revision: 329674 URL: https://svnweb.freebsd.org/changeset/base/329674 Log: lualoader: Intercept the 'autoboot' cli command Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Feb 20 21:32:36 2018 (r329673) +++ head/stand/lua/core.lua Tue Feb 20 21:37:55 2018 (r329674) @@ -37,23 +37,33 @@ local compose_loader_cmd = function(cmd_name, argstr) return cmd_name; end +-- Internal function -- Parses arguments to boot and returns two values: kernel_name, argstr -- Defaults to nil and "" respectively. -local parse_boot_args = function(argv) +-- This will also parse arguments to autoboot, but the with_kernel argument +-- will need to be explicitly overwritten to false +local parse_boot_args = function(argv, with_kernel) if (#argv == 0) then return nil, ""; end + if (with_kernel == nil) then + with_kernel = true; + end local kernel_name; local argstr = ""; for k, v in ipairs(argv) do - if (v:sub(1,1) ~= "-") then + if (with_kernel) and (v:sub(1,1) ~= "-") then kernel_name = v; else argstr = argstr .. " " .. v; end end - return kernel_name, argstr; + if (with_kernel) then + return kernel_name, argstr; + else + return argstr; + end end -- Globals @@ -67,6 +77,14 @@ function boot(...) config.selectkernel(kernel); end core.boot(argstr); +end + +function autoboot(...) + local argv = {...} + local cmd_name = ""; + cmd_name, argv = core.popFrontTable(argv); + local argstr = parse_boot_args(argv, false); + core.autoboot(argstr); end -- Module exports From owner-svn-src-all@freebsd.org Tue Feb 20 21:42:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91949F0621E; Tue, 20 Feb 2018 21:42:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4006071B90; Tue, 20 Feb 2018 21:42:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38221764E; Tue, 20 Feb 2018 21:42:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLgkWf093592; Tue, 20 Feb 2018 21:42:46 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLgj6p093590; Tue, 20 Feb 2018 21:42:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <201802202142.w1KLgj6p093590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 20 Feb 2018 21:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329675 - in head/sys: dev/cxgbe net X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys: dev/cxgbe net X-SVN-Commit-Revision: 329675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:42:46 -0000 Author: np Date: Tue Feb 20 21:42:45 2018 New Revision: 329675 URL: https://svnweb.freebsd.org/changeset/base/329675 Log: Catch up with the removal of nktr_slot_flags from upstream netmap. No functional impact intended. Submitted by: Vincenzo Maffione Modified: head/sys/dev/cxgbe/t4_netmap.c head/sys/net/iflib.c Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Tue Feb 20 21:37:55 2018 (r329674) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Feb 20 21:42:45 2018 (r329675) @@ -974,7 +974,7 @@ t4_nm_intr(void *arg) case CPL_RX_PKT: ring->slot[fl_cidx].len = G_RSPD_LEN(lq) - sc->params.sge.fl_pktshift; - ring->slot[fl_cidx].flags = kring->nkr_slot_flags; + ring->slot[fl_cidx].flags = 0; fl_cidx += (lq & F_RSPD_NEWBUF) ? 1 : 0; fl_credits += (lq & F_RSPD_NEWBUF) ? 1 : 0; if (__predict_false(fl_cidx == nm_rxq->fl_sidx)) Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Feb 20 21:37:55 2018 (r329674) +++ head/sys/net/iflib.c Tue Feb 20 21:42:45 2018 (r329675) @@ -1068,7 +1068,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl if (netmap_no_pendintr || force_update) { int crclen = iflib_crcstrip ? 0 : 4; int error, avail; - uint16_t slot_flags = kring->nkr_slot_flags; for (i = 0; i < rxq->ifr_nfl; i++) { fl = &rxq->ifr_fl[i]; @@ -1084,7 +1083,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; if (fl->ifl_sds.ifsd_map) bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); From owner-svn-src-all@freebsd.org Tue Feb 20 21:48:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF2CF06B42; Tue, 20 Feb 2018 21:48:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C30F7212F; Tue, 20 Feb 2018 21:48:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52E557658; Tue, 20 Feb 2018 21:48:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLmHEU093860; Tue, 20 Feb 2018 21:48:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLmHDg093858; Tue, 20 Feb 2018 21:48:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802202148.w1KLmHDg093858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 20 Feb 2018 21:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329676 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 329676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:48:17 -0000 Author: bdrewery Date: Tue Feb 20 21:48:16 2018 New Revision: 329676 URL: https://svnweb.freebsd.org/changeset/base/329676 Log: Move SVNVERSION_CMD into the one place that uses it. This code, which is basically `svnversion || svnliteversion`, generates 2 fstatat(2) for every directory in PATH for every Makefile parsed that includes bsd.own.mk. This can add up for things like generating a Ports index (Poudriere) or building a dependency graph for base. Sponsored by: Dell EMC MFC after: 2 weeks Modified: head/Makefile.inc1 head/share/mk/bsd.own.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Feb 20 21:42:45 2018 (r329675) +++ head/Makefile.inc1 Tue Feb 20 21:48:16 2018 (r329676) @@ -350,6 +350,16 @@ SVN= ${_P}/${_S} .endif SVNFLAGS?= -r HEAD .if !defined(VCS_REVISION) && empty(VCS_REVISION) +.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD) +. for _D in ${PATH:S,:, ,g} +. if exists(${_D}/svnversion) +SVNVERSION_CMD?=${_D}/svnversion +. endif +. if exists(${_D}/svnliteversion) +SVNVERSION_CMD?=${_D}/svnliteversion +. endif +. endfor +.endif _VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) . if !empty(_VCS_REVISION) VCS_REVISION= $$(echo r${_VCS_REVISION}) Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Tue Feb 20 21:42:45 2018 (r329675) +++ head/share/mk/bsd.own.mk Tue Feb 20 21:48:16 2018 (r329676) @@ -230,17 +230,6 @@ XZ_CMD?= xz -T ${XZ_THREADS} XZ_CMD?= xz .endif -.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD) -. for _D in ${PATH:S,:, ,g} -. if exists(${_D}/svnversion) -SVNVERSION_CMD?=${_D}/svnversion -. endif -. if exists(${_D}/svnliteversion) -SVNVERSION_CMD?=${_D}/svnliteversion -. endif -. endfor -.endif - PKG_CMD?= pkg # Pointer to the top directory into which tests are installed. Should not be From owner-svn-src-all@freebsd.org Tue Feb 20 21:53:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAEAAF07550; Tue, 20 Feb 2018 21:53:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74B75728BC; Tue, 20 Feb 2018 21:53:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FBEE77EB; Tue, 20 Feb 2018 21:53:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KLrdnh098843; Tue, 20 Feb 2018 21:53:39 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KLrdXB098842; Tue, 20 Feb 2018 21:53:39 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802202153.w1KLrdXB098842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 20 Feb 2018 21:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329677 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 329677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 21:53:40 -0000 Author: bdrewery Date: Tue Feb 20 21:53:39 2018 New Revision: 329677 URL: https://svnweb.freebsd.org/changeset/base/329677 Log: Avoid looking up VCS_REVISION for every sub-make call to Makefile.inc1. MFC after: 2 weeks Sponsored by: Dell EMC Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Feb 20 21:48:16 2018 (r329676) +++ head/Makefile.inc1 Tue Feb 20 21:53:39 2018 (r329677) @@ -364,6 +364,7 @@ _VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) . if !empty(_VCS_REVISION) VCS_REVISION= $$(echo r${_VCS_REVISION}) . endif +.export VCS_REVISION .endif .if !defined(OSRELDATE) From owner-svn-src-all@freebsd.org Tue Feb 20 22:03:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CB77F082A0; Tue, 20 Feb 2018 22:03:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB90073015; Tue, 20 Feb 2018 22:03:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D6C799A; Tue, 20 Feb 2018 22:03:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KM34BK003766; Tue, 20 Feb 2018 22:03:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KM34mM003765; Tue, 20 Feb 2018 22:03:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802202203.w1KM34mM003765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 20 Feb 2018 22:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329678 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 329678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 22:03:05 -0000 Author: bdrewery Date: Tue Feb 20 22:03:04 2018 New Revision: 329678 URL: https://svnweb.freebsd.org/changeset/base/329678 Log: Only lookup SVN once and rename to SVN_CMD. MFC after: 2 weeks Sponsored by: Dell EMC Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Feb 20 21:53:39 2018 (r329677) +++ head/Makefile.inc1 Tue Feb 20 22:03:04 2018 (r329678) @@ -339,14 +339,15 @@ BUILDENV_SHELL?=${SHELL} BUILDENV_SHELL?=/bin/sh .endif -.if !defined(SVN) || empty(SVN) +.if !defined(SVN_CMD) || empty(SVN_CMD) . for _P in /usr/bin /usr/local/bin . for _S in svn svnlite . if exists(${_P}/${_S}) -SVN= ${_P}/${_S} +SVN_CMD= ${_P}/${_S} . endif . endfor . endfor +.export SVN_CMD .endif SVNFLAGS?= -r HEAD .if !defined(VCS_REVISION) && empty(VCS_REVISION) @@ -1794,7 +1795,7 @@ update: .PHONY @echo "--------------------------------------------------------------" @echo ">>> Updating ${.CURDIR} using Subversion" @echo "--------------------------------------------------------------" - @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) + @(cd ${.CURDIR}; ${SVN_CMD} update ${SVNFLAGS}) .endif # From owner-svn-src-all@freebsd.org Tue Feb 20 22:03:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4FB7F082C5; Tue, 20 Feb 2018 22:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8529773022; Tue, 20 Feb 2018 22:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E992799B; Tue, 20 Feb 2018 22:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KM38Me003814; Tue, 20 Feb 2018 22:03:08 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KM38NJ003813; Tue, 20 Feb 2018 22:03:08 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802202203.w1KM38NJ003813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 20 Feb 2018 22:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329679 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 329679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 22:03:09 -0000 Author: bdrewery Date: Tue Feb 20 22:03:08 2018 New Revision: 329679 URL: https://svnweb.freebsd.org/changeset/base/329679 Log: Properly lookup values if they were empty. Spotted by: rpokala X-MFC-With: r329676 MFC after: 2 weeks Sponsored by: Dell EMC Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Feb 20 22:03:04 2018 (r329678) +++ head/Makefile.inc1 Tue Feb 20 22:03:08 2018 (r329679) @@ -350,8 +350,8 @@ SVN_CMD= ${_P}/${_S} .export SVN_CMD .endif SVNFLAGS?= -r HEAD -.if !defined(VCS_REVISION) && empty(VCS_REVISION) -.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD) +.if !defined(VCS_REVISION) || empty(VCS_REVISION) +.if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) . for _D in ${PATH:S,:, ,g} . if exists(${_D}/svnversion) SVNVERSION_CMD?=${_D}/svnversion From owner-svn-src-all@freebsd.org Tue Feb 20 22:47:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F4EEF0D0FB; Tue, 20 Feb 2018 22:47:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F30275529; Tue, 20 Feb 2018 22:47:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19F8F10043; Tue, 20 Feb 2018 22:47:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KMlnmI024703; Tue, 20 Feb 2018 22:47:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KMlnZF024702; Tue, 20 Feb 2018 22:47:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802202247.w1KMlnZF024702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 22:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329680 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 22:47:50 -0000 Author: kevans Date: Tue Feb 20 22:47:49 2018 New Revision: 329680 URL: https://svnweb.freebsd.org/changeset/base/329680 Log: lualoader: When restoring environment, only restore unchanged vars Track the latest value we've set an environment variable to, and only restore those that are unchanged from that. This gives us some leeway to make sure we're not clobbering variables overwritten by menu changes. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Feb 20 22:03:08 2018 (r329679) +++ head/stand/lua/config.lua Tue Feb 20 22:47:49 2018 (r329680) @@ -142,13 +142,26 @@ function config.setCarouselIndex(id, idx) end function config.restoreEnv() + -- Examine changed environment variables for k, v in pairs(config.env_changed) do local restore_value = config.env_restore[k]; + if (restore_value == nil) then + -- This one doesn't need restored for some reason + goto continue; + end + local current_value = loader.getenv(k); + if (current_value ~= v) then + -- This was overwritten by some action taken on the menu + -- most likely; we'll leave it be. + goto continue; + end + restore_value = restore_value.value; if (restore_value ~= nil) then loader.setenv(k, restore_value); else loader.unsetenv(k); end + ::continue:: end config.env_changed = {}; @@ -156,11 +169,12 @@ function config.restoreEnv() end function config.setenv(k, v) - -- Do we need to track this change? - if (config.env_changed[k] == nil) then - config.env_changed[k] = true; - config.env_restore[k] = loader.getenv(k); + -- Track the original value for this if we haven't already + if (config.env_restore[k] == nil) then + config.env_restore[k] = {value = loader.getenv(k)}; end + + config.env_changed[k] = v; return loader.setenv(k, v); end From owner-svn-src-all@freebsd.org Tue Feb 20 22:49:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77118F0D41E; Tue, 20 Feb 2018 22:49:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C113B75756; Tue, 20 Feb 2018 22:49:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0AF6B10AFAD; Tue, 20 Feb 2018 17:49:54 -0500 (EST) From: John Baldwin To: Warner Losh Cc: Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329458 - head/sbin/devmatch Date: Tue, 20 Feb 2018 12:02:20 -0800 Message-ID: <7557197.0Wg7M2OxNi@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201802171434.w1HEYl8I063603@repo.freebsd.org> <90001804-e025-4981-6b77-350930310ceb@selasky.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 20 Feb 2018 17:49:54 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 22:49:55 -0000 On Saturday, February 17, 2018 08:12:22 AM Warner Losh wrote: > On Sat, Feb 17, 2018 at 8:04 AM, Hans Petter Selasky > wrote: > > > On 02/17/18 15:56, Warner Losh wrote: > > > >> The right fix there, I think, is to load them all at once, in one kldload > >> operation and not loop in /etc/rc.d/devmatch. > >> > > > > Each driver will invoke the driver loaded device method, so this will race > > aswell! > > > > You have a point. But, that means devmatch should read ahead the nomatch > > events until the end, to make sure the correct driver is loaded. > > > > We could batch them in the kernel. But that's still unsatisfying since > there could still be other races because multiple drivers wanting the same > device is well defined only when all the drivers are there at probe/attach > time. I think you will want a way to "freeze" device probing/attaching and then you can kldload multiple things, then "unfreeze". During the freeze we could maintain a linked-list of the bus devices that need to re-probe children. You could hook this in bus_generic_driver_added(). It might mean that we need to not permit custom bus_driver_added methods anymore, or split it up into two stages, one that is driver-specific (what calls DEVICE_IDENTIFY now and should probably still happen during a "freeze"), and one that is bus-wide and should happen after the thaw (the loop around device_probe_and_attach()). -- John Baldwin From owner-svn-src-all@freebsd.org Wed Feb 21 00:18:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5521F14B52; Wed, 21 Feb 2018 00:18:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3D87924C; Wed, 21 Feb 2018 00:18:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 766E310F80; Wed, 21 Feb 2018 00:18:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L0Iwg9070109; Wed, 21 Feb 2018 00:18:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L0IvFH070096; Wed, 21 Feb 2018 00:18:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802210018.w1L0IvFH070096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 00:18:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329681 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cdd... X-SVN-Commit-Revision: 329681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 00:18:59 -0000 Author: mav Date: Wed Feb 21 00:18:57 2018 New Revision: 329681 URL: https://svnweb.freebsd.org/changeset/base/329681 Log: MFV r318941: 7446 zpool create should support efi system partition illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821 https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821 https://www.illumos.org/issues/7446 Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi- system partition. I have borrowed the idea from oracle solaris, and introducing zpool create - B switch to provide an way to specify that boot partition should be created. However, there is still an question, how big should the system partition be. For time being, I have set default size 256MB (thats minimum size for FAT32 with 4k blocks). To support custom size, the set on creation "bootsize" property is created and so the custom size can be set as: zpool create B - o bootsize=34MB rpool c0t0d0 After pool is created, the "bootsize" property is read only. When -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value ''. Older zfs/zpool implementations are ignoring this property. https://www.illumos.org/rb/r/219/ Reviewed by: Andrew Stormont Reviewed by: Yuri Pankov Approved by: Dan McDonald Author: Toomas Soome This commit makes no sense for FreeBSD, that is why I blocked the option, but it should be good to stay closer to upstream. Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/usr.sbin/zfsd/case_file.cc head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Feb 21 00:18:57 2018 (r329681) @@ -212,7 +212,8 @@ get_usage(zpool_help_t idx) case HELP_CLEAR: return (gettext("\tclear [-nF] [device]\n")); case HELP_CREATE: - return (gettext("\tcreate [-fnd] [-o property=value] ... \n" + return (gettext("\tcreate [-fnd] [-B] " + "[-o property=value] ... \n" "\t [-O file-system-property=value] ... \n" "\t [-m mountpoint] [-R root] ...\n")); case HELP_DESTROY: @@ -499,6 +500,8 @@ zpool_do_add(int argc, char **argv) int c; nvlist_t *nvroot; char *poolname; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; zpool_handle_t *zhp; nvlist_t *config; @@ -547,9 +550,15 @@ zpool_do_add(int argc, char **argv) return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + /* pass off to get_vdev_spec for processing */ + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, !force, B_FALSE, dryrun, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); @@ -774,10 +783,11 @@ errout: } /* - * zpool create [-fnd] [-o property=value] ... + * zpool create [-fnd] [-B] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... * + * -B Create boot partition. * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. @@ -794,12 +804,16 @@ errout: * we get the nvlist back from get_vdev_spec(), we either print out the contents * (if '-n' was specified), or pass it to libzfs to do the creation. */ + +#define SYSTEM256 (256 * 1024 * 1024) int zpool_do_create(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; boolean_t enable_all_pool_feat = B_TRUE; + zpool_boot_label_t boot_type = ZPOOL_NO_BOOT_LABEL; + uint64_t boot_size = 0; int c; nvlist_t *nvroot = NULL; char *poolname; @@ -811,7 +825,7 @@ zpool_do_create(int argc, char **argv) char *propval; /* check options */ - while ((c = getopt(argc, argv, ":fndR:m:o:O:")) != -1) { + while ((c = getopt(argc, argv, ":fndBR:m:o:O:")) != -1) { switch (c) { case 'f': force = B_TRUE; @@ -822,6 +836,22 @@ zpool_do_create(int argc, char **argv) case 'd': enable_all_pool_feat = B_FALSE; break; + case 'B': +#ifdef illumos + /* + * We should create the system partition. + * Also make sure the size is set. + */ + boot_type = ZPOOL_CREATE_BOOT_LABEL; + if (boot_size == 0) + boot_size = SYSTEM256; + break; +#else + (void) fprintf(stderr, + gettext("option '%c' is not supported\n"), + optopt); + goto badusage; +#endif case 'R': altroot = optarg; if (add_prop_list(zpool_prop_to_name( @@ -852,6 +882,20 @@ zpool_do_create(int argc, char **argv) goto errout; /* + * Get bootsize value for make_root_vdev(). + */ + if (zpool_name_to_prop(optarg) == ZPOOL_PROP_BOOTSIZE) { + if (zfs_nicestrtonum(g_zfs, propval, + &boot_size) < 0 || boot_size == 0) { + (void) fprintf(stderr, + gettext("bad boot partition size " + "'%s': %s\n"), propval, + libzfs_error_description(g_zfs)); + goto errout; + } + } + + /* * If the user is creating a pool that doesn't support * feature flags, don't enable any features. */ @@ -928,9 +972,43 @@ zpool_do_create(int argc, char **argv) goto errout; } + /* + * Make sure the bootsize is set when ZPOOL_CREATE_BOOT_LABEL is used, + * and not set otherwise. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + const char *propname; + char *strptr, *buf = NULL; + int rv; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) != 0) { + (void) asprintf(&buf, "%" PRIu64, boot_size); + if (buf == NULL) { + (void) fprintf(stderr, + gettext("internal error: out of memory\n")); + goto errout; + } + rv = add_prop_list(propname, buf, &props, B_TRUE); + free(buf); + if (rv != 0) + goto errout; + } + } else { + const char *propname; + char *strptr; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) == 0) { + (void) fprintf(stderr, gettext("error: setting boot " + "partition size requires option '-B'\n")); + goto errout; + } + } + /* pass off to get_vdev_spec for bulk processing */ nvroot = make_root_vdev(NULL, force, !force, B_FALSE, dryrun, - argc - 1, argv + 1); + boot_type, boot_size, argc - 1, argv + 1); if (nvroot == NULL) goto errout; @@ -3209,6 +3287,8 @@ zpool_do_attach_or_replace(int argc, char **argv, int nvlist_t *nvroot; char *poolname, *old_disk, *new_disk; zpool_handle_t *zhp; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; /* check options */ @@ -3273,8 +3353,14 @@ zpool_do_attach_or_replace(int argc, char **argv, int return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, B_FALSE, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Wed Feb 21 00:18:57 2018 (r329681) @@ -44,7 +44,8 @@ uint_t num_logs(nvlist_t *nv); */ nvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv); + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv); nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props, splitflags_t flags, int argc, char **argv); Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Wed Feb 21 00:18:57 2018 (r329681) @@ -935,14 +935,15 @@ check_replication(nvlist_t *config, nvlist_t *newroot) * Go through and find any whole disks in the vdev specification, labelling them * as appropriate. When constructing the vdev spec, we were unable to open this * device in order to provide a devid. Now that we have labelled the disk and - * know that slice 0 is valid, we can construct the devid now. + * know the pool slice is valid, we can construct the devid now. * * If the disk was already labeled with an EFI label, we will have gotten the * devid already (because we were able to open the whole disk). Otherwise, we * need to get the devid after we label the disk. */ static int -make_disks(zpool_handle_t *zhp, nvlist_t *nv) +make_disks(zpool_handle_t *zhp, nvlist_t *nv, zpool_boot_label_t boot_type, + uint64_t boot_size) { nvlist_t **child; uint_t c, children; @@ -951,6 +952,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) uint64_t wholedisk; int fd; int ret; + int slice; ddi_devid_t devid; char *minor = NULL, *devid_str = NULL; @@ -968,20 +970,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) * slice and stat()ing the device. */ verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, - &wholedisk) != 0 || !wholedisk) - return (0); diskname = strrchr(path, '/'); assert(diskname != NULL); diskname++; - if (zpool_label_disk(g_zfs, zhp, diskname) == -1) - return (-1); + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, + &wholedisk) != 0 || !wholedisk) { + /* + * This is not whole disk, return error if + * boot partition creation was requested + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + (void) fprintf(stderr, + gettext("creating boot partition is only " + "supported on whole disk vdevs: %s\n"), + diskname); + return (-1); + } + return (0); + } + + ret = zpool_label_disk(g_zfs, zhp, diskname, boot_type, + boot_size, &slice); + if (ret == -1) + return (ret); + /* * Fill in the devid, now that we've labeled the disk. */ - (void) snprintf(buf, sizeof (buf), "%ss0", path); + (void) snprintf(buf, sizeof (buf), "%ss%d", path, slice); if ((fd = open(buf, O_RDONLY)) < 0) { (void) fprintf(stderr, gettext("cannot open '%s': %s\n"), @@ -1004,7 +1022,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) } /* - * Update the path to refer to the 's0' slice. The presence of + * Update the path to refer to the pool slice. The presence of * the 'whole_disk' field indicates to the CLI that we should * chop off the slice number when displaying the device in * future output. @@ -1016,21 +1034,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) return (0); } - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + /* illumos kernel does not support booting from multi-vdev pools. */ + if ((boot_type == ZPOOL_CREATE_BOOT_LABEL)) { + if ((strcmp(type, VDEV_TYPE_ROOT) == 0) && children > 1) { + (void) fprintf(stderr, gettext("boot pool " + "can not have more than one vdev\n")); + return (-1); + } + } + + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } return (0); } @@ -1429,6 +1462,9 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, { nvlist_t *newroot = NULL, **child; uint_t c, children; +#ifdef illumos + zpool_boot_label_t boot_type; +#endif if (argc > 0) { if ((newroot = construct_spec(argc, argv)) == NULL) { @@ -1438,7 +1474,13 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, } #ifdef illumos - if (!flags.dryrun && make_disks(zhp, newroot) != 0) { + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + if (!flags.dryrun && + make_disks(zhp, newroot, boot_type, 0) != 0) { nvlist_free(newroot); return (NULL); } @@ -1483,7 +1525,8 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, */ nvlist_t * make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv) + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv) { nvlist_t *newroot; nvlist_t *poolconfig = NULL; @@ -1525,7 +1568,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int che /* * Run through the vdev specification and label any whole disks found. */ - if (!dryrun && make_disks(zhp, newroot) != 0) { + if (!dryrun && make_disks(zhp, newroot, boot_type, boot_size) != 0) { nvlist_free(newroot); return (NULL); } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Feb 21 00:18:57 2018 (r329681) @@ -135,6 +135,18 @@ typedef enum zfs_error { } zfs_error_t; /* + * UEFI boot support parameters. When creating whole disk boot pool, + * zpool create should allow to create EFI System partition for UEFI boot + * program. In case of BIOS, the EFI System partition is not used + * even if it does exist. + */ +typedef enum zpool_boot_label { + ZPOOL_NO_BOOT_LABEL = 0, + ZPOOL_CREATE_BOOT_LABEL, + ZPOOL_COPY_BOOT_LABEL +} zpool_boot_label_t; + +/* * The following data structures are all part * of the zfs_allow_t data structure which is * used for printing 'allow' permissions. @@ -266,7 +278,8 @@ extern nvlist_t *zpool_find_vdev(zpool_handle_t *, con boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *, + zpool_boot_label_t, uint64_t, int *); /* * Functions to manage pool properties @@ -349,6 +362,7 @@ extern nvlist_t *zpool_get_config(zpool_handle_t *, nv extern nvlist_t *zpool_get_features(zpool_handle_t *); extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **); +extern boolean_t zpool_is_bootable(zpool_handle_t *); /* * Import and export functions Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed Feb 21 00:18:57 2018 (r329681) @@ -49,7 +49,7 @@ #include "zfs_comutil.h" #include "zfeature_common.h" -static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *); static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -316,6 +316,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, (void) zfs_nicenum(intval, buf, len); } break; + case ZPOOL_PROP_BOOTSIZE: case ZPOOL_PROP_EXPANDSZ: if (intval == 0) { (void) strlcpy(buf, "-", len); @@ -517,6 +518,16 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char } break; + case ZPOOL_PROP_BOOTSIZE: + if (!flags.create) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s' can only be set during pool " + "creation"), propname); + (void) zfs_error(hdl, EZFS_BADPROP, errbuf); + goto error; + } + break; + case ZPOOL_PROP_BOOTFS: if (flags.create || flags.import) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -1990,8 +2001,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * Search for the requested value. Special cases: * - * - ZPOOL_CONFIG_PATH for whole disk entries. These end in - * "s0" or "s0/old". The "s0" part is hidden from the user, + * - ZPOOL_CONFIG_PATH for whole disk entries. To support + * UEFI boot, these end in "s0" or "s0/old" or "s1" or + * "s1/old". The "s0" or "s1" part is hidden from the user, * but included in the string, so this matches around it. * - looking for a top-level vdev name (i.e. ZPOOL_CONFIG_TYPE). * @@ -2022,14 +2034,16 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * strings identical except trailing "s0" */ - if (strcmp(&val[vlen - 2], "s0") == 0 && + if ((strcmp(&val[vlen - 2], "s0") == 0 || + strcmp(&val[vlen - 2], "s1") == 0) && strncmp(srchval, val, slen) == 0) return (nv); /* * strings identical except trailing "s0/old" */ - if (strcmp(&val[vlen - 6], "s0/old") == 0 && + if ((strcmp(&val[vlen - 6], "s0/old") == 0 || + strcmp(&val[vlen - 6], "s1/old") == 0) && strcmp(&srchval[slen - 4], "/old") == 0 && strncmp(srchval, val, slen - 4) == 0) return (nv); @@ -3460,15 +3474,17 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t * char *tmp = zfs_strdup(hdl, path); /* - * If it starts with c#, and ends with "s0", chop - * the "s0" off, or if it ends with "s0/old", remove - * the "s0" from the middle. + * If it starts with c#, and ends with "s0" or "s1", + * chop the slice off, or if it ends with "s0/old" or + * "s1/old", remove the slice from the middle. */ if (CTD_CHECK(tmp)) { - if (strcmp(&tmp[pathlen - 2], "s0") == 0) { + if (strcmp(&tmp[pathlen - 2], "s0") == 0 || + strcmp(&tmp[pathlen - 2], "s1") == 0) { tmp[pathlen - 2] = '\0'; } else if (pathlen > 6 && - strcmp(&tmp[pathlen - 6], "s0/old") == 0) { + (strcmp(&tmp[pathlen - 6], "s0/old") == 0 || + strcmp(&tmp[pathlen - 6], "s1/old") == 0)) { (void) strcpy(&tmp[pathlen - 6], "/old"); } @@ -3873,15 +3889,18 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, * Read the EFI label from the config, if a label does not exist then * pass back the error to the caller. If the caller has passed a non-NULL * diskaddr argument then we set it to the starting address of the EFI - * partition. + * partition. If the caller has passed a non-NULL boolean argument, then + * we set it to indicate if the disk does have efi system partition. */ static int -read_efi_label(nvlist_t *config, diskaddr_t *sb) +read_efi_label(nvlist_t *config, diskaddr_t *sb, boolean_t *system) { char *path; int fd; char diskname[MAXPATHLEN]; + boolean_t boot = B_FALSE; int err = -1; + int slice; if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0) return (err); @@ -3892,8 +3911,16 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb) struct dk_gpt *vtoc; if ((err = efi_alloc_and_read(fd, &vtoc)) >= 0) { - if (sb != NULL) - *sb = vtoc->efi_parts[0].p_start; + for (slice = 0; slice < vtoc->efi_nparts; slice++) { + if (vtoc->efi_parts[slice].p_tag == V_SYSTEM) + boot = B_TRUE; + if (vtoc->efi_parts[slice].p_tag == V_USR) + break; + } + if (sb != NULL && vtoc->efi_parts[slice].p_tag == V_USR) + *sb = vtoc->efi_parts[slice].p_start; + if (system != NULL) + *system = boot; efi_free(vtoc); } (void) close(fd); @@ -3920,7 +3947,7 @@ find_start_block(nvlist_t *config) &wholedisk) != 0 || !wholedisk) { return (MAXOFFSET_T); } - if (read_efi_label(config, &sb) < 0) + if (read_efi_label(config, &sb, NULL) < 0) sb = MAXOFFSET_T; return (sb); } @@ -3940,7 +3967,8 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name, + zpool_boot_label_t boot_type, uint64_t boot_size, int *slice) { #ifdef illumos char path[MAXPATHLEN]; @@ -3999,15 +4027,6 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t return (zfs_error(hdl, EZFS_NOCAP, errbuf)); } - slice_size = vtoc->efi_last_u_lba + 1; - slice_size -= EFI_MIN_RESV_SIZE; - if (start_block == MAXOFFSET_T) - start_block = NEW_START_BLOCK; - slice_size -= start_block; - - vtoc->efi_parts[0].p_start = start_block; - vtoc->efi_parts[0].p_size = slice_size; - /* * Why we use V_USR: V_BACKUP confuses users, and is considered * disposable by some EFI utilities (since EFI doesn't have a backup @@ -4016,12 +4035,103 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t * etc. were all pretty specific. V_USR is as close to reality as we * can get, in the absence of V_OTHER. */ - vtoc->efi_parts[0].p_tag = V_USR; - (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + /* first fix the partition start block */ + if (start_block == MAXOFFSET_T) + start_block = NEW_START_BLOCK; - vtoc->efi_parts[8].p_start = slice_size + start_block; - vtoc->efi_parts[8].p_size = resv; - vtoc->efi_parts[8].p_tag = V_RESERVED; + /* + * EFI System partition is using slice 0. + * ZFS is on slice 1 and slice 8 is reserved. + * We assume the GPT partition table without system + * partition has zfs p_start == NEW_START_BLOCK. + * If start_block != NEW_START_BLOCK, it means we have + * system partition. Correct solution would be to query/cache vtoc + * from existing vdev member. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + if (boot_size % vtoc->efi_lbasize != 0) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "boot partition size must be a multiple of %d"), + vtoc->efi_lbasize); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* + * System partition size checks. + * Note the 1MB is quite arbitrary value, since we + * are creating dedicated pool, it should be enough + * to hold fat + efi bootloader. May need to be + * adjusted if the bootloader size will grow. + */ + if (boot_size < 1024 * 1024) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "Specified size %s for EFI System partition is too " + "small, the minimum size is 1MB."), buf); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* 33MB is tested with mkfs -F pcfs */ + if (hdl->libzfs_printerr && + ((vtoc->efi_lbasize == 512 && + boot_size < 33 * 1024 * 1024) || + (vtoc->efi_lbasize == 4096 && + boot_size < 256 * 1024 * 1024))) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "Warning: EFI System partition size %s is " + "not allowing to create FAT32 file\nsystem, which " + "may result in unbootable system.\n"), buf); + } + /* Adjust zfs partition start by size of system partition. */ + start_block += boot_size / vtoc->efi_lbasize; + } + + if (start_block == NEW_START_BLOCK) { + /* + * Use default layout. + * ZFS is on slice 0 and slice 8 is reserved. + */ + slice_size = vtoc->efi_last_u_lba + 1; + slice_size -= EFI_MIN_RESV_SIZE; + slice_size -= start_block; + if (slice != NULL) + *slice = 0; + + vtoc->efi_parts[0].p_start = start_block; + vtoc->efi_parts[0].p_size = slice_size; + + vtoc->efi_parts[0].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } else { + slice_size = start_block - NEW_START_BLOCK; + vtoc->efi_parts[0].p_start = NEW_START_BLOCK; + vtoc->efi_parts[0].p_size = slice_size; + vtoc->efi_parts[0].p_tag = V_SYSTEM; + (void) strcpy(vtoc->efi_parts[0].p_name, "loader"); + if (slice != NULL) + *slice = 1; + /* prepare slice 1 */ + slice_size = vtoc->efi_last_u_lba + 1 - slice_size; + slice_size -= resv; + slice_size -= NEW_START_BLOCK; + vtoc->efi_parts[1].p_start = start_block; + vtoc->efi_parts[1].p_size = slice_size; + vtoc->efi_parts[1].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[1].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } if (efi_write(fd, vtoc) != 0) { /* Modified: head/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.cc Tue Feb 20 22:47:49 2018 (r329680) +++ head/cddl/usr.sbin/zfsd/case_file.cc Wed Feb 21 00:18:57 2018 (r329681) @@ -239,6 +239,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri { ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID); zpool_handle_t *pool(zpl.empty() ? NULL : zpl.front()); + zpool_boot_label_t boot_type; + uint64_t boot_size; if (pool == NULL || !RefreshVdevState()) { /* @@ -331,7 +333,13 @@ CaseFile::ReEvaluate(const string &devPath, const stri } /* Write a label on the newly inserted disk. */ - if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) { + if (zpool_is_bootable(pool)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + boot_size = zpool_get_prop_int(pool, ZPOOL_PROP_BOOTSIZE, NULL); + if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str(), + boot_type, boot_size, NULL) != 0) { syslog(LOG_ERR, "Replace vdev(%s/%s) by physical path (label): %s: %s\n", zpool_get_name(pool), VdevGUIDString().c_str(), Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Wed Feb 21 00:18:57 2018 (r329681) @@ -100,6 +100,10 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "<1.00x or higher if deduped>", "DEDUP"); + /* system partition size */ + zprop_register_number(ZPOOL_PROP_BOOTSIZE, "bootsize", 0, PROP_ONETIME, + ZFS_TYPE_POOL, "", "BOOTSIZE"); + /* default number properties */ zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION, PROP_DEFAULT, ZFS_TYPE_POOL, "", "VERSION"); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Feb 21 00:18:57 2018 (r329681) @@ -481,6 +481,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc) spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); for (int c = 0; c < rvd->vdev_children; c++) { + uint64_t tspace; vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -493,9 +494,13 @@ metaslab_class_expandable_space(metaslab_class_t *mc) * Calculate if we have enough space to add additional * metaslabs. We report the expandable space in terms * of the metaslab size since that's the unit of expansion. + * Adjust by efi system partition size. */ - space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + tspace = tvd->vdev_max_asize - tvd->vdev_asize; + if (tspace > mc->mc_spa->spa_bootsize) { + tspace -= mc->mc_spa->spa_bootsize; + } + space += P2ALIGN(tspace, 1ULL << tvd->vdev_ms_shift); } spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); return (space); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 00:18:57 2018 (r329681) @@ -2813,6 +2813,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize); spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, &spa->spa_dedup_ditto); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Wed Feb 21 00:18:57 2018 (r329681) @@ -242,6 +242,7 @@ struct spa { int spa_mode; /* FREAD | FWRITE */ spa_log_state_t spa_log_state; /* log state */ uint64_t spa_autoexpand; /* lun expansion on/off */ + uint64_t spa_bootsize; /* efi system partition size */ ddt_t *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; /* in-core DDTs */ uint64_t spa_ddt_stat_object; /* DDT statistics */ uint64_t spa_dedup_ditto; /* dedup ditto threshold */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Feb 21 00:18:57 2018 (r329681) @@ -2923,8 +2923,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) * since that determines how much space the pool can expand. */ if (vd->vdev_aux == NULL && tvd != NULL && vd->vdev_max_asize != 0) { - vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize - + spa->spa_bootsize, 1ULL << tvd->vdev_ms_shift); } vs->vs_configured_ashift = vd->vdev_top != NULL ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Tue Feb 20 22:47:49 2018 (r329680) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Feb 21 00:18:57 2018 (r329681) @@ -211,6 +211,7 @@ typedef enum { ZPOOL_PROP_FRAGMENTATION, ZPOOL_PROP_LEAKED, ZPOOL_PROP_MAXBLOCKSIZE, + ZPOOL_PROP_BOOTSIZE, ZPOOL_NUM_PROPS } zpool_prop_t; From owner-svn-src-all@freebsd.org Wed Feb 21 00:19:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 539CDF14B8D; Wed, 21 Feb 2018 00:19:05 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1554792CD; Wed, 21 Feb 2018 00:19:03 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF47610F81; Wed, 21 Feb 2018 00:19:02 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L0J2CM070157; Wed, 21 Feb 2018 00:19:02 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L0J2Jg070156; Wed, 21 Feb 2018 00:19:02 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802210019.w1L0J2Jg070156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Wed, 21 Feb 2018 00:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329682 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 329682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 00:19:05 -0000 Author: rpokala Date: Wed Feb 21 00:19:02 2018 New Revision: 329682 URL: https://svnweb.freebsd.org/changeset/base/329682 Log: mountd: Return proper errno values in a few error paths When attempting to mount a non-directory which exists, return ENOTDIR instead of ENOENT. If stat() or statfs() failed, don't pass part of the invalid (struct statfs) to ex_search(). In that same case, preserve the value of "bad" rather than overwriting with EACCES. Submitted by: Bruce Leverett (Panasas) Reviewed by: rmacklem MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D14438 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Wed Feb 21 00:18:57 2018 (r329681) +++ head/usr.sbin/mountd/mountd.c Wed Feb 21 00:19:02 2018 (r329682) @@ -1053,8 +1053,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) */ if (realpath(rpcpath, dirpath) == NULL || stat(dirpath, &stb) < 0 || - (!S_ISDIR(stb.st_mode) && - (dir_only || !S_ISREG(stb.st_mode))) || statfs(dirpath, &fsb) < 0) { chdir("/"); /* Just in case realpath doesn't */ syslog(LOG_NOTICE, @@ -1064,10 +1062,23 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) warnx("stat failed on %s", dirpath); bad = ENOENT; /* We will send error reply later */ } + if (!bad && + !S_ISDIR(stb.st_mode) && + (dir_only || !S_ISREG(stb.st_mode))) { + syslog(LOG_NOTICE, + "mount request from %s for non-directory path %s", + numerichost, dirpath); + if (debug) + warnx("mounting non-directory %s", dirpath); + bad = ENOTDIR; /* We will send error reply later */ + } /* Check in the exports list */ sigprocmask(SIG_BLOCK, &sighup_mask, NULL); - ep = ex_search(&fsb.f_fsid); + if (bad) + ep = NULL; + else + ep = ex_search(&fsb.f_fsid); hostset = defset = 0; if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset, &numsecflavors, &secflavorsp) || @@ -1118,7 +1129,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) "mount request succeeded from %s for %s", numerichost, dirpath); } else { - bad = EACCES; + if (!bad) + bad = EACCES; syslog(LOG_NOTICE, "mount request denied from %s for %s", numerichost, dirpath); From owner-svn-src-all@freebsd.org Wed Feb 21 00:24:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD1AFF15587; Wed, 21 Feb 2018 00:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E43079A38; Wed, 21 Feb 2018 00:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8929B1113C; Wed, 21 Feb 2018 00:24:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L0OstS075131; Wed, 21 Feb 2018 00:24:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L0OsO3075130; Wed, 21 Feb 2018 00:24:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802210024.w1L0OsO3075130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 00:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329683 - head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Commit-Revision: 329683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 00:24:55 -0000 Author: mav Date: Wed Feb 21 00:24:54 2018 New Revision: 329683 URL: https://svnweb.freebsd.org/changeset/base/329683 Log: MFV r319736: 6396 remove SVM illumos/illumos-gate@5f10ef697f250374b7b917e10961c4e02d4e3112 https://github.com/illumos/illumos-gate/commit/5f10ef697f250374b7b917e10961c4e02d4e3112 https://www.illumos.org/issues/6396 LVM = SVM = Solaris Volume Manager dead code and not using with ZFS based platform. Reviewed by: Igor Kozhukhov Reviewed by: Toomas Soome Approved by: Hans Rosenfeld Author: Yuri Pankov Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Wed Feb 21 00:19:02 2018 (r329682) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Wed Feb 21 00:24:54 2018 (r329683) @@ -18,9 +18,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -59,67 +60,6 @@ extern "C" { * by Sun Cluster software. */ #define EC_CLUSTER "EC_Cluster" - -/* - * The following classes are exclusively reserved for use by the - * Solaris Volume Manager (SVM) - */ -#define EC_SVM_CONFIG "EC_SVM_Config" -#define EC_SVM_STATE "EC_SVM_State" - -/* - * EC_SVM_CONFIG subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_CREATE "ESC_SVM_Create" -#define ESC_SVM_DELETE "ESC_SVM_Delete" -#define ESC_SVM_ADD "ESC_SVM_Add" -#define ESC_SVM_REMOVE "ESC_SVM_Remove" -#define ESC_SVM_REPLACE "ESC_SVM_Replace" -#define ESC_SVM_GROW "ESC_SVM_Grow" -#define ESC_SVM_RENAME_SRC "ESC_SVM_Rename_Src" -#define ESC_SVM_RENAME_DST "ESC_SVM_Rename_Dst" -#define ESC_SVM_MEDIATOR_ADD "ESC_SVM_Mediator_Add" -#define ESC_SVM_MEDIATOR_DELETE "ESC_SVM_Mediator_Delete" -#define ESC_SVM_HOST_ADD "ESC_SVM_Host_Add" -#define ESC_SVM_HOST_DELETE "ESC_SVM_Host_Delete" -#define ESC_SVM_DRIVE_ADD "ESC_SVM_Drive_Add" -#define ESC_SVM_DRIVE_DELETE "ESC_SVM_Drive_Delete" -#define ESC_SVM_DETACH "ESC_SVM_Detach" -#define ESC_SVM_DETACHING "ESC_SVM_Detaching" -#define ESC_SVM_ATTACH "ESC_SVM_Attach" -#define ESC_SVM_ATTACHING "ESC_SVM_Attaching" - -/* - * EC_SVM_STATE subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_INIT_START "ESC_SVM_Init_Start" -#define ESC_SVM_INIT_FAILED "ESC_SVM_Init_Failed" -#define ESC_SVM_INIT_FATAL "ESC_SVM_Init_Fatal" -#define ESC_SVM_INIT_SUCCESS "ESC_SVM_Init_Success" -#define ESC_SVM_IOERR "ESC_SVM_Ioerr" -#define ESC_SVM_ERRED "ESC_SVM_Erred" -#define ESC_SVM_LASTERRED "ESC_SVM_Lasterred" -#define ESC_SVM_OK "ESC_SVM_Ok" -#define ESC_SVM_ENABLE "ESC_SVM_Enable" -#define ESC_SVM_RESYNC_START "ESC_SVM_Resync_Start" -#define ESC_SVM_RESYNC_FAILED "ESC_SVM_Resync_Failed" -#define ESC_SVM_RESYNC_SUCCESS "ESC_SVM_Resync_Success" -#define ESC_SVM_RESYNC_DONE "ESC_SVM_Resync_Done" -#define ESC_SVM_HOTSPARED "ESC_SVM_Hotspared" -#define ESC_SVM_HS_FREED "ESC_SVM_HS_Freed" -#define ESC_SVM_HS_CHANGED "ESC_SVM_HS_Changed" -#define ESC_SVM_TAKEOVER "ESC_SVM_Takeover" -#define ESC_SVM_RELEASE "ESC_SVM_Release" -#define ESC_SVM_OPEN_FAIL "ESC_SVM_Open_Fail" -#define ESC_SVM_OFFLINE "ESC_SVM_Offline" -#define ESC_SVM_ONLINE "ESC_SVM_Online" -#define ESC_SVM_CHANGE "ESC_SVM_Change" -#define ESC_SVM_EXCHANGE "ESC_SVM_Exchange" -#define ESC_SVM_REGEN_START "ESC_SVM_Regen_Start" -#define ESC_SVM_REGEN_DONE "ESC_SVM_Regen_Done" -#define ESC_SVM_REGEN_FAILED "ESC_SVM_Regen_Failed" /* * EC_DR subclass definitions - supporting attributes (name/value pairs) From owner-svn-src-all@freebsd.org Wed Feb 21 01:10:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D3C3F19ACB; Wed, 21 Feb 2018 01:10:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3ED017B553; Wed, 21 Feb 2018 01:10:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39905117F1; Wed, 21 Feb 2018 01:10:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1A44R095128; Wed, 21 Feb 2018 01:10:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1A4sB095124; Wed, 21 Feb 2018 01:10:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210110.w1L1A4sB095124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329684 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:10:04 -0000 Author: kevans Date: Wed Feb 21 01:10:03 2018 New Revision: 329684 URL: https://svnweb.freebsd.org/changeset/base/329684 Log: lualoader: Drop terminating semicolons This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it. Excessive parenthesizing around conditionals is next on the chopping block. Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/loader.lua head/stand/lua/menu.lua head/stand/lua/password.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Wed Feb 21 00:24:54 2018 (r329683) +++ head/stand/lua/color.lua Wed Feb 21 01:10:03 2018 (r329684) @@ -26,74 +26,74 @@ -- $FreeBSD$ -- -local core = require("core"); +local core = require("core") -local color = {}; +local color = {} -- Module exports -color.BLACK = 0; -color.RED = 1; -color.GREEN = 2; -color.YELLOW = 3; -color.BLUE = 4; -color.MAGENTA = 5; -color.CYAN = 6; -color.WHITE = 7; +color.BLACK = 0 +color.RED = 1 +color.GREEN = 2 +color.YELLOW = 3 +color.BLUE = 4 +color.MAGENTA = 5 +color.CYAN = 6 +color.WHITE = 7 -color.DEFAULT = 0; -color.BRIGHT = 1; -color.DIM = 2; +color.DEFAULT = 0 +color.BRIGHT = 1 +color.DIM = 2 function color.isEnabled() - local c = loader.getenv("loader_color"); + local c = loader.getenv("loader_color") if (c ~= nil) then if (c:lower() == "no") or (c == "0") then - return false; + return false end end - return (not core.isSerialBoot()); + return (not core.isSerialBoot()) end -color.disabled = (not color.isEnabled()); +color.disabled = (not color.isEnabled()) function color.escapef(c) if (color.disabled) then - return c; + return c end - return "\027[3" .. c .. "m"; + return "\027[3" .. c .. "m" end function color.escapeb(c) if (color.disabled) then - return c; + return c end - return "\027[4" .. c .. "m"; + return "\027[4" .. c .. "m" end function color.escape(fg, bg, att) if (color.disabled) then - return ""; + return "" end if (not att) then att = "" else - att = att .. ";"; + att = att .. ";" end - return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m"; + return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m" end function color.default() if (color.disabled) then - return ""; + return "" end - return "\027[0;37;40m"; + return "\027[0;37;40m" end function color.highlight(str) if (color.disabled) then - return str; + return str end - return "\027[1m" .. str .. "\027[0m"; + return "\027[1m" .. str .. "\027[0m" end -return color; +return color Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Feb 21 00:24:54 2018 (r329683) +++ head/stand/lua/config.lua Wed Feb 21 01:10:03 2018 (r329684) @@ -27,12 +27,12 @@ -- $FreeBSD$ -- -local config = {}; +local config = {} -local modules = {}; +local modules = {} -local pattern_table; -local carousel_choices = {}; +local pattern_table +local carousel_choices = {} pattern_table = { [1] = { @@ -44,51 +44,51 @@ pattern_table = { str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) if (modules[k] == nil) then - modules[k] = {}; + modules[k] = {} end - modules[k].load = v:upper(); + modules[k].load = v:upper() end }, -- module_name="value" [3] = { str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "name", v); + config.setKey(k, "name", v) end }, -- module_type="value" [4] = { str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "type", v); + config.setKey(k, "type", v) end }, -- module_flags="value" [5] = { str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "flags", v); + config.setKey(k, "flags", v) end }, -- module_before="value" [6] = { str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "before", v); + config.setKey(k, "before", v) end }, -- module_after="value" [7] = { str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "after", v); + config.setKey(k, "after", v) end }, -- module_error="value" [8] = { str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - config.setKey(k, "error", v); + config.setKey(k, "error", v) end }, -- exec="command" @@ -96,7 +96,7 @@ pattern_table = { str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) if (loader.perform(k) ~= 0) then - print("Failed to exec '" .. k .. "'"); + print("Failed to exec '" .. k .. "'") end end }, @@ -106,7 +106,7 @@ pattern_table = { process = function(k, v) if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. - "' with value: " .. v .. ""); + "' with value: " .. v .. "") end end }, @@ -116,113 +116,113 @@ pattern_table = { process = function(k, v) if (config.setenv(k, v) ~= 0) then print("Failed to set '" .. k .. - "' with value: " .. v .. ""); + "' with value: " .. v .. "") end end } -}; +} -- Module exports -- Which variables we changed -config.env_changed = {}; +config.env_changed = {} -- Values to restore env to (nil to unset) -config.env_restore = {}; +config.env_restore = {} -- The first item in every carousel is always the default item. function config.getCarouselIndex(id) - local val = carousel_choices[id]; + local val = carousel_choices[id] if (val == nil) then - return 1; + return 1 end - return val; + return val end function config.setCarouselIndex(id, idx) - carousel_choices[id] = idx; + carousel_choices[id] = idx end function config.restoreEnv() -- Examine changed environment variables for k, v in pairs(config.env_changed) do - local restore_value = config.env_restore[k]; + local restore_value = config.env_restore[k] if (restore_value == nil) then -- This one doesn't need restored for some reason - goto continue; + goto continue end - local current_value = loader.getenv(k); + local current_value = loader.getenv(k) if (current_value ~= v) then -- This was overwritten by some action taken on the menu -- most likely; we'll leave it be. - goto continue; + goto continue end - restore_value = restore_value.value; + restore_value = restore_value.value if (restore_value ~= nil) then - loader.setenv(k, restore_value); + loader.setenv(k, restore_value) else - loader.unsetenv(k); + loader.unsetenv(k) end ::continue:: end - config.env_changed = {}; - config.env_restore = {}; + config.env_changed = {} + config.env_restore = {} end function config.setenv(k, v) -- Track the original value for this if we haven't already if (config.env_restore[k] == nil) then - config.env_restore[k] = {value = loader.getenv(k)}; + config.env_restore[k] = {value = loader.getenv(k)} end - config.env_changed[k] = v; + config.env_changed[k] = v - return loader.setenv(k, v); + return loader.setenv(k, v) end function config.setKey(k, n, v) if (modules[k] == nil) then - modules[k] = {}; + modules[k] = {} end - modules[k][n] = v; + modules[k][n] = v end function config.lsModules() - print("== Listing modules"); + print("== Listing modules") for k, v in pairs(modules) do - print(k, v.load); + print(k, v.load) end - print("== List of modules ended"); + print("== List of modules ended") end function config.isValidComment(c) if (c ~= nil) then - local s = c:match("^%s*#.*"); + local s = c:match("^%s*#.*") if (s == nil) then - s = c:match("^%s*$"); + s = c:match("^%s*$") end if (s == nil) then - return false; + return false end end - return true; + return true end function config.loadmod(mod, silent) - local status = true; + local status = true for k, v in pairs(mod) do if (v.load == "YES") then - local str = "load "; + local str = "load " if (v.flags ~= nil) then - str = str .. v.flags .. " "; + str = str .. v.flags .. " " end if (v.type ~= nil) then - str = str .. "-t " .. v.type .. " "; + str = str .. "-t " .. v.type .. " " end if (v.name ~= nil) then - str = str .. v.name; + str = str .. v.name else - str = str .. k; + str = str .. k end if (v.before ~= nil) then @@ -231,21 +231,21 @@ function config.loadmod(mod, silent) print("Failed to execute '" .. v.before .. "' before loading '" .. k .. - "'"); + "'") end - status = false; + status = false end end if (loader.perform(str) ~= 0) then if (not silent) then print("Failed to execute '" .. str .. - "'"); + "'") end if (v.error ~= nil) then - loader.perform(v.error); + loader.perform(v.error) end - status = false; + status = false end if (v.after ~= nil) then @@ -254,211 +254,211 @@ function config.loadmod(mod, silent) print("Failed to execute '" .. v.after .. "' after loading '" .. k .. - "'"); + "'") end - status = false; + status = false end end else -- if not silent then - -- print("Skiping module '". . k .. "'"); + -- print("Skiping module '". . k .. "'") -- end end end - return status; + return status end function config.parse(name, silent) - local f = io.open(name); + local f = io.open(name) if (f == nil) then if (not silent) then - print("Failed to open config: '" .. name .. "'"); + print("Failed to open config: '" .. name .. "'") end - return false; + return false end - local text; - local r; + local text + local r - text, r = io.read(f); + text, r = io.read(f) if (text == nil) then if (not silent) then - print("Failed to read config: '" .. name .. "'"); + print("Failed to read config: '" .. name .. "'") end - return false; + return false end - local n = 1; - local status = true; + local n = 1 + local status = true for line in text:gmatch("([^\n]+)") do if (line:match("^%s*$") == nil) then - local found = false; + local found = false for i, val in ipairs(pattern_table) do - local k, v, c = line:match(val.str); + local k, v, c = line:match(val.str) if (k ~= nil) then - found = true; + found = true if (config.isValidComment(c)) then - val.process(k, v); + val.process(k, v) else print("Malformed line (" .. n .. - "):\n\t'" .. line .. "'"); - status = false; + "):\n\t'" .. line .. "'") + status = false end - break; + break end end if (found == false) then print("Malformed line (" .. n .. "):\n\t'" .. - line .. "'"); - status = false; + line .. "'") + status = false end end - n = n + 1; + n = n + 1 end - return status; + return status end -- other_kernel is optionally the name of a kernel to load, if not the default -- or autoloaded default from the module_path function config.loadkernel(other_kernel) - local flags = loader.getenv("kernel_options") or ""; - local kernel = other_kernel or loader.getenv("kernel"); + local flags = loader.getenv("kernel_options") or "" + local kernel = other_kernel or loader.getenv("kernel") local try_load = function (names) for name in names:gmatch("([^;]+)%s*;?") do - r = loader.perform("load " .. flags .. " " .. name); + r = loader.perform("load " .. flags .. " " .. name) if (r == 0) then - return name; + return name end end - return nil; + return nil end local load_bootfile = function() - local bootfile = loader.getenv("bootfile"); + local bootfile = loader.getenv("bootfile") -- append default kernel name if (bootfile == nil) then - bootfile = "kernel"; + bootfile = "kernel" else - bootfile = bootfile .. ";kernel"; + bootfile = bootfile .. ";kernel" end - return try_load(bootfile); + return try_load(bootfile) end -- kernel not set, try load from default module_path if (kernel == nil) then - local res = load_bootfile(); + local res = load_bootfile() if (res ~= nil) then -- Default kernel is loaded - config.kernel_loaded = nil; - return true; + config.kernel_loaded = nil + return true else - print("No kernel set, failed to load from module_path"); - return false; + print("No kernel set, failed to load from module_path") + return false end else -- Use our cached module_path, so we don't end up with multiple -- automatically added kernel paths to our final module_path - local module_path = config.module_path; - local res = nil; + local module_path = config.module_path + local res = nil if (other_kernel ~= nil) then - kernel = other_kernel; + kernel = other_kernel end -- first try load kernel with module_path = /boot/${kernel} -- then try load with module_path=${kernel} - local paths = {"/boot/" .. kernel, kernel}; + local paths = {"/boot/" .. kernel, kernel} for k,v in pairs(paths) do - loader.setenv("module_path", v); - res = load_bootfile(); + loader.setenv("module_path", v) + res = load_bootfile() -- succeeded, add path to module_path if (res ~= nil) then - config.kernel_loaded = kernel; + config.kernel_loaded = kernel if (module_path ~= nil) then loader.setenv("module_path", v .. ";" .. - module_path); + module_path) end - return true; + return true end end -- failed to load with ${kernel} as a directory -- try as a file - res = try_load(kernel); + res = try_load(kernel) if (res ~= nil) then - config.kernel_loaded = kernel; - return true; + config.kernel_loaded = kernel + return true else - print("Failed to load kernel '" .. kernel .. "'"); - return false; + print("Failed to load kernel '" .. kernel .. "'") + return false end end end function config.selectkernel(kernel) - config.kernel_selected = kernel; + config.kernel_selected = kernel end function config.load(file) if (not file) then - file = "/boot/defaults/loader.conf"; + file = "/boot/defaults/loader.conf" end if (not config.parse(file)) then --- print("Failed to parse configuration: '" .. file .. "'"); +-- print("Failed to parse configuration: '" .. file .. "'") end - local f = loader.getenv("loader_conf_files"); + local f = loader.getenv("loader_conf_files") if (f ~= nil) then for name in f:gmatch("([%w%p]+)%s*") do if (not config.parse(name)) then -- print("Failed to parse configuration: '" .. --- name .. "'"); +-- name .. "'") end end end -- Cache the provided module_path at load time for later use - config.module_path = loader.getenv("module_path"); + config.module_path = loader.getenv("module_path") end -- Reload configuration function config.reload(file) - modules = {}; - config.restoreEnv(); - config.load(file); + modules = {} + config.restoreEnv() + config.load(file) end function config.loadelf() - local kernel = config.kernel_selected or config.kernel_loaded; - local loaded = false; + local kernel = config.kernel_selected or config.kernel_loaded + local loaded = false - print("Loading kernel..."); - loaded = config.loadkernel(kernel); + print("Loading kernel...") + loaded = config.loadkernel(kernel) if (not loaded) then - print("Failed to load any kernel"); - return; + print("Failed to load any kernel") + return end - print("Loading configured modules..."); + print("Loading configured modules...") if (not config.loadmod(modules)) then - print("Could not load one or more modules!"); + print("Could not load one or more modules!") end end -return config; +return config Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 00:24:54 2018 (r329683) +++ head/stand/lua/core.lua Wed Feb 21 01:10:03 2018 (r329684) @@ -26,15 +26,15 @@ -- $FreeBSD$ -- -local config = require('config'); +local config = require('config') -local core = {}; +local core = {} local compose_loader_cmd = function(cmd_name, argstr) if (argstr ~= nil) then - cmd_name = cmd_name .. " " .. argstr; + cmd_name = cmd_name .. " " .. argstr end - return cmd_name; + return cmd_name end -- Internal function @@ -44,162 +44,162 @@ end -- will need to be explicitly overwritten to false local parse_boot_args = function(argv, with_kernel) if (#argv == 0) then - return nil, ""; + return nil, "" end if (with_kernel == nil) then - with_kernel = true; + with_kernel = true end - local kernel_name; - local argstr = ""; + local kernel_name + local argstr = "" for k, v in ipairs(argv) do if (with_kernel) and (v:sub(1,1) ~= "-") then - kernel_name = v; + kernel_name = v else - argstr = argstr .. " " .. v; + argstr = argstr .. " " .. v end end if (with_kernel) then - return kernel_name, argstr; + return kernel_name, argstr else - return argstr; + return argstr end end -- Globals function boot(...) - local argv = {...}; - local cmd_name = ""; - cmd_name, argv = core.popFrontTable(argv); - local kernel, argstr = parse_boot_args(argv); + local argv = {...} + local cmd_name = "" + cmd_name, argv = core.popFrontTable(argv) + local kernel, argstr = parse_boot_args(argv) if (kernel ~= nil) then - loader.perform("unload"); - config.selectkernel(kernel); + loader.perform("unload") + config.selectkernel(kernel) end - core.boot(argstr); + core.boot(argstr) end function autoboot(...) local argv = {...} - local cmd_name = ""; - cmd_name, argv = core.popFrontTable(argv); - local argstr = parse_boot_args(argv, false); - core.autoboot(argstr); + local cmd_name = "" + cmd_name, argv = core.popFrontTable(argv) + local argstr = parse_boot_args(argv, false) + core.autoboot(argstr) end -- Module exports -- Commonly appearing constants -core.KEY_BACKSPACE = 8; -core.KEY_ENTER = 13; -core.KEY_DELETE = 127; +core.KEY_BACKSPACE = 8 +core.KEY_ENTER = 13 +core.KEY_DELETE = 127 -core.KEYSTR_ESCAPE = "\027"; +core.KEYSTR_ESCAPE = "\027" -core.MENU_RETURN = "return"; -core.MENU_ENTRY = "entry"; -core.MENU_SEPARATOR = "separator"; -core.MENU_SUBMENU = "submenu"; -core.MENU_CAROUSEL_ENTRY = "carousel_entry"; +core.MENU_RETURN = "return" +core.MENU_ENTRY = "entry" +core.MENU_SEPARATOR = "separator" +core.MENU_SUBMENU = "submenu" +core.MENU_CAROUSEL_ENTRY = "carousel_entry" function core.setVerbose(b) if (b == nil) then - b = not core.verbose; + b = not core.verbose end if (b == true) then - loader.setenv("boot_verbose", "YES"); + loader.setenv("boot_verbose", "YES") else - loader.unsetenv("boot_verbose"); + loader.unsetenv("boot_verbose") end - core.verbose = b; + core.verbose = b end function core.setSingleUser(b) if (b == nil) then - b = not core.su; + b = not core.su end if (b == true) then - loader.setenv("boot_single", "YES"); + loader.setenv("boot_single", "YES") else - loader.unsetenv("boot_single"); + loader.unsetenv("boot_single") end - core.su = b; + core.su = b end function core.getACPIPresent(checkingSystemDefaults) - local c = loader.getenv("hint.acpi.0.rsdp"); + local c = loader.getenv("hint.acpi.0.rsdp") if (c ~= nil) then if (checkingSystemDefaults == true) then - return true; + return true end -- Otherwise, respect disabled if it's set - c = loader.getenv("hint.acpi.0.disabled"); - return (c == nil) or (tonumber(c) ~= 1); + c = loader.getenv("hint.acpi.0.disabled") + return (c == nil) or (tonumber(c) ~= 1) end - return false; + return false end function core.setACPI(b) if (b == nil) then - b = not core.acpi; + b = not core.acpi end if (b == true) then - loader.setenv("acpi_load", "YES"); - loader.setenv("hint.acpi.0.disabled", "0"); - loader.unsetenv("loader.acpi_disabled_by_user"); + loader.setenv("acpi_load", "YES") + loader.setenv("hint.acpi.0.disabled", "0") + loader.unsetenv("loader.acpi_disabled_by_user") else - loader.unsetenv("acpi_load"); - loader.setenv("hint.acpi.0.disabled", "1"); - loader.setenv("loader.acpi_disabled_by_user", "1"); + loader.unsetenv("acpi_load") + loader.setenv("hint.acpi.0.disabled", "1") + loader.setenv("loader.acpi_disabled_by_user", "1") end - core.acpi = b; + core.acpi = b end function core.setSafeMode(b) if (b == nil) then - b = not core.sm; + b = not core.sm end if (b == true) then - loader.setenv("kern.smp.disabled", "1"); - loader.setenv("hw.ata.ata_dma", "0"); - loader.setenv("hw.ata.atapi_dma", "0"); - loader.setenv("hw.ata.wc", "0"); - loader.setenv("hw.eisa_slots", "0"); - loader.setenv("kern.eventtimer.periodic", "1"); - loader.setenv("kern.geom.part.check_integrity", "0"); + loader.setenv("kern.smp.disabled", "1") + loader.setenv("hw.ata.ata_dma", "0") + loader.setenv("hw.ata.atapi_dma", "0") + loader.setenv("hw.ata.wc", "0") + loader.setenv("hw.eisa_slots", "0") + loader.setenv("kern.eventtimer.periodic", "1") + loader.setenv("kern.geom.part.check_integrity", "0") else - loader.unsetenv("kern.smp.disabled"); - loader.unsetenv("hw.ata.ata_dma"); - loader.unsetenv("hw.ata.atapi_dma"); - loader.unsetenv("hw.ata.wc"); - loader.unsetenv("hw.eisa_slots"); - loader.unsetenv("kern.eventtimer.periodic"); - loader.unsetenv("kern.geom.part.check_integrity"); + loader.unsetenv("kern.smp.disabled") + loader.unsetenv("hw.ata.ata_dma") + loader.unsetenv("hw.ata.atapi_dma") + loader.unsetenv("hw.ata.wc") + loader.unsetenv("hw.eisa_slots") + loader.unsetenv("kern.eventtimer.periodic") + loader.unsetenv("kern.geom.part.check_integrity") end - core.sm = b; + core.sm = b end function core.kernelList() - local k = loader.getenv("kernel"); - local v = loader.getenv("kernels") or ""; + local k = loader.getenv("kernel") + local v = loader.getenv("kernels") or "" - local kernels = {}; - local unique = {}; - local i = 0; + local kernels = {} + local unique = {} + local i = 0 if (k ~= nil) then - i = i + 1; - kernels[i] = k; - unique[k] = true; + i = i + 1 + kernels[i] = k + unique[k] = true end for n in v:gmatch("([^; ]+)[; ]?") do if (unique[n] == nil) then - i = i + 1; - kernels[i] = n; - unique[n] = true; + i = i + 1 + kernels[i] = n + unique[n] = true end end @@ -207,89 +207,89 @@ function core.kernelList() -- heuristic. Any directory in /boot that contains an ordinary file -- named "kernel" is considered eligible. for file in lfs.dir("/boot") do - local fname = "/boot/" .. file; + local fname = "/boot/" .. file if (file == "." or file == "..") then - goto continue; + goto continue end if (lfs.attributes(fname, "mode") ~= "directory") then - goto continue; + goto continue end if (lfs.attributes(fname .. "/kernel", "mode") ~= "file") then - goto continue; + goto continue end if (unique[file] == nil) then - i = i + 1; - kernels[i] = file; - unique[file] = true; + i = i + 1 + kernels[i] = file + unique[file] = true end ::continue:: end - return kernels; + return kernels end function core.setDefaults() - core.setACPI(core.getACPIPresent(true)); - core.setSafeMode(false); - core.setSingleUser(false); - core.setVerbose(false); + core.setACPI(core.getACPIPresent(true)) + core.setSafeMode(false) + core.setSingleUser(false) + core.setVerbose(false) end function core.autoboot(argstr) - config.loadelf(); - loader.perform(compose_loader_cmd("autoboot", argstr)); + config.loadelf() + loader.perform(compose_loader_cmd("autoboot", argstr)) end function core.boot(argstr) - config.loadelf(); - loader.perform(compose_loader_cmd("boot", argstr)); + config.loadelf() + loader.perform(compose_loader_cmd("boot", argstr)) end function core.isSingleUserBoot() - local single_user = loader.getenv("boot_single"); - return single_user ~= nil and single_user:lower() == "yes"; + local single_user = loader.getenv("boot_single") + return single_user ~= nil and single_user:lower() == "yes" end function core.isSerialBoot() - local c = loader.getenv("console"); + local c = loader.getenv("console") if (c ~= nil) then if (c:find("comconsole") ~= nil) then - return true; + return true *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 01:35:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 722E7F1BBD7; Wed, 21 Feb 2018 01:35:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26DC27C4E4; Wed, 21 Feb 2018 01:35:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2191B11CD7; Wed, 21 Feb 2018 01:35:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1ZKl1009975; Wed, 21 Feb 2018 01:35:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1ZJub009967; Wed, 21 Feb 2018 01:35:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210135.w1L1ZJub009967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329685 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:35:20 -0000 Author: kevans Date: Wed Feb 21 01:35:19 2018 New Revision: 329685 URL: https://svnweb.freebsd.org/changeset/base/329685 Log: lualoader: Drop excessive parenthesizing This was also a convenience convention (for me) that is not very lua-tic. Drop it. I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between. Modified: head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/loader.lua head/stand/lua/menu.lua head/stand/lua/password.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/color.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -46,35 +46,35 @@ color.DIM = 2 function color.isEnabled() local c = loader.getenv("loader_color") - if (c ~= nil) then - if (c:lower() == "no") or (c == "0") then + if c ~= nil then + if c:lower() == "no" or c == "0" then return false end end - return (not core.isSerialBoot()) + return not core.isSerialBoot() end -color.disabled = (not color.isEnabled()) +color.disabled = not color.isEnabled() function color.escapef(c) - if (color.disabled) then + if color.disabled then return c end return "\027[3" .. c .. "m" end function color.escapeb(c) - if (color.disabled) then + if color.disabled then return c end return "\027[4" .. c .. "m" end function color.escape(fg, bg, att) - if (color.disabled) then + if color.disabled then return "" end - if (not att) then + if not att then att = "" else att = att .. ";" @@ -83,14 +83,14 @@ function color.escape(fg, bg, att) end function color.default() - if (color.disabled) then + if color.disabled then return "" end return "\027[0;37;40m" end function color.highlight(str) - if (color.disabled) then + if color.disabled then return str end return "\027[1m" .. str .. "\027[0m" Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/config.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -43,7 +43,7 @@ pattern_table = { [2] = { str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if (modules[k] == nil) then + if modules[k] == nil then modules[k] = {} end modules[k].load = v:upper() @@ -95,7 +95,7 @@ pattern_table = { [9] = { str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if (loader.perform(k) ~= 0) then + if loader.perform(k) ~= 0 then print("Failed to exec '" .. k .. "'") end end @@ -104,7 +104,7 @@ pattern_table = { [10] = { str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", process = function(k, v) - if (config.setenv(k, v) ~= 0) then + if config.setenv(k, v) ~= 0 then print("Failed to set '" .. k .. "' with value: " .. v .. "") end @@ -114,7 +114,7 @@ pattern_table = { [11] = { str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", process = function(k, v) - if (config.setenv(k, v) ~= 0) then + if config.setenv(k, v) ~= 0 then print("Failed to set '" .. k .. "' with value: " .. v .. "") end @@ -131,7 +131,7 @@ config.env_restore = {} -- The first item in every carousel is always the default item. function config.getCarouselIndex(id) local val = carousel_choices[id] - if (val == nil) then + if val == nil then return 1 end return val @@ -145,18 +145,18 @@ function config.restoreEnv() -- Examine changed environment variables for k, v in pairs(config.env_changed) do local restore_value = config.env_restore[k] - if (restore_value == nil) then + if restore_value == nil then -- This one doesn't need restored for some reason goto continue end local current_value = loader.getenv(k) - if (current_value ~= v) then + if current_value ~= v then -- This was overwritten by some action taken on the menu -- most likely; we'll leave it be. goto continue end restore_value = restore_value.value - if (restore_value ~= nil) then + if restore_value ~= nil then loader.setenv(k, restore_value) else loader.unsetenv(k) @@ -170,7 +170,7 @@ end function config.setenv(k, v) -- Track the original value for this if we haven't already - if (config.env_restore[k] == nil) then + if config.env_restore[k] == nil then config.env_restore[k] = {value = loader.getenv(k)} end @@ -180,7 +180,7 @@ function config.setenv(k, v) end function config.setKey(k, n, v) - if (modules[k] == nil) then + if modules[k] == nil then modules[k] = {} end modules[k][n] = v @@ -196,12 +196,12 @@ end function config.isValidComment(c) - if (c ~= nil) then + if c ~= nil then local s = c:match("^%s*#.*") - if (s == nil) then + if s == nil then s = c:match("^%s*$") end - if (s == nil) then + if s == nil then return false end end @@ -211,23 +211,23 @@ end function config.loadmod(mod, silent) local status = true for k, v in pairs(mod) do - if (v.load == "YES") then + if v.load == "YES" then local str = "load " - if (v.flags ~= nil) then + if v.flags ~= nil then str = str .. v.flags .. " " end - if (v.type ~= nil) then + if v.type ~= nil then str = str .. "-t " .. v.type .. " " end - if (v.name ~= nil) then + if v.name ~= nil then str = str .. v.name else str = str .. k end - if (v.before ~= nil) then - if (loader.perform(v.before) ~= 0) then - if (not silent) then + if v.before ~= nil then + if loader.perform(v.before) ~= 0 then + if not silent then print("Failed to execute '" .. v.before .. "' before loading '" .. k .. @@ -237,20 +237,20 @@ function config.loadmod(mod, silent) end end - if (loader.perform(str) ~= 0) then - if (not silent) then + if loader.perform(str) ~= 0 then + if not silent then print("Failed to execute '" .. str .. "'") end - if (v.error ~= nil) then + if v.error ~= nil then loader.perform(v.error) end status = false end - if (v.after ~= nil) then - if (loader.perform(v.after) ~= 0) then - if (not silent) then + if v.after ~= nil then + if loader.perform(v.after) ~= 0 then + if not silent then print("Failed to execute '" .. v.after .. "' after loading '" .. k .. @@ -262,7 +262,7 @@ function config.loadmod(mod, silent) else -- if not silent then - -- print("Skiping module '". . k .. "'") + -- print("Skipping module '". . k .. "'") -- end end end @@ -272,8 +272,8 @@ end function config.parse(name, silent) local f = io.open(name) - if (f == nil) then - if (not silent) then + if f == nil then + if not silent then print("Failed to open config: '" .. name .. "'") end return false @@ -284,8 +284,8 @@ function config.parse(name, silent) text, r = io.read(f) - if (text == nil) then - if (not silent) then + if text == nil then + if not silent then print("Failed to read config: '" .. name .. "'") end return false @@ -295,15 +295,15 @@ function config.parse(name, silent) local status = true for line in text:gmatch("([^\n]+)") do - if (line:match("^%s*$") == nil) then + if line:match("^%s*$") == nil then local found = false for i, val in ipairs(pattern_table) do local k, v, c = line:match(val.str) - if (k ~= nil) then + if k ~= nil then found = true - if (config.isValidComment(c)) then + if config.isValidComment(c) then val.process(k, v) else print("Malformed line (" .. n .. @@ -315,7 +315,7 @@ function config.parse(name, silent) end end - if (found == false) then + if found == false then print("Malformed line (" .. n .. "):\n\t'" .. line .. "'") status = false @@ -336,7 +336,7 @@ function config.loadkernel(other_kernel) local try_load = function (names) for name in names:gmatch("([^;]+)%s*;?") do r = loader.perform("load " .. flags .. " " .. name) - if (r == 0) then + if r == 0 then return name end end @@ -347,7 +347,7 @@ function config.loadkernel(other_kernel) local bootfile = loader.getenv("bootfile") -- append default kernel name - if (bootfile == nil) then + if bootfile == nil then bootfile = "kernel" else bootfile = bootfile .. ";kernel" @@ -357,10 +357,10 @@ function config.loadkernel(other_kernel) end -- kernel not set, try load from default module_path - if (kernel == nil) then + if kernel == nil then local res = load_bootfile() - if (res ~= nil) then + if res ~= nil then -- Default kernel is loaded config.kernel_loaded = nil return true @@ -374,7 +374,7 @@ function config.loadkernel(other_kernel) local module_path = config.module_path local res = nil - if (other_kernel ~= nil) then + if other_kernel ~= nil then kernel = other_kernel end -- first try load kernel with module_path = /boot/${kernel} @@ -386,9 +386,9 @@ function config.loadkernel(other_kernel) res = load_bootfile() -- succeeded, add path to module_path - if (res ~= nil) then + if res ~= nil then config.kernel_loaded = kernel - if (module_path ~= nil) then + if module_path ~= nil then loader.setenv("module_path", v .. ";" .. module_path) end @@ -399,7 +399,7 @@ function config.loadkernel(other_kernel) -- failed to load with ${kernel} as a directory -- try as a file res = try_load(kernel) - if (res ~= nil) then + if res ~= nil then config.kernel_loaded = kernel return true else @@ -414,18 +414,20 @@ function config.selectkernel(kernel) end function config.load(file) - if (not file) then + if not file then file = "/boot/defaults/loader.conf" end - if (not config.parse(file)) then + if not config.parse(file) then + -- XXX TODO: Why is this commented out? -- print("Failed to parse configuration: '" .. file .. "'") end local f = loader.getenv("loader_conf_files") - if (f ~= nil) then + if f ~= nil then for name in f:gmatch("([%w%p]+)%s*") do - if (not config.parse(name)) then + if not config.parse(name) then + -- XXX TODO: Ditto the above -- print("Failed to parse configuration: '" .. -- name .. "'") end @@ -450,13 +452,13 @@ function config.loadelf() print("Loading kernel...") loaded = config.loadkernel(kernel) - if (not loaded) then + if not loaded then print("Failed to load any kernel") return end print("Loading configured modules...") - if (not config.loadmod(modules)) then + if not config.loadmod(modules) then print("Could not load one or more modules!") end end Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/core.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -31,7 +31,7 @@ local config = require('config') local core = {} local compose_loader_cmd = function(cmd_name, argstr) - if (argstr ~= nil) then + if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr end return cmd_name @@ -43,23 +43,23 @@ end -- This will also parse arguments to autoboot, but the with_kernel argument -- will need to be explicitly overwritten to false local parse_boot_args = function(argv, with_kernel) - if (#argv == 0) then + if #argv == 0 then return nil, "" end - if (with_kernel == nil) then + if with_kernel == nil then with_kernel = true end local kernel_name local argstr = "" for k, v in ipairs(argv) do - if (with_kernel) and (v:sub(1,1) ~= "-") then + if with_kernel and v:sub(1,1) ~= "-" then kernel_name = v else argstr = argstr .. " " .. v end end - if (with_kernel) then + if with_kernel then return kernel_name, argstr else return argstr @@ -72,7 +72,7 @@ function boot(...) local cmd_name = "" cmd_name, argv = core.popFrontTable(argv) local kernel, argstr = parse_boot_args(argv) - if (kernel ~= nil) then + if kernel ~= nil then loader.perform("unload") config.selectkernel(kernel) end @@ -102,11 +102,11 @@ core.MENU_SUBMENU = "submenu" core.MENU_CAROUSEL_ENTRY = "carousel_entry" function core.setVerbose(b) - if (b == nil) then + if b == nil then b = not core.verbose end - if (b == true) then + if b == true then loader.setenv("boot_verbose", "YES") else loader.unsetenv("boot_verbose") @@ -115,11 +115,11 @@ function core.setVerbose(b) end function core.setSingleUser(b) - if (b == nil) then + if b == nil then b = not core.su end - if (b == true) then + if b == true then loader.setenv("boot_single", "YES") else loader.unsetenv("boot_single") @@ -130,23 +130,23 @@ end function core.getACPIPresent(checkingSystemDefaults) local c = loader.getenv("hint.acpi.0.rsdp") - if (c ~= nil) then - if (checkingSystemDefaults == true) then + if c ~= nil then + if checkingSystemDefaults == true then return true end -- Otherwise, respect disabled if it's set c = loader.getenv("hint.acpi.0.disabled") - return (c == nil) or (tonumber(c) ~= 1) + return c == nil or tonumber(c) ~= 1 end return false end function core.setACPI(b) - if (b == nil) then + if b == nil then b = not core.acpi end - if (b == true) then + if b == true then loader.setenv("acpi_load", "YES") loader.setenv("hint.acpi.0.disabled", "0") loader.unsetenv("loader.acpi_disabled_by_user") @@ -159,10 +159,10 @@ function core.setACPI(b) end function core.setSafeMode(b) - if (b == nil) then + if b == nil then b = not core.sm end - if (b == true) then + if b == true then loader.setenv("kern.smp.disabled", "1") loader.setenv("hw.ata.ata_dma", "0") loader.setenv("hw.ata.atapi_dma", "0") @@ -189,14 +189,14 @@ function core.kernelList() local kernels = {} local unique = {} local i = 0 - if (k ~= nil) then + if k ~= nil then i = i + 1 kernels[i] = k unique[k] = true end for n in v:gmatch("([^; ]+)[; ]?") do - if (unique[n] == nil) then + if unique[n] == nil then i = i + 1 kernels[i] = n unique[n] = true @@ -209,19 +209,19 @@ function core.kernelList() for file in lfs.dir("/boot") do local fname = "/boot/" .. file - if (file == "." or file == "..") then + if file == "." or file == ".." then goto continue end - if (lfs.attributes(fname, "mode") ~= "directory") then + if lfs.attributes(fname, "mode") ~= "directory" then goto continue end - if (lfs.attributes(fname .. "/kernel", "mode") ~= "file") then + if lfs.attributes(fname .. "/kernel", "mode") ~= "file" then goto continue end - if (unique[file] == nil) then + if unique[file] == nil then i = i + 1 kernels[i] = file unique[file] = true @@ -257,33 +257,33 @@ end function core.isSerialBoot() local c = loader.getenv("console") - if (c ~= nil) then - if (c:find("comconsole") ~= nil) then + if c ~= nil then + if c:find("comconsole") ~= nil then return true end end local s = loader.getenv("boot_serial") - if (s ~= nil) then + if s ~= nil then return true end local m = loader.getenv("boot_multicons") - if (m ~= nil) then + if m ~= nil then return true end return false end function core.isSystem386() - return (loader.machine_arch == "i386") + return loader.machine_arch == "i386" end -- This may be a better candidate for a 'utility' module. function core.shallowCopyTable(tbl) local new_tbl = {} for k, v in pairs(tbl) do - if (type(v) == "table") then + if type(v) == "table" then new_tbl[k] = core.shallowCopyTable(v) else new_tbl[k] = v @@ -297,9 +297,9 @@ end -- for our uses function core.popFrontTable(tbl) -- Shouldn't reasonably happen - if (#tbl == 0) then + if #tbl == 0 then return nil, nil - elseif (#tbl == 1) then + elseif #tbl == 1 then return tbl[1], {} end @@ -307,7 +307,7 @@ function core.popFrontTable(tbl) local new_tbl = {} -- This is not a cheap operation for k, v in ipairs(tbl) do - if (k > 1) then + if k > 1 then new_tbl[k - 1] = v end end @@ -319,7 +319,7 @@ end -- generally be set upon execution of the kernel. Because of this, we can't (or -- don't really want to) detect/disable ACPI on !i386 reliably. Just set it -- enabled if we detect it and leave well enough alone if we don't. -if (core.isSystem386()) and (core.getACPIPresent(false)) then +if core.isSystem386() and core.getACPIPresent(false) then core.setACPI(true) end return core Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/drawer.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -45,7 +45,7 @@ local none_shifted = false local menu_entry_name = function(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type] - if (name_handler ~= nil) then + if name_handler ~= nil then return name_handler(drawing_menu, entry) end return entry.name() @@ -180,7 +180,7 @@ drawer.menu_name_handlers = { local caridx = config.getCarouselIndex(carid) local choices = entry.items() - if (#choices < caridx) then + if #choices < caridx then caridx = 1 end return entry.name(caridx, choices[caridx], choices) @@ -256,16 +256,16 @@ function drawer.drawmenu(m) local alias_table = {} local entry_num = 0 local menu_entries = m.entries - if (type(menu_entries) == "function") then + if type(menu_entries) == "function" then menu_entries = menu_entries() end for line_num, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. - if (e.visible ~= nil) and (not e.visible()) then + if e.visible ~= nil and not e.visible() then goto continue end - if (e.entry_type ~= core.MENU_SEPARATOR) then + if e.entry_type ~= core.MENU_SEPARATOR then entry_num = entry_num + 1 screen.setcursor(x, y + line_num) @@ -273,7 +273,7 @@ function drawer.drawmenu(m) -- fill the alias table alias_table[tostring(entry_num)] = e - if (e.alias ~= nil) then + if e.alias ~= nil then for n, a in ipairs(e.alias) do alias_table[a] = e end @@ -339,7 +339,7 @@ function drawer.drawbrand() drawer.brand_position.y local graphic = drawer.branddefs[loader.getenv("loader_brand")] - if (graphic == nil) then + if graphic == nil then graphic = fbsd_logo end drawer.draw(x, y, graphic) @@ -357,22 +357,22 @@ function drawer.drawlogo() -- Lookup local logodef = drawer.logodefs[logo] - if (logodef ~= nil) and (logodef.graphic == none) then + if logodef ~= nil and logodef.graphic == none then -- centre brand and text if no logo - if (not none_shifted) then + if not none_shifted then shift_brand_text(logodef.shift) none_shifted = true end - elseif (logodef == nil) or (logodef.graphic == nil) or - ((not colored) and logodef.requires_color) then + elseif logodef == nil or logodef.graphic == nil or + (not colored and logodef.requires_color) then -- Choose a sensible default - if (colored) then + if colored then logodef = drawer.logodefs["orb"] else logodef = drawer.logodefs["orbbw"] end end - if (logodef.shift ~= nil) then + if logodef.shift ~= nil then x = x + logodef.shift.x y = y + logodef.shift.y end Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/loader.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -37,14 +37,14 @@ local password = require("password") function cli_execute(...) local argv = {...} -- Just in case... - if (#argv == 0) then + if #argv == 0 then loader.command(...) return end local cmd_name = argv[1] local cmd = _G[cmd_name] - if (cmd ~= nil) and (type(cmd) == "function") then + if cmd ~= nil and type(cmd) == "function" then -- Pass argv wholesale into cmd. We could omit argv[0] since the -- traditional reasons for including it don't necessarily apply, -- it may not be totally redundant if we want to have one global Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/menu.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -41,7 +41,7 @@ local run local autoboot local OnOff = function(str, b) - if (b) then + if b then return str .. color.escapef(color.GREEN) .. "On" .. color.escapef(color.WHITE) else @@ -67,7 +67,7 @@ menu.handlers = { local caridx = config.getCarouselIndex(carid) local choices = entry.items() - if (#choices > 0) then + if #choices > 0 then caridx = (caridx % #choices) + 1 config.setCarouselIndex(carid, caridx) entry.func(caridx, choices[caridx], choices) @@ -79,7 +79,7 @@ menu.handlers = { end, [core.MENU_RETURN] = function(current_menu, entry) -- allow entry to have a function/side effect - if (entry.func ~= nil) then + if entry.func ~= nil then entry.func() end return false @@ -181,9 +181,9 @@ menu.welcome = { entries = function() local menu_entries = menu.welcome.all_entries -- Swap the first two menu items on single user boot - if (core.isSingleUserBoot()) then + if core.isSingleUserBoot() then -- We'll cache the swapped menu, for performance - if (menu.welcome.swapped_menu ~= nil) then + if menu.welcome.swapped_menu ~= nil then return menu.welcome.swapped_menu end -- Shallow copy the table @@ -287,14 +287,14 @@ menu.welcome = { carousel_id = "kernel", items = core.kernelList, name = function(idx, choice, all_choices) - if (#all_choices == 0) then + if #all_choices == 0 then return "Kernel: " end local is_default = (idx == 1) local kernel_name = "" local name_color - if (is_default) then + if is_default then name_color = color.escapef(color.GREEN) kernel_name = "default/" else @@ -329,12 +329,12 @@ menu.welcome = { function menu.run(m) - if (menu.skip()) then + if menu.skip() then core.autoboot() return false end - if (m == nil) then + if m == nil then m = menu.welcome end @@ -346,14 +346,14 @@ function menu.run(m) menu.autoboot() cont = true - while (cont) do + while cont do local key = io.getchar() -- Special key behaviors - if ((key == core.KEY_BACKSPACE) or (key == core.KEY_DELETE)) and - (m ~= menu.welcome) then + if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and + m ~= menu.welcome then break - elseif (key == core.KEY_ENTER) then + elseif key == core.KEY_ENTER then core.boot() -- Should not return end @@ -362,21 +362,21 @@ function menu.run(m) -- check to see if key is an alias local sel_entry = nil for k, v in pairs(alias_table) do - if (key == k) then + if key == k then sel_entry = v end end -- if we have an alias do the assigned action: - if (sel_entry ~= nil) then + if sel_entry ~= nil then -- Get menu handler local handler = menu.handlers[sel_entry.entry_type] - if (handler ~= nil) then + if handler ~= nil then -- The handler's return value indicates whether -- we need to exit this menu. An omitted return -- value means "continue" by default. cont = handler(m, sel_entry) - if (cont == nil) then + if cont == nil then cont = true end end @@ -387,7 +387,7 @@ function menu.run(m) end end - if (m == menu.welcome) then + if m == menu.welcome then screen.defcursor() print("Exiting menu!") return false @@ -397,11 +397,11 @@ function menu.run(m) end function menu.skip() - if (core.isSerialBoot()) then + if core.isSerialBoot() then return true end local c = string.lower(loader.getenv("console") or "") - if ((c:match("^efi[ ;]") or c:match("[ ;]efi[ ;]")) ~= nil) then + if c:match("^efi[ ;]") ~= nil or c:match("[ ;]efi[ ;]") ~= nil then return true end @@ -411,15 +411,15 @@ function menu.skip() end function menu.autoboot() - if (menu.already_autoboot == true) then + if menu.already_autoboot == true then return end menu.already_autoboot = true local ab = loader.getenv("autoboot_delay") - if (ab ~= nil) and (ab:lower() == "no") then + if ab ~= nil and ab:lower() == "no" then return - elseif (tonumber(ab) == -1) then + elseif tonumber(ab) == -1 then core.boot() end ab = tonumber(ab) or 10 @@ -437,9 +437,9 @@ function menu.autoboot() " seconds, hit [Enter] to boot" .. " or any other key to stop ") screen.defcursor() - if (io.ischar()) then + if io.ischar() then local ch = io.getchar() - if (ch == core.KEY_ENTER) then + if ch == core.KEY_ENTER then break else -- erase autoboot msg Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/password.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -39,13 +39,13 @@ function password.read() repeat ch = io.getchar() - if (ch == core.KEY_ENTER) then + if ch == core.KEY_ENTER then break end -- XXX TODO: Evaluate if we really want this or not, as a -- security consideration of sorts - if (ch == core.KEY_BACKSPACE) or (ch == core.KEY_DELETE) then - if (n > 0) then + if ch == core.KEY_BACKSPACE or ch == core.KEY_DELETE then + if n > 0 then n = n - 1 -- loader.printc("\008 \008") str = str:sub(1, n) @@ -55,7 +55,7 @@ function password.read() str = str .. string.char(ch) n = n + 1 end - until (n == 16) + until n == 16 return str end @@ -64,10 +64,10 @@ function password.check() screen.defcursor() -- pwd is optionally supplied if we want to check it local function do_prompt(prompt, pwd) - while (true) do + while true do loader.printc(prompt) local read_pwd = password.read() - if (not pwd) or (pwd == read_pwd) then + if pwd == nil or pwd == read_pwd then -- Throw an extra newline after password prompt print("") return read_pwd @@ -77,7 +77,7 @@ function password.check() end end local function compare(prompt, pwd) - if (pwd == nil) then + if pwd == nil then return end do_prompt(prompt, pwd) @@ -87,13 +87,13 @@ function password.check() compare("Boot password: ", boot_pwd) local geli_prompt = loader.getenv("geom_eli_passphrase_prompt") - if (geli_prompt ~= nil) and (geli_prompt:lower() == "yes") then + if geli_prompt ~= nil and geli_prompt:lower() == "yes" then local passphrase = do_prompt("GELI Passphrase: ") loader.setenv("kern.geom.eli.passphrase", passphrase) end local pwd = loader.getenv("password") - if (pwd ~= nil) then + if pwd ~= nil then core.autoboot() end compare("Password: ", pwd) Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Wed Feb 21 01:10:03 2018 (r329684) +++ head/stand/lua/screen.lua Wed Feb 21 01:35:19 2018 (r329685) @@ -36,7 +36,7 @@ local intstring = function(num) local str = tostring(num) local decimal = str:find("%.") - if (decimal) then + if decimal then return str:sub(1, decimal - 1) end return str @@ -44,14 +44,14 @@ end -- Module exports function screen.clear() - if (core.isSerialBoot()) then + if core.isSerialBoot() then return end loader.printc("\027[H\027[J") end function screen.setcursor(x, y) - if (core.isSerialBoot()) then + if core.isSerialBoot() then return end @@ -59,14 +59,14 @@ function screen.setcursor(x, y) end function screen.setforeground(c) - if (color.disabled) then + if color.disabled then return c end loader.printc("\027[3" .. c .. "m") end function screen.setbackground(c) - if (color.disabled) then + if color.disabled then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 01:37:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 719F7F1BEBC; Wed, 21 Feb 2018 01:37:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2327E7C6EE; Wed, 21 Feb 2018 01:37:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E2E211CD9; Wed, 21 Feb 2018 01:37:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1bMD3010078; Wed, 21 Feb 2018 01:37:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1bMQX010077; Wed, 21 Feb 2018 01:37:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210137.w1L1bMQX010077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329686 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 329686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:37:23 -0000 Author: kevans Date: Wed Feb 21 01:37:22 2018 New Revision: 329686 URL: https://svnweb.freebsd.org/changeset/base/329686 Log: style.lua(9): Drop notes about semicolons It is generally agreed upon that they are ugly and should not be used except where needed. Modified: head/share/man/man9/style.lua.9 Modified: head/share/man/man9/style.lua.9 ============================================================================== --- head/share/man/man9/style.lua.9 Wed Feb 21 01:35:19 2018 (r329685) +++ head/share/man/man9/style.lua.9 Wed Feb 21 01:37:22 2018 (r329686) @@ -69,10 +69,6 @@ Indentation and wrapping should match the guidelines p Do note that it is ok to wrap much earlier than 80 columns if readability would otherwise suffer. .Pp -Statements should be terminated with a semicolon. -.Ic end -should not be terminated with a semicolon. -.Pp Where possible, .Fn s:method ... is preferred to From owner-svn-src-all@freebsd.org Wed Feb 21 01:39:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 480BFF1C262; Wed, 21 Feb 2018 01:39:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE2E27C96E; Wed, 21 Feb 2018 01:39:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE9CC11CDC; Wed, 21 Feb 2018 01:39:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1dXAx010190; Wed, 21 Feb 2018 01:39:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1dX78010187; Wed, 21 Feb 2018 01:39:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210139.w1L1dX78010187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329687 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:39:34 -0000 Author: kevans Date: Wed Feb 21 01:39:33 2018 New Revision: 329687 URL: https://svnweb.freebsd.org/changeset/base/329687 Log: lualoader: Drop explicit boolean tests; b or not b Modified: head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Feb 21 01:37:22 2018 (r329686) +++ head/stand/lua/config.lua Wed Feb 21 01:39:33 2018 (r329687) @@ -315,7 +315,7 @@ function config.parse(name, silent) end end - if found == false then + if not found then print("Malformed line (" .. n .. "):\n\t'" .. line .. "'") status = false Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 01:37:22 2018 (r329686) +++ head/stand/lua/core.lua Wed Feb 21 01:39:33 2018 (r329687) @@ -106,7 +106,7 @@ function core.setVerbose(b) b = not core.verbose end - if b == true then + if b then loader.setenv("boot_verbose", "YES") else loader.unsetenv("boot_verbose") @@ -119,7 +119,7 @@ function core.setSingleUser(b) b = not core.su end - if b == true then + if b then loader.setenv("boot_single", "YES") else loader.unsetenv("boot_single") @@ -131,7 +131,7 @@ function core.getACPIPresent(checkingSystemDefaults) local c = loader.getenv("hint.acpi.0.rsdp") if c ~= nil then - if checkingSystemDefaults == true then + if checkingSystemDefaults then return true end -- Otherwise, respect disabled if it's set @@ -146,7 +146,7 @@ function core.setACPI(b) b = not core.acpi end - if b == true then + if b then loader.setenv("acpi_load", "YES") loader.setenv("hint.acpi.0.disabled", "0") loader.unsetenv("loader.acpi_disabled_by_user") @@ -162,7 +162,7 @@ function core.setSafeMode(b) if b == nil then b = not core.sm end - if b == true then + if b then loader.setenv("kern.smp.disabled", "1") loader.setenv("hw.ata.ata_dma", "0") loader.setenv("hw.ata.atapi_dma", "0") Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 01:37:22 2018 (r329686) +++ head/stand/lua/menu.lua Wed Feb 21 01:39:33 2018 (r329687) @@ -411,7 +411,7 @@ function menu.skip() end function menu.autoboot() - if menu.already_autoboot == true then + if menu.already_autoboot then return end menu.already_autoboot = true From owner-svn-src-all@freebsd.org Wed Feb 21 01:50:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49C06F1D135; Wed, 21 Feb 2018 01:50:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E00A17D0DD; Wed, 21 Feb 2018 01:50:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DADE911F90; Wed, 21 Feb 2018 01:50:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1okkC014994; Wed, 21 Feb 2018 01:50:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1oktb014993; Wed, 21 Feb 2018 01:50:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210150.w1L1oktb014993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329688 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:50:47 -0000 Author: kevans Date: Wed Feb 21 01:50:46 2018 New Revision: 329688 URL: https://svnweb.freebsd.org/changeset/base/329688 Log: lualoader: Don't return false for failure to open config on silent parse Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Feb 21 01:39:33 2018 (r329687) +++ head/stand/lua/config.lua Wed Feb 21 01:50:46 2018 (r329688) @@ -270,13 +270,17 @@ function config.loadmod(mod, silent) return status end +-- silent runs will not return false if we fail to open the file function config.parse(name, silent) + if silent == nil then + silent = false + end local f = io.open(name) if f == nil then if not silent then print("Failed to open config: '" .. name .. "'") end - return false + return silent end local text @@ -288,7 +292,7 @@ function config.parse(name, silent) if not silent then print("Failed to read config: '" .. name .. "'") end - return false + return silent end local n = 1 From owner-svn-src-all@freebsd.org Wed Feb 21 01:52:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2201EF1D5E1; Wed, 21 Feb 2018 01:52:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B27687D503; Wed, 21 Feb 2018 01:52:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD3261201C; Wed, 21 Feb 2018 01:52:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L1qgPd019832; Wed, 21 Feb 2018 01:52:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L1qgmA019831; Wed, 21 Feb 2018 01:52:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210152.w1L1qgmA019831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 01:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329689 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 01:52:43 -0000 Author: kevans Date: Wed Feb 21 01:52:42 2018 New Revision: 329689 URL: https://svnweb.freebsd.org/changeset/base/329689 Log: lualoader: Output "Failed to parse" messages I can't find any good reason these aren't enabled, so enable them. The silent runs will only return false on actual parse errors, so it's ok to be loud about those failures. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Wed Feb 21 01:50:46 2018 (r329688) +++ head/stand/lua/config.lua Wed Feb 21 01:52:42 2018 (r329689) @@ -423,17 +423,18 @@ function config.load(file) end if not config.parse(file) then - -- XXX TODO: Why is this commented out? --- print("Failed to parse configuration: '" .. file .. "'") + print("Failed to parse configuration: '" .. file .. "'") end local f = loader.getenv("loader_conf_files") if f ~= nil then for name in f:gmatch("([%w%p]+)%s*") do - if not config.parse(name) then - -- XXX TODO: Ditto the above --- print("Failed to parse configuration: '" .. --- name .. "'") + -- These may or may not exist, and that's ok. Do a + -- silent parse so that we complain on parse errors but + -- not for them simply not existing. + if not config.parse(name, true) then + print("Failed to parse configuration: '" .. + name .. "'") end end end From owner-svn-src-all@freebsd.org Wed Feb 21 02:19:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5921F20952; Wed, 21 Feb 2018 02:19:15 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64A1E7E4AF; Wed, 21 Feb 2018 02:19:15 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f44.google.com with SMTP id l191so214781lfe.1; Tue, 20 Feb 2018 18:19:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wQbK4gr5+mSFrk/q0iEa49w+TYKHygxNFRrL00TJKwU=; b=Ohn0RwbkYEzBdDZmiI1mDbKYd87PYUlvE1vQOypYnxRQdtc0+XWHXA+PufNfVTtDZR 5UtJV2J2nLcLqCQBqVmkNAsRQYU9g1ipXgUnlXR5j07lxF7QKfqLUBtdeosrXOGyfizJ 3MG8950+rKArjVKPa4ytzVFyK/NYj0bm2H41HL9aK/CKdmq6xSRTF9t9RnONbwOWioZq rPPqJd17Ln3ELYwCnltldSQ31JIKIO1Jqk5FlazCf+cMkg/VUFe8YYLLOp16DUMBTQhM 2I6IwWYm5/pADiIj8bf1vxtX3oNeb/laHd5DEcD55H7tXfxUdhbXPuRTqDwCX+fmN+Qp NQBQ== X-Gm-Message-State: APf1xPDuWaCVVeKmB3Xe0V7aweIO8XB7DscXabHn6+WYxKu+ZTYV2aEB xFAKuwUO8v1nNUtmH2ZJa8xmyY84 X-Google-Smtp-Source: AH8x226c9rrcsYJU77/PGspIL9AWC7CXcdV4HYVONleWNRarBG+vYzmPVSQrx7yzWBc/OFwY9JidUg== X-Received: by 10.25.199.151 with SMTP id x145mr1195455lff.33.1519179547587; Tue, 20 Feb 2018 18:19:07 -0800 (PST) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com. [209.85.215.49]) by smtp.gmail.com with ESMTPSA id d82sm4963957lfl.66.2018.02.20.18.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 18:19:07 -0800 (PST) Received: by mail-lf0-f49.google.com with SMTP id 70so207458lfw.2; Tue, 20 Feb 2018 18:19:07 -0800 (PST) X-Received: by 10.25.158.149 with SMTP id h143mr22980lfe.129.1519179547085; Tue, 20 Feb 2018 18:19:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Tue, 20 Feb 2018 18:18:46 -0800 (PST) In-Reply-To: References: <201802201821.w1KILUUg079715@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Feb 2018 20:18:46 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329649 - head/stand/liblua To: Oliver Pinter Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 02:19:16 -0000 On Tue, Feb 20, 2018 at 2:48 PM, Oliver Pinter wrote: > On Tuesday, February 20, 2018, Conrad Meyer wrote: > >> Author: cem >> Date: Tue Feb 20 18:21:30 2018 >> New Revision: 329649 >> URL: https://svnweb.freebsd.org/changeset/base/329649 >> >> Log: >> Lua lfs.attributes: Provide a more consistent error return >> >> In the remaining error case, return a 3-tuple consistent with the other >> error return case. >> >> Document how to invoke lfs.attributes() and detect/decode error return in >> example comments. >> >> Reviewed by: kevans >> Sponsored by: Dell EMC Isilon >> Differential Revision: https://reviews.freebsd.org/D14451 >> >> Modified: >> head/stand/liblua/lfs.c >> >> Modified: head/stand/liblua/lfs.c >> ============================================================ >> ================== >> --- head/stand/liblua/lfs.c Tue Feb 20 18:12:07 2018 (r329648) >> +++ head/stand/liblua/lfs.c Tue Feb 20 18:21:30 2018 (r329649) >> @@ -80,13 +80,20 @@ __FBSDID("$FreeBSD$"); >> * (etc.) >> * >> * The other available API is lfs.attributes(), which functions somewhat >> like >> - * stat(2) and returns a table of values: >> + * stat(2) and returns a table of values. Example code: >> * >> - * for k, v in pairs(lfs.attributes("/boot")) do >> + * attrs, errormsg, errorcode = lfs.attributes("/boot") >> + * if attrs == nil then >> + * print(errormsg) >> + * return errorcode >> + * end >> + * >> + * for k, v in pairs(attrs) do >> * print(k .. ":\t" .. v) >> * end >> + * return 0 > > > Hi! > > Missing ; at the end of lines here. Hi, Thanks for pointing that out! =) Just FYI, our semicolon termination policy was pretty unnatural for Lua, so we've dropped it as of r329686 and all other instances of trailing semicolons should have been axed as of r329684. Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Wed Feb 21 02:19:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E0CDF209E7; Wed, 21 Feb 2018 02:19:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B52227E5E1; Wed, 21 Feb 2018 02:19:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFEEF1237A; Wed, 21 Feb 2018 02:19:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L2JheI029946; Wed, 21 Feb 2018 02:19:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L2JguX029938; Wed, 21 Feb 2018 02:19:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802210219.w1L2JguX029938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 02:19:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329690 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Commit-Revision: 329690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 02:19:44 -0000 Author: mav Date: Wed Feb 21 02:19:42 2018 New Revision: 329690 URL: https://svnweb.freebsd.org/changeset/base/329690 Log: MFV r319737: 6939 add sysevents to zfs core for commands illumos/illumos-gate@ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://github.com/illumos/illumos-gate/commit/ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://www.illumos.org/issues/6939 Originally created https://smartos.org/bugview/OS-4489 sysevents should be fired in the kernel from ZFS whenever a command is run that is logged in zpool history. Example output Terminal 1 root - gz sunos ~ # zfs create zones/foobar root - gz sunos ~ # zfs set quota=10g zones/foobar root - gz sunos ~ # zfs destroy zones/foobar Terminal 2 root - gz sunos ~ # sysevent EC_zfs nvlist version: 0 date = 2016-04-28T14:50:08.964Z vendor = SUNW publisher = zfs class = EC_zfs subclass = ESC_ZFS_history_event pid = 0 data = (embedded nvlist) nvlist version: 0 pool_name = zones pool_guid = 0x40c964e8f9a7a694 history_record = (embedded nvlist) nvlist version: 0 dsname = zones/foobar dsid = 0x1525 history internal str = internal_name = create history txg = 0x4c4ef3 Reviewed by: Patrick Mooney Reviewed by: Joshua M. Clulow Reviewed by: Josh Wilsdon Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Richard Elling Reviewed by: Alan Somers Reviewed by: Andrew Stormont Approved by: Matthew Ahrens Author: Dave Eddy Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Feb 21 02:19:42 2018 (r329690) @@ -22,6 +22,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Gary Mills * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -242,9 +243,10 @@ dsl_scan_setup_sync(void *arg, dmu_tx_t *tx) if (vdev_resilver_needed(spa->spa_root_vdev, &scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) { - spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START); + spa_event_notify(spa, NULL, NULL, + ESC_ZFS_RESILVER_START); } else { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_START); } spa->spa_scrub_started = B_TRUE; @@ -353,7 +355,8 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg, complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE); if (complete) { - spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ? + spa_event_notify(spa, NULL, NULL, + scn->scn_phys.scn_min_txg ? ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH); } spa_errlog_rotate(spa); @@ -387,7 +390,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); - spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT); + spa_event_notify(scn->scn_dp->dp_spa, NULL, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -442,7 +445,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -2015,7 +2018,7 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); if (err == 0) { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 02:19:42 2018 (r329690) @@ -28,6 +28,7 @@ * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -154,7 +155,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */ }; -static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name); +static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, + const char *name); static void spa_event_post(sysevent_t *ev); static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); @@ -800,7 +802,7 @@ spa_change_guid(spa_t *spa) if (error == 0) { spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_REGUID); } mutex_exit(&spa_namespace_lock); @@ -1674,7 +1676,7 @@ spa_check_removed(vdev_t *vd) if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) && !vd->vdev_ishole) { zfs_post_autoreplace(vd->vdev_spa, vd); - spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK); + spa_event_notify(vd->vdev_spa, vd, NULL, ESC_ZFS_VDEV_CHECK); } } @@ -3915,7 +3917,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ txg_wait_synced(spa->spa_dsl_pool, txg); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_CREATE); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); spa_history_log_version(spa, "create"); @@ -4387,7 +4389,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_configfile_set(spa, props, B_FALSE); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); return (0); @@ -4520,7 +4522,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_history_log_version(spa, "import"); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); @@ -4714,7 +4716,7 @@ spa_export_common(char *pool, int new_state, nvlist_t } } - spa_event_notify(spa, NULL, ESC_ZFS_POOL_DESTROY); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY); if (spa->spa_state != POOL_STATE_UNINITIALIZED) { spa_unload(spa); @@ -4869,7 +4871,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot) mutex_enter(&spa_namespace_lock); spa_config_update(spa, SPA_CONFIG_UPDATE_POOL); - spa_event_notify(spa, NULL, ESC_ZFS_VDEV_ADD); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_VDEV_ADD); mutex_exit(&spa_namespace_lock); return (0); @@ -5045,7 +5047,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n if (newvd->vdev_isspare) { spa_spare_activate(newvd); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_SPARE); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_SPARE); } oldvdpath = spa_strdup(oldvd->vdev_path); @@ -5065,9 +5067,9 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); if (spa->spa_bootfs) - spa_event_notify(spa, newvd, ESC_ZFS_BOOTFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_BOOTFS_VDEV_ATTACH); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_ATTACH); /* * Commit the config @@ -5281,7 +5283,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pg vd->vdev_detached = B_TRUE; vdev_dirty(tvd, VDD_DTL, vd, txg); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE); /* hang on to the spa before we release the lock */ spa_open_ref(spa, FTAG); @@ -5797,7 +5799,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u if (vd == NULL || unspare) { if (vd == NULL) vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, + ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_spares.sav_config, ZPOOL_CONFIG_SPARES, spares, nspares, nv); spa_load_spares(spa); @@ -5813,7 +5816,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u * Cache devices can always be removed. */ vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv); spa_load_l2cache(spa); @@ -5854,7 +5857,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u /* * Clean up the vdev namespace. */ - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_DEV); spa_vdev_remove_from_namespace(spa, vd); } else if (vd != NULL) { @@ -7326,7 +7329,7 @@ spa_has_active_shared_spare(spa_t *spa) } static sysevent_t * -spa_event_create(spa_t *spa, vdev_t *vd, const char *name) +spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { sysevent_t *ev = NULL; #ifdef _KERNEL @@ -7363,6 +7366,10 @@ spa_event_create(spa_t *spa, vdev_t *vd, const char *n } } + if (hist_nvl != NULL) { + fnvlist_merge((nvlist_t *)attr, hist_nvl); + } + if (sysevent_attach_attributes(ev, attr) != 0) goto done; attr = NULL; @@ -7389,12 +7396,12 @@ spa_event_post(sysevent_t *ev) /* * Post a sysevent corresponding to the given event. The 'name' must be one of * the event definitions in sys/sysevent/eventdefs.h. The payload will be - * filled in from the spa and (optionally) the vdev. This doesn't do anything - * in the userland libzpool, as we don't want consumers to misinterpret ztest - * or zdb as real changes. + * filled in from the spa and (optionally) the vdev and history nvl. This + * doesn't do anything in the userland libzpool, as we don't want consumers to + * misinterpret ztest or zdb as real changes. */ void -spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) +spa_event_notify(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { - spa_event_post(spa_event_create(spa, vd, name)); + spa_event_post(spa_event_create(spa, vd, hist_nvl, name)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Wed Feb 21 02:19:42 2018 (r329690) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. */ #include @@ -321,7 +322,7 @@ spa_config_sync(spa_t *target, boolean_t removing, boo spa_config_generation++; if (postsysevent) - spa_event_notify(target, NULL, ESC_ZFS_CONFIG_SYNC); + spa_event_notify(target, NULL, NULL, ESC_ZFS_CONFIG_SYNC); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Wed Feb 21 02:19:42 2018 (r329690) @@ -23,6 +23,7 @@ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ #include @@ -191,6 +192,71 @@ spa_history_zone(void) } /* + * Post a history sysevent. + * + * The nvlist_t* passed into this function will be transformed into a new + * nvlist where: + * + * 1. Nested nvlists will be flattened to a single level + * 2. Keys will have their names normalized (to remove any problematic + * characters, such as whitespace) + * + * The nvlist_t passed into this function will duplicated and should be freed + * by caller. + * + */ +static void +spa_history_log_notify(spa_t *spa, nvlist_t *nvl) +{ + nvlist_t *hist_nvl = fnvlist_alloc(); + uint64_t uint64; + char *string; + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_CMD, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_CMD, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_ZONE, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_ZONE, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_HOST, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_HOST, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_DSNAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_DSNAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_STR, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_IOCTL, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_DSID, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_DSID, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TXG, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TXG, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TIME, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TIME, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_WHO, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_WHO, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_INT_EVENT, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_INT_EVENT, uint64); + + spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT); + + nvlist_free(hist_nvl); +} + +/* * Write out a history event. */ /*ARGSUSED*/ @@ -254,6 +320,22 @@ spa_history_log_sync(void *arg, dmu_tx_t *tx) fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME), fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR)); } + /* + * The history sysevent is posted only for internal history + * messages to show what has happened, not how it happened. For + * example, the following command: + * + * # zfs destroy -r tank/foo + * + * will result in one sysevent posted per dataset that is + * destroyed as a result of the command - which could be more + * than one event in total. By contrast, if the sysevent was + * posted as a result of the ZPOOL_HIST_CMD key being present + * it would result in only one sysevent being posted with the + * full command line arguments, requiring the consumer to know + * how to parse and understand zfs(1M) command invocations. + */ + spa_history_log_notify(spa, nvl); } else if (nvlist_exists(nvl, ZPOOL_HIST_IOCTL)) { zfs_dbgmsg("ioctl %s", fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Feb 21 02:19:42 2018 (r329690) @@ -25,6 +25,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -898,7 +899,8 @@ extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t); /* asynchronous event notification */ -extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name); +extern void spa_event_notify(spa_t *spa, vdev_t *vdev, nvlist_t *hist_nvl, + const char *name); #ifdef ZFS_DEBUG #define dprintf_bp(bp, fmt, ...) do { \ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Feb 21 02:19:42 2018 (r329690) @@ -26,6 +26,7 @@ * Copyright 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome + * Copyright 2017 Joyent, Inc. */ #include @@ -2652,7 +2653,7 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, if (wasoffline || (oldstate < VDEV_STATE_DEGRADED && vd->vdev_state >= VDEV_STATE_DEGRADED)) - spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_ONLINE); return (spa_vdev_state_exit(spa, vd, 0)); } @@ -2823,7 +2824,7 @@ vdev_clear(spa_t *spa, vdev_t *vd) if (vd->vdev_aux == NULL && !vdev_is_dead(vd)) spa_async_request(spa, SPA_ASYNC_RESILVER); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_CLEAR); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_CLEAR); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Feb 21 02:19:42 2018 (r329690) @@ -23,9 +23,9 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -1019,11 +1019,45 @@ typedef enum { * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 + * + * ESC_ZFS_HISTORY_EVENT + * + * ZFS_EV_POOL_NAME DATA_TYPE_STRING + * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 + * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) + * + * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the + * history log nvlist. The keynames will be free of any spaces or other + * characters that could be potentially unexpected to consumers of the + * sysevents. */ #define ZFS_EV_POOL_NAME "pool_name" #define ZFS_EV_POOL_GUID "pool_guid" #define ZFS_EV_VDEV_PATH "vdev_path" #define ZFS_EV_VDEV_GUID "vdev_guid" +#define ZFS_EV_HIST_TIME "history_time" +#define ZFS_EV_HIST_CMD "history_command" +#define ZFS_EV_HIST_WHO "history_who" +#define ZFS_EV_HIST_ZONE "history_zone" +#define ZFS_EV_HIST_HOST "history_hostname" +#define ZFS_EV_HIST_TXG "history_txg" +#define ZFS_EV_HIST_INT_EVENT "history_internal_event" +#define ZFS_EV_HIST_INT_STR "history_internal_str" +#define ZFS_EV_HIST_INT_NAME "history_internal_name" +#define ZFS_EV_HIST_IOCTL "history_ioctl" +#define ZFS_EV_HIST_DSNAME "history_dsname" +#define ZFS_EV_HIST_DSID "history_dsid" #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Wed Feb 21 01:52:42 2018 (r329689) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Wed Feb 21 02:19:42 2018 (r329690) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Joyent, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -208,6 +209,7 @@ extern "C" { #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" +#define ESC_ZFS_HISTORY_EVENT "ESC_ZFS_history_event" #define ESC_ZFS_VDEV_AUTOEXPAND "ESC_ZFS_vdev_autoexpand" /* From owner-svn-src-all@freebsd.org Wed Feb 21 02:21:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9980EF20D3A; Wed, 21 Feb 2018 02:21:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473507E9A4; Wed, 21 Feb 2018 02:21:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42242124B7; Wed, 21 Feb 2018 02:21:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L2LNrR033726; Wed, 21 Feb 2018 02:21:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L2LNvu033725; Wed, 21 Feb 2018 02:21:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802210221.w1L2LNvu033725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 02:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329691 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 02:21:23 -0000 Author: mav Date: Wed Feb 21 02:21:22 2018 New Revision: 329691 URL: https://svnweb.freebsd.org/changeset/base/329691 Log: MFV r322231: 8430 dir_is_empty_readdir() doesn't properly handle error from fdopendir() illumos/illumos-gate@ba6e7e6505150388de6dc6a88741164118a421bf https://github.com/illumos/illumos-gate/commit/ba6e7e6505150388de6dc6a88741164118a421bf https://www.illumos.org/issues/8430 we should close dirfd if fdopendir() fails. Reviewed by: Serapheim Dimitropoulos Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Yuri Pankov Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Sowrabha Gopal Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Feb 21 02:19:42 2018 (r329690) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Wed Feb 21 02:21:22 2018 (r329691) @@ -216,6 +216,7 @@ dir_is_empty_readdir(const char *dirname) } if ((dirp = fdopendir(dirfd)) == NULL) { + (void) close(dirfd); return (B_TRUE); } From owner-svn-src-all@freebsd.org Wed Feb 21 02:35:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A517F21FE8; Wed, 21 Feb 2018 02:35:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B137F34F; Wed, 21 Feb 2018 02:35:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44619126C9; Wed, 21 Feb 2018 02:35:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L2ZEJt039760; Wed, 21 Feb 2018 02:35:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L2ZEfG039759; Wed, 21 Feb 2018 02:35:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210235.w1L2ZEfG039759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 02:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329692 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 02:35:14 -0000 Author: kevans Date: Wed Feb 21 02:35:13 2018 New Revision: 329692 URL: https://svnweb.freebsd.org/changeset/base/329692 Log: lualoader: Bring in local.lua module if it exists Provide a way for out-of-tree users of lualoader to patch into the loader system without having to modify our distributed scripts. Do note that we can't really offer any API compatibility guarantees at this time due to the evolving nature of lualoader right now. This still has some utility as local modules may add commands at the loader prompt without relying heavily on lualoader features- this specific functionality is less likely to change without more careful consideration. Reviewed by: cem (earlier version) Differential Revision: https://reviews.freebsd.org/D14439 Modified: head/stand/lua/loader.lua Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Wed Feb 21 02:21:22 2018 (r329691) +++ head/stand/lua/loader.lua Wed Feb 21 02:35:13 2018 (r329692) @@ -30,6 +30,13 @@ local config = require("config") local menu = require("menu") local password = require("password") +local local_module + +local result, errstr, errnoval = lfs.attributes("/boot/lua/local.lua") +-- Effectively discard any errors; we'll just act if it succeeds. +if result ~= nil then + local_module = require("local") +end -- Declares a global function cli_execute that attempts to dispatch the -- arguments passed as a lua function. This gives lua a chance to intercept From owner-svn-src-all@freebsd.org Wed Feb 21 02:40:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE66BF22617; Wed, 21 Feb 2018 02:40:55 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 436337F620; Wed, 21 Feb 2018 02:40:55 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f51.google.com with SMTP id 37so246524lfs.7; Tue, 20 Feb 2018 18:40:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pFhtBhCKD6ojDqqiZl4Y2E2KCTuTjWmcZrw3G+Pxfmw=; b=o9WFYJn11VUkekWDXCytaLy6aNUv2H64wDkmMqg2iPMhXZlExEhd/opEyALhThM2N7 u0NVjCJCImE0ytZkVn3nje5sinIu4azcFL9KAlHXx6QsH3uJK7xMR/OHzXDSRYX+5EUV UsjpmLsCeGy1nRuOFn53/4gTKsG+NrElaI5uHy6i6IYMsBluF9RhPD34z9HciAmKz8wL tIM6KSqa5FXcJe2f6oGUKiGfZU5lTSHN8q8CQT6UivK0d7aLlJPKSsCz51WgoKSKlaky kWx+hCZxz8NkbxkV74EiqHgFkchHYUehpm5YuTYSkJJ3v0I7qXataf/JcEtet/mhmWkx xrFQ== X-Gm-Message-State: APf1xPAUKGDcQI9IEeHLbyHnFHnthRhzqg7fN1ArhO9rzjEe9NnUPmNg nPb9cwzsqGJe/hQ8wTMFW1pL4IHP X-Google-Smtp-Source: AH8x226lCaNjxiBvakgskG33oF5a1SW4nLs/M7E0oa5esEb9MKnpmEWpC2bF+zUyB5V47FcaSvbwEw== X-Received: by 10.25.83.10 with SMTP id h10mr1201815lfb.121.1519180852785; Tue, 20 Feb 2018 18:40:52 -0800 (PST) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com. [209.85.215.52]) by smtp.gmail.com with ESMTPSA id i8sm998274lfg.90.2018.02.20.18.40.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 18:40:52 -0800 (PST) Received: by mail-lf0-f52.google.com with SMTP id x196so236550lfd.12; Tue, 20 Feb 2018 18:40:52 -0800 (PST) X-Received: by 10.46.114.10 with SMTP id n10mr1167658ljc.74.1519180852353; Tue, 20 Feb 2018 18:40:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Tue, 20 Feb 2018 18:40:31 -0800 (PST) In-Reply-To: <201802210235.w1L2ZEfG039759@repo.freebsd.org> References: <201802210235.w1L2ZEfG039759@repo.freebsd.org> From: Kyle Evans Date: Tue, 20 Feb 2018 20:40:31 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329692 - head/stand/lua To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 02:40:56 -0000 On Tue, Feb 20, 2018 at 8:35 PM, Kyle Evans wrote: > Author: kevans > Date: Wed Feb 21 02:35:13 2018 > New Revision: 329692 > URL: https://svnweb.freebsd.org/changeset/base/329692 > > Log: > lualoader: Bring in local.lua module if it exists > > Provide a way for out-of-tree users of lualoader to patch into the loader > system without having to modify our distributed scripts. > > Do note that we can't really offer any API compatibility guarantees at this > time due to the evolving nature of lualoader right now. > > This still has some utility as local modules may add commands at the loader > prompt without relying heavily on lualoader features- this specific > functionality is less likely to change without more careful consideration. > > Reviewed by: cem (earlier version) > Differential Revision: https://reviews.freebsd.org/D14439 > Some discussion from the review that I meant to add here: I imagine this being used for more cosmetic changes, rather than functional changes. Situations like other projects wishing to modify logo/brand availability or adding custom menu options without maintaining a full fork of lualoader. At some point, progress will slow down and we'll be able to figure out what we can guarantee API wise. Documentation will also come, probably sooner rather than later. From owner-svn-src-all@freebsd.org Wed Feb 21 03:06:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D534F245CC; Wed, 21 Feb 2018 03:06:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3F00808C2; Wed, 21 Feb 2018 03:06:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEEFC12C3F; Wed, 21 Feb 2018 03:06:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L36a7h055741; Wed, 21 Feb 2018 03:06:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L36amD055740; Wed, 21 Feb 2018 03:06:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210306.w1L36amD055740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 03:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329693 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:06:37 -0000 Author: kevans Date: Wed Feb 21 03:06:36 2018 New Revision: 329693 URL: https://svnweb.freebsd.org/changeset/base/329693 Log: lualoader: Return only argstr if with_kernel not requested Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 02:35:13 2018 (r329692) +++ head/stand/lua/core.lua Wed Feb 21 03:06:36 2018 (r329693) @@ -43,11 +43,15 @@ end -- This will also parse arguments to autoboot, but the with_kernel argument -- will need to be explicitly overwritten to false local parse_boot_args = function(argv, with_kernel) - if #argv == 0 then - return nil, "" - end if with_kernel == nil then with_kernel = true + end + if #argv == 0 then + if with_kernel then + return nil, "" + else + return "" + end end local kernel_name local argstr = "" From owner-svn-src-all@freebsd.org Wed Feb 21 03:08:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA1D2F247E8; Wed, 21 Feb 2018 03:08:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E3CB80C28; Wed, 21 Feb 2018 03:08:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 993BB12C43; Wed, 21 Feb 2018 03:08:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L38mnw055857; Wed, 21 Feb 2018 03:08:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L38lI6055848; Wed, 21 Feb 2018 03:08:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802210308.w1L38lI6055848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 03:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329694 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:08:49 -0000 Author: mav Date: Wed Feb 21 03:08:47 2018 New Revision: 329694 URL: https://svnweb.freebsd.org/changeset/base/329694 Log: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Feb 21 03:08:47 2018 (r329694) @@ -4439,8 +4439,9 @@ arc_kmem_reap_now(void) * This possible deadlock is avoided by always acquiring a hash lock * using mutex_tryenter() from arc_reclaim_thread(). */ +/* ARGSUSED */ static void -arc_reclaim_thread(void *dummy __unused) +arc_reclaim_thread(void *unused __unused) { hrtime_t growtime = 0; callb_cpr_t cpr; @@ -7580,8 +7581,9 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * This thread feeds the L2ARC at regular intervals. This is the beating * heart of the L2ARC. */ +/* ARGSUSED */ static void -l2arc_feed_thread(void *dummy __unused) +l2arc_feed_thread(void *unused __unused) { callb_cpr_t cpr; l2arc_dev_t *dev; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Feb 21 03:08:47 2018 (r329694) @@ -495,8 +495,9 @@ dbuf_evict_one(void) * of the dbuf cache is at or below the maximum size. Once the dbuf is aged * out of the cache it is destroyed and becomes eligible for arc eviction. */ +/* ARGSUSED */ static void -dbuf_evict_thread(void *dummy __unused) +dbuf_evict_thread(void *unused __unused) { callb_cpr_t cpr; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 03:08:47 2018 (r329694) @@ -6175,7 +6175,7 @@ spa_async_autoexpand(spa_t *spa, vdev_t *vd) static void spa_async_thread(void *arg) { - spa_t *spa = arg; + spa_t *spa = (spa_t *)arg; int tasks; ASSERT(spa->spa_sync_on); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Wed Feb 21 03:08:47 2018 (r329694) @@ -41,7 +41,7 @@ extern "C" { * particular object, use FTAG (which is a string) for the holder_tag. * Otherwise, use the object that holds the reference. */ -#define FTAG ((char *)__func__) +#define FTAG ((char *)(uintptr_t)__func__) #ifdef ZFS_DEBUG typedef struct reference { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Wed Feb 21 03:08:47 2018 (r329694) @@ -147,8 +147,8 @@ int sa_replace_all_by_template(sa_handle_t *, sa_bulk_ int sa_replace_all_by_template_locked(sa_handle_t *, sa_bulk_attr_t *, int, dmu_tx_t *); boolean_t sa_enabled(objset_t *); -void sa_cache_init(); -void sa_cache_fini(); +void sa_cache_init(void); +void sa_cache_fini(void); int sa_set_sa_object(objset_t *, uint64_t); int sa_hdrsize(void *); void sa_handle_lock(sa_handle_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Feb 21 03:08:47 2018 (r329694) @@ -890,7 +890,7 @@ extern void vdev_cache_stat_fini(void); /* Initialization and termination */ extern void spa_init(int flags); extern void spa_fini(void); -extern void spa_boot_init(); +extern void spa_boot_init(void); /* properties */ extern int spa_prop_set(spa_t *spa, nvlist_t *nvp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Wed Feb 21 03:08:47 2018 (r329694) @@ -389,7 +389,7 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkpt uint64_t txg); typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); -typedef int zil_replay_func_t(); +typedef int zil_replay_func_t(void *arg1, void *arg2, boolean_t byteswap); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, struct lwb *lwb, zio_t *zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Wed Feb 21 03:08:47 2018 (r329694) @@ -72,7 +72,7 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t m /* ARGSUSED */ static int -zfs_replay_error(zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap) +zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } @@ -265,9 +265,10 @@ zfs_replay_swap_attrs(lr_attr_t *lrattr) * as option FUID information. */ static int -zfs_replay_create_acl(zfsvfs_t *zfsvfs, - lr_acl_create_t *lracl, boolean_t byteswap) +zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_create_t *lracl = arg2; char *name = NULL; /* location determined later */ lr_create_t *lr = (lr_create_t *)lracl; znode_t *dzp; @@ -414,8 +415,10 @@ bail: } static int -zfs_replay_create(zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap) +zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_create_t *lr = arg2; char *name = NULL; /* location determined later */ char *link; /* symlink content follows name */ znode_t *dzp; @@ -546,8 +549,10 @@ out: } static int -zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap) +zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_remove_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_remove_t */ znode_t *dzp; struct componentname cn; @@ -597,8 +602,10 @@ fail: } static int -zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap) +zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_link_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_link_t */ znode_t *dzp, *zp; struct componentname cn; @@ -637,8 +644,10 @@ zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boole } static int -zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap) +zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_rename_t *lr = arg2; char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */ char *tname = sname + strlen(sname) + 1; znode_t *sdzp, *tdzp; @@ -707,8 +716,10 @@ fail: } static int -zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; char *data = (char *)(lr + 1); /* data follows lr_write_t */ znode_t *zp; int error; @@ -773,8 +784,10 @@ zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boo * the file is grown. */ static int -zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; znode_t *zp; int error; uint64_t end; @@ -818,9 +831,11 @@ top: } static int -zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) +zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { #ifdef illumos + zfsvfs_t *zfsvfs = arg1; + lr_truncate_t *lr = arg2; znode_t *zp; flock64_t fl; int error; @@ -850,8 +865,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *l } static int -zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap) +zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_setattr_t *lr = arg2; znode_t *zp; xvattr_t xva; vattr_t *vap = &xva.xva_vattr; @@ -909,8 +926,10 @@ extern int zfs_setsecattr(vnode_t *vp, vsecattr_t *vse caller_context_t *ct); static int -zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap) +zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_v0_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */ vsecattr_t vsa; vnode_t *vp; @@ -957,8 +976,10 @@ zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, b * */ static int -zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) +zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); vsecattr_t vsa; znode_t *zp; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Wed Feb 21 03:06:36 2018 (r329693) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Wed Feb 21 03:08:47 2018 (r329694) @@ -495,8 +495,10 @@ zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dm * implement DKIOCFREE/free-long-range. */ static int -zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t *lr, boolean_t byteswap) +zvol_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_truncate_t *lr = arg2; uint64_t offset, length; if (byteswap) @@ -513,8 +515,10 @@ zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t * * after a system failure */ static int -zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap) +zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_write_t *lr = arg2; objset_t *os = zv->zv_objset; char *data = (char *)(lr + 1); /* data follows lr_write_t */ uint64_t offset, length; @@ -551,7 +555,7 @@ zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, bo /* ARGSUSED */ static int -zvol_replay_err(zvol_state_t *zv, lr_t *lr, boolean_t byteswap) +zvol_replay_err(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } From owner-svn-src-all@freebsd.org Wed Feb 21 03:34:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6602CF26643; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7EE82225; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06FF613148; Wed, 21 Feb 2018 03:34:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L3YXAo070815; Wed, 21 Feb 2018 03:34:33 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L3YXV5070814; Wed, 21 Feb 2018 03:34:33 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802210334.w1L3YXV5070814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 21 Feb 2018 03:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329695 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:34:34 -0000 Author: jhibbits Date: Wed Feb 21 03:34:33 2018 New Revision: 329695 URL: https://svnweb.freebsd.org/changeset/base/329695 Log: Split printtrap() into generic and CPU-specific components Summary: This compartmentalizes the CPU-specific trap components into its own function, rather than littering the general printtrap() with various checks. This will let us replace a series of #ifdef's with a runtime conditional check in the future. Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14416 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Wed Feb 21 03:08:47 2018 (r329694) +++ head/sys/powerpc/powerpc/trap.c Wed Feb 21 03:34:33 2018 (r329695) @@ -445,52 +445,65 @@ trap_fatal(struct trapframe *frame) } static void -printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) +cpu_printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) { +#ifdef AIM uint16_t ver; -#ifdef BOOKE - vm_paddr_t pa; -#endif - printf("\n"); - printf("%s %s trap:\n", isfatal ? "fatal" : "handled", - user ? "user" : "kernel"); - printf("\n"); - printf(" exception = 0x%x (%s)\n", vector, trapname(vector)); switch (vector) { case EXC_DSE: case EXC_DSI: case EXC_DTMISS: - printf(" virtual address = 0x%" PRIxPTR "\n", frame->dar); -#ifdef AIM printf(" dsisr = 0x%lx\n", (u_long)frame->cpu.aim.dsisr); -#endif break; - case EXC_ISE: - case EXC_ISI: - case EXC_ITMISS: - printf(" virtual address = 0x%" PRIxPTR "\n", frame->srr0); - break; case EXC_MCHK: ver = mfpvr() >> 16; -#if defined(AIM) if (MPC745X_P(ver)) printf(" msssr0 = 0x%b\n", (int)mfspr(SPR_MSSSR0), MSSSR_BITMASK); + break; + } #elif defined(BOOKE) + vm_paddr_t pa; + + switch (vector) { + case EXC_MCHK: pa = mfspr(SPR_MCARU); pa = (pa << 32) | (u_register_t)mfspr(SPR_MCAR); printf(" mcsr = 0x%b\n", (int)mfspr(SPR_MCSR), MCSR_BITMASK); printf(" mcar = 0x%jx\n", (uintmax_t)pa); -#endif - break; } -#ifdef BOOKE printf(" esr = 0x%b\n", (int)frame->cpu.booke.esr, ESR_BITMASK); #endif +} + +static void +printtrap(u_int vector, struct trapframe *frame, int isfatal, int user) +{ + + printf("\n"); + printf("%s %s trap:\n", isfatal ? "fatal" : "handled", + user ? "user" : "kernel"); + printf("\n"); + printf(" exception = 0x%x (%s)\n", vector, trapname(vector)); + switch (vector) { + case EXC_DSE: + case EXC_DSI: + case EXC_DTMISS: + printf(" virtual address = 0x%" PRIxPTR "\n", frame->dar); + break; + case EXC_ISE: + case EXC_ISI: + case EXC_ITMISS: + printf(" virtual address = 0x%" PRIxPTR "\n", frame->srr0); + break; + case EXC_MCHK: + break; + } + cpu_printtrap(vector, frame, isfatal, user); printf(" srr0 = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n", frame->srr0, frame->srr0 - (register_t)(__startkernel - KERNBASE)); printf(" srr1 = 0x%lx\n", (u_long)frame->srr1); From owner-svn-src-all@freebsd.org Wed Feb 21 03:37:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 873FDF269F1; Wed, 21 Feb 2018 03:37:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3963682495; Wed, 21 Feb 2018 03:37:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3472413152; Wed, 21 Feb 2018 03:37:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L3blqn070979; Wed, 21 Feb 2018 03:37:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L3bluq070978; Wed, 21 Feb 2018 03:37:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210337.w1L3bluq070978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 03:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329696 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:37:47 -0000 Author: kevans Date: Wed Feb 21 03:37:46 2018 New Revision: 329696 URL: https://svnweb.freebsd.org/changeset/base/329696 Log: lualoader: Add "menu.default", initialized to menu.welcome The intent here is to abstract away the name of the default menu. The default menu is still the welcome menu, but this detail doesn't need to matter to things outside of the menu module. You may change the default menu, but one would need to modify a specific menu. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 03:34:33 2018 (r329695) +++ head/stand/lua/menu.lua Wed Feb 21 03:37:46 2018 (r329696) @@ -327,6 +327,8 @@ menu.welcome = { }, } +menu.default = menu.welcome + function menu.run(m) if menu.skip() then @@ -335,7 +337,7 @@ function menu.run(m) end if m == nil then - m = menu.welcome + m = menu.default end -- redraw screen @@ -351,7 +353,7 @@ function menu.run(m) -- Special key behaviors if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and - m ~= menu.welcome then + m ~= menu.default then break elseif key == core.KEY_ENTER then core.boot() @@ -387,7 +389,7 @@ function menu.run(m) end end - if m == menu.welcome then + if m == menu.default then screen.defcursor() print("Exiting menu!") return false From owner-svn-src-all@freebsd.org Wed Feb 21 04:14:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32FFAF002AC; Wed, 21 Feb 2018 04:14:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D114D83E96; Wed, 21 Feb 2018 04:14:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC088137F2; Wed, 21 Feb 2018 04:14:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L4EWC7090805; Wed, 21 Feb 2018 04:14:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L4EWtr090803; Wed, 21 Feb 2018 04:14:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210414.w1L4EWtr090803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 04:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329697 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 04:14:33 -0000 Author: kevans Date: Wed Feb 21 04:14:32 2018 New Revision: 329697 URL: https://svnweb.freebsd.org/changeset/base/329697 Log: lualoader: Drop name requirement for menu separators Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Feb 21 03:37:46 2018 (r329696) +++ head/stand/lua/drawer.lua Wed Feb 21 04:14:32 2018 (r329697) @@ -175,6 +175,12 @@ drawer.menu_name_handlers = { -- This is designed so that everything, including menu separators, may -- have their names derived differently. The default action for entry -- types not specified here is to call and use entry.name(). + [core.MENU_SEPARATOR] = function(drawing_menu, entry) + if entry.name ~= nil then + return entry.name() + end + return "" + end, [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 03:37:46 2018 (r329696) +++ head/stand/lua/menu.lua Wed Feb 21 04:14:32 2018 (r329697) @@ -113,9 +113,6 @@ menu.boot_options = { { entry_type = core.MENU_SEPARATOR, - name = function() - return "" - end }, { @@ -269,9 +266,6 @@ menu.welcome = { { entry_type = core.MENU_SEPARATOR, - name = function() - return "" - end }, { From owner-svn-src-all@freebsd.org Wed Feb 21 04:23:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEFDAF00F07; Wed, 21 Feb 2018 04:23:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6936A84571; Wed, 21 Feb 2018 04:23:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63E101398F; Wed, 21 Feb 2018 04:23:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L4NDsA095922; Wed, 21 Feb 2018 04:23:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L4NDZY095921; Wed, 21 Feb 2018 04:23:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210423.w1L4NDZY095921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 04:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329698 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 04:23:13 -0000 Author: kevans Date: Wed Feb 21 04:23:13 2018 New Revision: 329698 URL: https://svnweb.freebsd.org/changeset/base/329698 Log: lualoader: Directly reference submenu definition with submenu key Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 04:14:32 2018 (r329697) +++ head/stand/lua/menu.lua Wed Feb 21 04:23:13 2018 (r329698) @@ -75,7 +75,7 @@ menu.handlers = { end, [core.MENU_SUBMENU] = function(current_menu, entry) -- recurse - return menu.run(entry.submenu()) + return menu.run(entry.submenu) end, [core.MENU_RETURN] = function(current_menu, entry) -- allow entry to have a function/side effect @@ -313,9 +313,7 @@ menu.welcome = { return "Boot " .. color.highlight("O") .. "ptions" end, - submenu = function() - return menu.boot_options - end, + submenu = menu.boot_options, alias = {"o", "O"} }, }, From owner-svn-src-all@freebsd.org Wed Feb 21 04:48:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86870F02D1A; Wed, 21 Feb 2018 04:48:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3273B85288; Wed, 21 Feb 2018 04:48:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C47013CE9; Wed, 21 Feb 2018 04:48:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L4mb6n005950; Wed, 21 Feb 2018 04:48:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L4mbKd005948; Wed, 21 Feb 2018 04:48:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210448.w1L4mbKd005948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 04:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329699 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 04:48:38 -0000 Author: kevans Date: Wed Feb 21 04:48:37 2018 New Revision: 329699 URL: https://svnweb.freebsd.org/changeset/base/329699 Log: lualoader: Simplify menu definitions a little further Allow "name" entries to be simple strings, instead of just functions. We know whether we support colors or not by the time any of this is setup, so all menu names that are basically static with colors sprinkled in are good candidates for simplification. Also simplify "func" in many cases where it's just invoking another function with no arguments. The downside to this simplification is that the functions called can no longer be trivially replaced by a local module. The upside is that it removes another layer of indirection that we likely don't need. These can be re-evaluated later if a compelling argument is raised, on a case-by-case basis, for replacement. Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Feb 21 04:23:13 2018 (r329698) +++ head/stand/lua/drawer.lua Wed Feb 21 04:48:37 2018 (r329699) @@ -48,7 +48,10 @@ local menu_entry_name = function(drawing_menu, entry) if name_handler ~= nil then return name_handler(drawing_menu, entry) end - return entry.name() + if type(entry.name) == "function" then + return entry.name() + end + return entry.name end local shift_brand_text = function(shift) @@ -174,10 +177,13 @@ drawer.menu_name_handlers = { -- drawn as parameters, and return the name of the item. -- This is designed so that everything, including menu separators, may -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). + -- types not specified here is to use entry.name directly. [core.MENU_SEPARATOR] = function(drawing_menu, entry) if entry.name ~= nil then - return entry.name() + if type(entry.name) == "function" then + return entry.name() + end + return entry.name end return "" end, Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 04:23:13 2018 (r329698) +++ head/stand/lua/menu.lua Wed Feb 21 04:48:37 2018 (r329699) @@ -92,36 +92,24 @@ menu.boot_options = { -- return to welcome menu { entry_type = core.MENU_RETURN, - name = function() - return "Back to main menu" .. - color.highlight(" [Backspace]") - end + name = "Back to main menu" .. + color.highlight(" [Backspace]"), }, - -- load defaults { entry_type = core.MENU_ENTRY, - name = function() - return "Load System " .. color.highlight("D") .. - "efaults" - end, - func = function() - core.setDefaults() - end, + name = "Load System " .. color.highlight("D") .. + "efaults", + func = core.setDefaults, alias = {"d", "D"} }, - { entry_type = core.MENU_SEPARATOR, }, - { entry_type = core.MENU_SEPARATOR, - name = function() - return "Boot Options:" - end + name = "Boot Options:", }, - -- acpi { entry_type = core.MENU_ENTRY, @@ -130,9 +118,7 @@ menu.boot_options = { return OnOff(color.highlight("A") .. "CPI :", core.acpi) end, - func = function() - core.setACPI() - end, + func = core.setACPI, alias = {"a", "A"} }, -- safe mode @@ -142,9 +128,7 @@ menu.boot_options = { return OnOff("Safe " .. color.highlight("M") .. "ode :", core.sm) end, - func = function() - core.setSafeMode() - end, + func = core.setSafeMode, alias = {"m", "M"} }, -- single user @@ -154,9 +138,7 @@ menu.boot_options = { return OnOff(color.highlight("S") .. "ingle user:", core.su) end, - func = function() - core.setSingleUser() - end, + func = core.setSingleUser, alias = {"s", "S"} }, -- verbose boot @@ -166,9 +148,7 @@ menu.boot_options = { return OnOff(color.highlight("V") .. "erbose :", core.verbose) end, - func = function() - core.setVerbose() - end, + func = core.setVerbose, alias = {"v", "V"} }, }, @@ -202,79 +182,55 @@ menu.welcome = { -- boot multi user { entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("B") .. - "oot Multi user " .. - color.highlight("[Enter]") - end, + name = color.highlight("B") .. "oot Multi user " .. + color.highlight("[Enter]"), -- Not a standard menu entry function! - alternate_name = function() - return color.highlight("B") .. - "oot Multi user" - end, + alternate_name = color.highlight("B") .. + "oot Multi user", func = function() core.setSingleUser(false) core.boot() end, alias = {"b", "B"} }, - -- boot single user { entry_type = core.MENU_ENTRY, - name = function() - return "Boot " .. color.highlight("S") .. - "ingle user" - end, + name = "Boot " .. color.highlight("S") .. "ingle user", -- Not a standard menu entry function! - alternate_name = function() - return "Boot " .. color.highlight("S") .. - "ingle user " .. color.highlight("[Enter]") - end, + alternate_name = "Boot " .. color.highlight("S") .. + "ingle user " .. color.highlight("[Enter]"), func = function() core.setSingleUser(true) core.boot() end, alias = {"s", "S"} }, - -- escape to interpreter { entry_type = core.MENU_RETURN, - name = function() - return color.highlight("Esc") .. - "ape to loader prompt" - end, + name = color.highlight("Esc") .. "ape to loader prompt", func = function() loader.setenv("autoboot_delay", "NO") end, alias = {core.KEYSTR_ESCAPE} }, - -- reboot { entry_type = core.MENU_ENTRY, - name = function() - return color.highlight("R") .. "eboot" - end, + name = color.highlight("R") .. "eboot", func = function() loader.perform("reboot") end, alias = {"r", "R"} }, - - { entry_type = core.MENU_SEPARATOR, }, - { entry_type = core.MENU_SEPARATOR, - name = function() - return "Options:" - end + name = "Options:", }, - -- kernel options { entry_type = core.MENU_CAROUSEL_ENTRY, @@ -305,14 +261,10 @@ menu.welcome = { end, alias = {"k", "K"} }, - -- boot options { entry_type = core.MENU_SUBMENU, - name = function() - return "Boot " .. color.highlight("O") .. - "ptions" - end, + name = "Boot " .. color.highlight("O") .. "ptions", submenu = menu.boot_options, alias = {"o", "O"} }, From owner-svn-src-all@freebsd.org Wed Feb 21 05:04:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 084B7F040CC; Wed, 21 Feb 2018 05:04:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAA7285F3D; Wed, 21 Feb 2018 05:04:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4FF91401F; Wed, 21 Feb 2018 05:04:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L54wQi015719; Wed, 21 Feb 2018 05:04:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L54wa8015716; Wed, 21 Feb 2018 05:04:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802210504.w1L54wa8015716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 05:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329700 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 05:04:59 -0000 Author: kevans Date: Wed Feb 21 05:04:58 2018 New Revision: 329700 URL: https://svnweb.freebsd.org/changeset/base/329700 Log: lualoader: Allow carousel 'items' to be a table as well as a function We don't have any in-tree users of this, but for a static set of carousel options having to define a callback is excessive. Modified: head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Feb 21 04:48:37 2018 (r329699) +++ head/stand/lua/drawer.lua Wed Feb 21 05:04:58 2018 (r329700) @@ -190,8 +190,10 @@ drawer.menu_name_handlers = { [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) - local choices = entry.items() - + local choices = entry.items + if type(choices) == "function" then + choices = choices() + end if #choices < caridx then caridx = 1 end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 04:48:37 2018 (r329699) +++ head/stand/lua/menu.lua Wed Feb 21 05:04:58 2018 (r329700) @@ -65,8 +65,10 @@ menu.handlers = { -- carousel (rotating) functionality local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) - local choices = entry.items() - + local choices = entry.items + if type(choices) == "function" then + choices = choices() + end if #choices > 0 then caridx = (caridx % #choices) + 1 config.setCarouselIndex(carid, caridx) From owner-svn-src-all@freebsd.org Wed Feb 21 08:05:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39984F10694; Wed, 21 Feb 2018 08:05:57 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCF526C005; Wed, 21 Feb 2018 08:05:56 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7CEC15D62; Wed, 21 Feb 2018 08:05:56 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L85uDl004328; Wed, 21 Feb 2018 08:05:56 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L85u12004327; Wed, 21 Feb 2018 08:05:56 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802210805.w1L85u12004327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 21 Feb 2018 08:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329701 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 329701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 08:05:57 -0000 Author: wma Date: Wed Feb 21 08:05:56 2018 New Revision: 329701 URL: https://svnweb.freebsd.org/changeset/base/329701 Log: CXGBE: implement prefetch on non-Intel architectures Submitted by: Michal Stanek Obtained from: Semihalf Reviewed by: np, pdk@semihalf.com Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14452 Modified: head/sys/dev/cxgbe/adapter.h Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed Feb 21 05:04:58 2018 (r329700) +++ head/sys/dev/cxgbe/adapter.h Wed Feb 21 08:05:56 2018 (r329701) @@ -72,7 +72,7 @@ prefetch(void *x) __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); } #else -#define prefetch(x) +#define prefetch(x) __builtin_prefetch(x) #endif #ifndef SYSCTL_ADD_UQUAD From owner-svn-src-all@freebsd.org Wed Feb 21 08:13:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3E8F10EEE; Wed, 21 Feb 2018 08:13:18 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C0D16C540; Wed, 21 Feb 2018 08:13:18 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2550E15EFE; Wed, 21 Feb 2018 08:13:18 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1L8DHoI009337; Wed, 21 Feb 2018 08:13:17 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1L8DHOD009336; Wed, 21 Feb 2018 08:13:17 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802210813.w1L8DHOD009336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 21 Feb 2018 08:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329702 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 329702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 08:13:18 -0000 Author: wma Date: Wed Feb 21 08:13:17 2018 New Revision: 329702 URL: https://svnweb.freebsd.org/changeset/base/329702 Log: PowerNV: add missing RTC_WRITE support Add function which can store RTC values to OPAL. Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/powernv/opal_dev.c Modified: head/sys/powerpc/powernv/opal_dev.c ============================================================================== --- head/sys/powerpc/powernv/opal_dev.c Wed Feb 21 08:05:56 2018 (r329701) +++ head/sys/powerpc/powernv/opal_dev.c Wed Feb 21 08:13:17 2018 (r329702) @@ -191,6 +191,26 @@ bcd2bin32(int bcd) } static int +bin2bcd32(int bin) +{ + int out = 0; + int tmp; + + tmp = bin % 100; + out += bin2bcd(tmp) * 1; + bin = bin / 100; + + tmp = bin % 100; + out += bin2bcd(tmp) * 100; + bin = bin / 100; + + tmp = bin % 100; + out += bin2bcd(tmp) * 10000; + + return (out); +} + +static int opal_gettime(device_t dev, struct timespec *ts) { int rv; @@ -220,13 +240,42 @@ opal_gettime(device_t dev, struct timespec *ts) ct.day = bcd2bin((ymd & 0x000000ff) >> 0); ct.mon = bcd2bin((ymd & 0x0000ff00) >> 8); ct.year = bcd2bin32((ymd & 0xffff0000) >> 16); - + return (clock_ct_to_ts(&ct, ts)); } static int opal_settime(device_t dev, struct timespec *ts) { + int rv; + struct clocktime ct; + uint32_t ymd = 0; + uint64_t hmsm = 0; + + clock_ts_to_ct(ts, &ct); + + ymd |= (uint32_t)bin2bcd(ct.day); + ymd |= ((uint32_t)bin2bcd(ct.mon) << 8); + ymd |= ((uint32_t)bin2bcd32(ct.year) << 16); + + hmsm |= ((uint64_t)bin2bcd32(ct.nsec/1000) << 16); + hmsm |= ((uint64_t)bin2bcd(ct.sec) << 40); + hmsm |= ((uint64_t)bin2bcd(ct.min) << 48); + hmsm |= ((uint64_t)bin2bcd(ct.hour) << 56); + + hmsm = htobe64(hmsm); + ymd = htobe32(ymd); + + do { + rv = opal_call(OPAL_RTC_WRITE, vtophys(&ymd), vtophys(&hmsm)); + if (rv == OPAL_BUSY_EVENT) { + rv = opal_call(OPAL_POLL_EVENTS, 0); + pause("opalrtc", 1); + } + } while (rv == OPAL_BUSY_EVENT); + + if (rv != OPAL_SUCCESS) + return (ENXIO); return (0); } From owner-svn-src-all@freebsd.org Wed Feb 21 10:13:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E86BF1A0BD; Wed, 21 Feb 2018 10:13:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8BF70D74; Wed, 21 Feb 2018 10:13:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 469141729E; Wed, 21 Feb 2018 10:13:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LADIXZ069273; Wed, 21 Feb 2018 10:13:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LADI7f069272; Wed, 21 Feb 2018 10:13:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802211013.w1LADI7f069272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 21 Feb 2018 10:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329703 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 329703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 10:13:18 -0000 Author: hselasky Date: Wed Feb 21 10:13:17 2018 New Revision: 329703 URL: https://svnweb.freebsd.org/changeset/base/329703 Log: Allow LinuxKPI character devices to receive mmap() calls from the Linux binary mode user-space emulation layer. This is a regression issue after r328436, when LinuxKPI character devices started to use DTYPE_DEV in the "f_type" field of the associated file structure(s). MFC after: 3 days Found by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: head/sys/compat/linux/linux_mmap.c Modified: head/sys/compat/linux/linux_mmap.c ============================================================================== --- head/sys/compat/linux/linux_mmap.c Wed Feb 21 08:13:17 2018 (r329702) +++ head/sys/compat/linux/linux_mmap.c Wed Feb 21 10:13:17 2018 (r329703) @@ -129,7 +129,7 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s error = fget(td, fd, cap_rights_init(&rights, CAP_MMAP), &fp); if (error != 0) return (error); - if (fp->f_type != DTYPE_VNODE) { + if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_DEV) { fdrop(fp, td); return (EINVAL); } From owner-svn-src-all@freebsd.org Wed Feb 21 11:27:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA557F20FC9; Wed, 21 Feb 2018 11:27:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 578BF73D9F; Wed, 21 Feb 2018 11:27:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 524E417DD9; Wed, 21 Feb 2018 11:27:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LBR0vF004625; Wed, 21 Feb 2018 11:27:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LBR0uq004624; Wed, 21 Feb 2018 11:27:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802211127.w1LBR0uq004624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Feb 2018 11:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329704 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 11:27:00 -0000 Author: kib Date: Wed Feb 21 11:26:59 2018 New Revision: 329704 URL: https://svnweb.freebsd.org/changeset/base/329704 Log: MFC r329252: Do not call pmap_enter() with invalid protection mode. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Wed Feb 21 10:13:17 2018 (r329703) +++ stable/11/sys/vm/vm_fault.c Wed Feb 21 11:26:59 2018 (r329704) @@ -1217,6 +1217,12 @@ readrest: * write-enabled after all. */ prot &= retry_prot; + fault_type &= retry_prot; + if (prot == 0) { + release_page(&fs); + unlock_and_deallocate(&fs); + goto RetryFault; + } } } From owner-svn-src-all@freebsd.org Wed Feb 21 11:28:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25BCBF2114E; Wed, 21 Feb 2018 11:28:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A96F673F0E; Wed, 21 Feb 2018 11:28:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A46A617DDC; Wed, 21 Feb 2018 11:28:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LBS5RH004870; Wed, 21 Feb 2018 11:28:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LBS5Ed004869; Wed, 21 Feb 2018 11:28:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802211128.w1LBS5Ed004869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Feb 2018 11:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329705 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 11:28:06 -0000 Author: kib Date: Wed Feb 21 11:28:05 2018 New Revision: 329705 URL: https://svnweb.freebsd.org/changeset/base/329705 Log: MFC r329254: Ensure memory consistency on COW. Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Wed Feb 21 11:26:59 2018 (r329704) +++ stable/11/sys/vm/vm_fault.c Wed Feb 21 11:28:05 2018 (r329705) @@ -1133,6 +1133,10 @@ readrest: */ pmap_copy_page(fs.m, fs.first_m); fs.first_m->valid = VM_PAGE_BITS_ALL; + if ((fault_flags & VM_FAULT_WIRE) == 0) { + prot &= ~VM_PROT_WRITE; + fault_type &= ~VM_PROT_WRITE; + } if (wired && (fault_flags & VM_FAULT_WIRE) == 0) { vm_page_lock(fs.first_m); From owner-svn-src-all@freebsd.org Wed Feb 21 11:29:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97349F212B1; Wed, 21 Feb 2018 11:29:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A01374146; Wed, 21 Feb 2018 11:29:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B94917DDD; Wed, 21 Feb 2018 11:29:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LBT8LW004959; Wed, 21 Feb 2018 11:29:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LBT8gE004958; Wed, 21 Feb 2018 11:29:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802211129.w1LBT8gE004958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Feb 2018 11:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329706 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 11:29:08 -0000 Author: kib Date: Wed Feb 21 11:29:07 2018 New Revision: 329706 URL: https://svnweb.freebsd.org/changeset/base/329706 Log: MFC r329256: Cleanup unused page argument for vm_reserv_break(). Modified: stable/11/sys/vm/vm_reserv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_reserv.c ============================================================================== --- stable/11/sys/vm/vm_reserv.c Wed Feb 21 11:28:05 2018 (r329705) +++ stable/11/sys/vm/vm_reserv.c Wed Feb 21 11:29:07 2018 (r329706) @@ -231,7 +231,7 @@ static long vm_reserv_reclaimed; SYSCTL_LONG(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, &vm_reserv_reclaimed, 0, "Cumulative number of reclaimed reservations"); -static void vm_reserv_break(vm_reserv_t rv, vm_page_t m); +static void vm_reserv_break(vm_reserv_t rv); static void vm_reserv_depopulate(vm_reserv_t rv, int index); static vm_reserv_t vm_reserv_from_page(vm_page_t m); static boolean_t vm_reserv_has_pindex(vm_reserv_t rv, @@ -726,16 +726,15 @@ found: } /* - * Breaks the given reservation. Except for the specified free page, all free - * pages in the reservation are returned to the physical memory allocator. - * The reservation's population count and map are reset to their initial - * state. + * Breaks the given reservation. All free pages in the reservation + * are returned to the physical memory allocator. The reservation's + * population count and map are reset to their initial state. * * The given reservation must not be in the partially populated reservation * queue. The free page queue lock must be held. */ static void -vm_reserv_break(vm_reserv_t rv, vm_page_t m) +vm_reserv_break(vm_reserv_t rv) { int begin_zeroes, hi, i, lo; @@ -747,18 +746,6 @@ vm_reserv_break(vm_reserv_t rv, vm_page_t m) LIST_REMOVE(rv, objq); rv->object = NULL; rv->pages->psind = 0; - if (m != NULL) { - /* - * Since the reservation is being broken, there is no harm in - * abusing the population map to stop "m" from being returned - * to the physical memory allocator. - */ - i = m - rv->pages; - KASSERT(popmap_is_clear(rv->popmap, i), - ("vm_reserv_break: reserv %p's popmap is corrupted", rv)); - popmap_set(rv->popmap, i); - rv->popcnt++; - } i = hi = 0; do { /* Find the next 0 bit. Any previous 0 bits are < "hi". */ @@ -819,7 +806,7 @@ vm_reserv_break_all(vm_object_t object) TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); rv->inpartpopq = FALSE; } - vm_reserv_break(rv, NULL); + vm_reserv_break(rv); } mtx_unlock(&vm_page_queue_free_mtx); } @@ -928,7 +915,7 @@ vm_reserv_reclaim(vm_reserv_t rv) ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); TAILQ_REMOVE(&vm_rvq_partpop, rv, partpopq); rv->inpartpopq = FALSE; - vm_reserv_break(rv, NULL); + vm_reserv_break(rv); vm_reserv_reclaimed++; } From owner-svn-src-all@freebsd.org Wed Feb 21 11:31:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8919DF21690; Wed, 21 Feb 2018 11:31:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CB5A744A8; Wed, 21 Feb 2018 11:31:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3772917F33; Wed, 21 Feb 2018 11:31:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LBVUsd008764; Wed, 21 Feb 2018 11:31:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LBVUaE008763; Wed, 21 Feb 2018 11:31:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802211131.w1LBVUaE008763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Feb 2018 11:31:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329707 - stable/10/sys/vm X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/vm X-SVN-Commit-Revision: 329707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 11:31:30 -0000 Author: kib Date: Wed Feb 21 11:31:29 2018 New Revision: 329707 URL: https://svnweb.freebsd.org/changeset/base/329707 Log: MFC r329254: Ensure memory consistency on COW. Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Wed Feb 21 11:29:07 2018 (r329706) +++ stable/10/sys/vm/vm_fault.c Wed Feb 21 11:31:29 2018 (r329707) @@ -893,6 +893,10 @@ readrest: */ pmap_copy_page(fs.m, fs.first_m); fs.first_m->valid = VM_PAGE_BITS_ALL; + if ((fault_flags & VM_FAULT_WIRE) == 0) { + prot &= ~VM_PROT_WRITE; + fault_type &= ~VM_PROT_WRITE; + } if (wired && (fault_flags & VM_FAULT_WIRE) == 0) { vm_page_lock(fs.first_m); From owner-svn-src-all@freebsd.org Wed Feb 21 14:05:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0C09F045BB; Wed, 21 Feb 2018 14:05:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2FDF7C2B3; Wed, 21 Feb 2018 14:05:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DBFD197BA; Wed, 21 Feb 2018 14:05:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LE5D4r087427; Wed, 21 Feb 2018 14:05:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LE5DkB087426; Wed, 21 Feb 2018 14:05:13 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201802211405.w1LE5DkB087426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 21 Feb 2018 14:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329708 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 329708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:05:14 -0000 Author: trasz Date: Wed Feb 21 14:05:13 2018 New Revision: 329708 URL: https://svnweb.freebsd.org/changeset/base/329708 Log: Use proper buffer length (the announce_buf char pointer used to be anarray), broken in r317143. This fixes those weird "cd0: Attempt" messages at boot. PR: 222103 Reviewed by: scottl@ MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14369 Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Feb 21 11:31:29 2018 (r329707) +++ head/sys/cam/scsi/scsi_cd.c Wed Feb 21 14:05:13 2018 (r329708) @@ -1057,6 +1057,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cdp = &softc->params; announce_buf = softc->announce_temp; + bzero(announce_buf, CD_ANNOUNCETMP_SZ); rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; @@ -1127,7 +1128,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) &sense_key_desc, &asc_desc); snprintf(announce_buf, - sizeof(announce_buf), + CD_ANNOUNCETMP_SZ, "Attempt to query device " "size failed: %s, %s", sense_key_desc, @@ -1138,7 +1139,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) && (csio->scsi_status == SCSI_STATUS_BUSY)) { snprintf(announce_buf, - sizeof(announce_buf), + CD_ANNOUNCETMP_SZ, "Attempt to query device " "size failed: SCSI Status: %s", scsi_status_string(csio)); From owner-svn-src-all@freebsd.org Wed Feb 21 14:07:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96F51F048CB; Wed, 21 Feb 2018 14:07:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A4147C672; Wed, 21 Feb 2018 14:07:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45412197C2; Wed, 21 Feb 2018 14:07:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LE7s49087562; Wed, 21 Feb 2018 14:07:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LE7sLk087561; Wed, 21 Feb 2018 14:07:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211407.w1LE7sLk087561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 14:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329709 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:07:54 -0000 Author: kevans Date: Wed Feb 21 14:07:53 2018 New Revision: 329709 URL: https://svnweb.freebsd.org/changeset/base/329709 Log: lualoader: Don't autodetect kernels if 'kernels' is explicitly set Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 14:05:13 2018 (r329708) +++ head/stand/lua/core.lua Wed Feb 21 14:07:53 2018 (r329709) @@ -188,7 +188,7 @@ end function core.kernelList() local k = loader.getenv("kernel") - local v = loader.getenv("kernels") or "" + local v = loader.getenv("kernels") local kernels = {} local unique = {} @@ -199,12 +199,18 @@ function core.kernelList() unique[k] = true end - for n in v:gmatch("([^; ]+)[; ]?") do - if unique[n] == nil then - i = i + 1 - kernels[i] = n - unique[n] = true + if v ~= nil then + for n in v:gmatch("([^; ]+)[; ]?") do + if unique[n] == nil then + i = i + 1 + kernels[i] = n + unique[n] = true + end end + + -- We will not automatically detect kernels to be displayed if + -- loader.conf(5) explicitly set 'kernels'. + return kernels end -- Automatically detect other bootable kernel directories using a From owner-svn-src-all@freebsd.org Wed Feb 21 14:12:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 550FBF04FEC; Wed, 21 Feb 2018 14:12:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 072A97CCAE; Wed, 21 Feb 2018 14:12:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0217719953; Wed, 21 Feb 2018 14:12:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LECTFW092247; Wed, 21 Feb 2018 14:12:29 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LECTSv092246; Wed, 21 Feb 2018 14:12:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211412.w1LECTSv092246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 14:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329710 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:12:30 -0000 Author: avg Date: Wed Feb 21 14:12:29 2018 New Revision: 329710 URL: https://svnweb.freebsd.org/changeset/base/329710 Log: 8966 Source file zfs_acl.c, function zfs_aclset_common contains a use after end of the lifetime of a local variable illumos/illumos-gate@82693e09cc02331fa1b3b73b54b1060e73507a8d https://github.com/illumos/illumos-gate/commit/82693e09cc02331fa1b3b73b54b1060e73507a8d https://www.illumos.org/issues/8966 Reviewed by: Matt Ahrens Reviewed by: Andriy Gapon Approved by: Richard Lowe Author: WHR Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed Feb 21 14:07:53 2018 (r329709) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed Feb 21 14:12:29 2018 (r329710) @@ -1188,6 +1188,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t sa_bulk_attr_t bulk[5]; uint64_t ctime[2]; int count = 0; + zfs_acl_phys_t acl_phys; mode = zp->z_mode; @@ -1234,7 +1235,6 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t } else { /* Painful legacy way */ zfs_acl_node_t *aclnode; uint64_t off = 0; - zfs_acl_phys_t acl_phys; uint64_t aoid; if ((error = sa_lookup(zp->z_sa_hdl, SA_ZPL_ZNODE_ACL(zfsvfs), From owner-svn-src-all@freebsd.org Wed Feb 21 14:17:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FAE0F0553D; Wed, 21 Feb 2018 14:17:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7D067D0A9; Wed, 21 Feb 2018 14:17:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2B4B1995E; Wed, 21 Feb 2018 14:17:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LEH7Vb092473; Wed, 21 Feb 2018 14:17:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LEH7NJ092472; Wed, 21 Feb 2018 14:17:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211417.w1LEH7NJ092472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 14:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329711 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:17:08 -0000 Author: avg Date: Wed Feb 21 14:17:07 2018 New Revision: 329711 URL: https://svnweb.freebsd.org/changeset/base/329711 Log: MFV r329710: 8966 Source file zfs_acl.c, function zfs_aclset_common contains a use after end of the lifetime of a local variable illumos/illumos-gate@82693e09cc02331fa1b3b73b54b1060e73507a8d https://github.com/illumos/illumos-gate/commit/82693e09cc02331fa1b3b73b54b1060e73507a8d https://www.illumos.org/issues/8966 Reviewed by: Matt Ahrens Reviewed by: Andriy Gapon Approved by: Richard Lowe Author: WHR PR: 225162 Submitted by: WHR Reported by: WHR MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Feb 21 14:12:29 2018 (r329710) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Feb 21 14:17:07 2018 (r329711) @@ -1171,6 +1171,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t sa_bulk_attr_t bulk[5]; uint64_t ctime[2]; int count = 0; + zfs_acl_phys_t acl_phys; mode = zp->z_mode; @@ -1217,7 +1218,6 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t } else { /* Painful legacy way */ zfs_acl_node_t *aclnode; uint64_t off = 0; - zfs_acl_phys_t acl_phys; uint64_t aoid; if ((error = sa_lookup(zp->z_sa_hdl, SA_ZPL_ZNODE_ACL(zfsvfs), From owner-svn-src-all@freebsd.org Wed Feb 21 14:28:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98A93F06836; Wed, 21 Feb 2018 14:28:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0E27DE36; Wed, 21 Feb 2018 14:28:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D03D19AF3; Wed, 21 Feb 2018 14:28:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LESfBx097913; Wed, 21 Feb 2018 14:28:41 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LESeC0097904; Wed, 21 Feb 2018 14:28:40 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802211428.w1LESeC0097904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 21 Feb 2018 14:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329712 - in head/sys: conf powerpc/aim powerpc/include powerpc/powernv powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys: conf powerpc/aim powerpc/include powerpc/powernv powerpc/powerpc X-SVN-Commit-Revision: 329712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:28:42 -0000 Author: wma Date: Wed Feb 21 14:28:40 2018 New Revision: 329712 URL: https://svnweb.freebsd.org/changeset/base/329712 Log: PowerNV: Put processor to power-save state in idle thread When processor enters power-save state it releases resources shared with other cpu threads which makes other cores working much faster. This patch also implements saving and restoring registers that might get corrupted in power-save state. Submitted by: Patryk Duda Obtained from: Semihalf Reviewed by: jhibbits, nwhitehorn, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14330 Added: head/sys/powerpc/powerpc/cpu_subr64.S (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/locore64.S head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/include/cpu.h head/sys/powerpc/include/spr.h head/sys/powerpc/powernv/platform_powernv.c head/sys/powerpc/powerpc/cpu.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/conf/files.powerpc Wed Feb 21 14:28:40 2018 (r329712) @@ -198,6 +198,7 @@ powerpc/powerpc/clock.c standard powerpc/powerpc/copyinout.c standard powerpc/powerpc/copystr.c standard powerpc/powerpc/cpu.c standard +powerpc/powerpc/cpu_subr64.S optional powerpc64 powerpc/powerpc/db_disasm.c optional ddb powerpc/powerpc/db_hwwatch.c optional ddb powerpc/powerpc/db_interface.c optional ddb Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/aim/locore64.S Wed Feb 21 14:28:40 2018 (r329712) @@ -53,6 +53,8 @@ GLOBAL(__startkernel) .llong begin GLOBAL(__endkernel) .llong end +GLOBAL(can_wakeup) + .llong 0x0 .align 4 #define TMPSTKSZ 16384 /* 16K temporary stack */ @@ -60,6 +62,7 @@ GLOBAL(tmpstk) .space TMPSTKSZ TOC_ENTRY(tmpstk) +TOC_ENTRY(can_wakeup) /* * Entry point for bootloaders that do not fully implement ELF and start @@ -96,6 +99,10 @@ ap_kexec_start: /* At 0x60 past start, copied to 0x60 /* Released */ or 2,2,2 /* unyield */ + + /* Make sure that it will be software reset. Clear SRR1 */ + li %r1,0 + mtsrr1 %r1 ba EXC_RST Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/aim/mp_cpudep.c Wed Feb 21 14:28:40 2018 (r329712) @@ -398,8 +398,11 @@ cpudep_ap_setup() case IBMPOWER8: case IBMPOWER8E: #ifdef __powerpc64__ - if (mfmsr() & PSL_HV) - mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_LPES); + if (mfmsr() & PSL_HV) { + mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_LPES | + LPCR_PECE_WAKESET); + isync(); + } #endif break; default: Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/aim/trap_subr64.S Wed Feb 21 14:28:40 2018 (r329712) @@ -307,10 +307,24 @@ dtrace_invop_calltrap_addr: * once the MMU is turned on. */ .globl CNAME(rstcode), CNAME(rstcodeend), CNAME(cpu_reset_handler) + .globl CNAME(cpu_wakeup_handler) .p2align 3 CNAME(rstcode): + /* + * Check if this is software reset or + * processor is waking up from power saving mode + * It is software reset when 46:47 = 0b00 + */ + mfsrr1 %r9 /* Load SRR1 into r9 */ + andis. %r9,%r9,0x3 /* Logic AND with 46:47 bits */ + beq 2f /* Branch if software reset */ + bl 1f + .llong cpu_wakeup_handler + + /* It is software reset */ + /* Explicitly set MSR[SF] */ - mfmsr %r9 +2: mfmsr %r9 li %r8,1 insrdi %r9,%r8,1,0 mtmsrd %r9 @@ -318,6 +332,7 @@ CNAME(rstcode): bl 1f .llong cpu_reset_handler /* Make sure to maintain 8-byte alignment */ + 1: mflr %r9 ld %r9,0(%r9) mtlr %r9 @@ -358,6 +373,59 @@ cpu_reset_handler: /* Should not be reached */ 9: b 9b + +cpu_wakeup_handler: + GET_TOCBASE(%r2) + + /* Check for false wake up due to badly SRR1 set (eg. by OPAL) */ + ld %r3,TOC_REF(can_wakeup)(%r2) + ld %r3,0(%r3) + cmpdi %r3,0 + beq cpu_reset_handler + + /* Turn on MMU after return from interrupt */ + mfsrr1 %r3 + ori %r3,%r3,(PSL_IR | PSL_DR) + mtsrr1 %r3 + + /* Turn on MMU (needed to access PCB) */ + mfmsr %r3 + ori %r3,%r3,(PSL_IR | PSL_DR) + mtmsr %r3 + isync + + mfsprg0 %r3 + + ld %r3,PC_CURTHREAD(%r3) /* Get current thread */ + ld %r3,TD_PCB(%r3) /* Get PCB of current thread */ + ld %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs. */ + ld %r13,PCB_CONTEXT+1*8(%r3) + ld %r14,PCB_CONTEXT+2*8(%r3) + ld %r15,PCB_CONTEXT+3*8(%r3) + ld %r16,PCB_CONTEXT+4*8(%r3) + ld %r17,PCB_CONTEXT+5*8(%r3) + ld %r18,PCB_CONTEXT+6*8(%r3) + ld %r19,PCB_CONTEXT+7*8(%r3) + ld %r20,PCB_CONTEXT+8*8(%r3) + ld %r21,PCB_CONTEXT+9*8(%r3) + ld %r22,PCB_CONTEXT+10*8(%r3) + ld %r23,PCB_CONTEXT+11*8(%r3) + ld %r24,PCB_CONTEXT+12*8(%r3) + ld %r25,PCB_CONTEXT+13*8(%r3) + ld %r26,PCB_CONTEXT+14*8(%r3) + ld %r27,PCB_CONTEXT+15*8(%r3) + ld %r28,PCB_CONTEXT+16*8(%r3) + ld %r29,PCB_CONTEXT+17*8(%r3) + ld %r30,PCB_CONTEXT+18*8(%r3) + ld %r31,PCB_CONTEXT+19*8(%r3) + ld %r5,PCB_CR(%r3) /* Load the condition register */ + mtcr %r5 + ld %r5,PCB_LR(%r3) /* Load the link register */ + mtsrr0 %r5 + ld %r1,PCB_SP(%r3) /* Load the stack pointer */ + ld %r2,PCB_TOC(%r3) /* Load the TOC pointer */ + + rfid /* * This code gets copied to all the trap vectors Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/include/cpu.h Wed Feb 21 14:28:40 2018 (r329712) @@ -112,6 +112,11 @@ get_cyclecount(void) extern char btext[]; extern char etext[]; +#ifdef __powerpc64__ +extern void enter_idle_powerx(void); +extern uint64_t can_wakeup; +#endif + void cpu_halt(void); void cpu_reset(void); void cpu_sleep(void); Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/include/spr.h Wed Feb 21 14:28:40 2018 (r329712) @@ -201,7 +201,14 @@ #define SPR_LPCR 0x13e /* Logical Partitioning Control */ #define LPCR_LPES 0x008 /* Bit 60 */ - +#define LPCR_PECE_DRBL (1ULL << 16) /* Directed Privileged Doorbell */ +#define LPCR_PECE_HDRBL (1ULL << 15) /* Directed Hypervisor Doorbell */ +#define LPCR_PECE_EXT (1ULL << 14) /* External exceptions */ +#define LPCR_PECE_DECR (1ULL << 13) /* Decrementer exceptions */ +#define LPCR_PECE_ME (1ULL << 12) /* Machine Check and Hypervisor */ + /* Maintenance exceptions */ +#define LPCR_PECE_WAKESET (LPCR_PECE_EXT | LPCR_PECE_DECR | LPCR_PECE_ME) + #define SPR_EPCR 0x133 #define EPCR_EXTGS 0x80000000 #define EPCR_DTLBGS 0x40000000 Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/powernv/platform_powernv.c Wed Feb 21 14:28:40 2018 (r329712) @@ -139,7 +139,9 @@ powernv_attach(platform_t plat) opal_call(OPAL_REINIT_CPUS, 1 /* Big endian */); #endif - cpu_idle_hook = powernv_cpu_idle; + if (cpu_idle_hook == NULL) + cpu_idle_hook = powernv_cpu_idle; + powernv_boot_pir = mfspr(SPR_PIR); /* LPID must not be altered when PSL_DR or PSL_IR is set */ @@ -150,10 +152,10 @@ powernv_attach(platform_t plat) mtspr(SPR_LPID, 0); isync(); - mtmsr(msr); - mtspr(SPR_LPCR, LPCR_LPES); isync(); + + mtmsr(msr); /* Init CPU bits */ powernv_smp_ap_init(plat); Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Wed Feb 21 14:17:07 2018 (r329711) +++ head/sys/powerpc/powerpc/cpu.c Wed Feb 21 14:28:40 2018 (r329712) @@ -68,6 +68,8 @@ #include #include #include +#include +#include #include #include @@ -81,11 +83,15 @@ static void cpu_6xx_setup(int cpuid, uint16_t vers); static void cpu_970_setup(int cpuid, uint16_t vers); static void cpu_booke_setup(int cpuid, uint16_t vers); +static void cpu_powerx_setup(int cpuid, uint16_t vers); int powerpc_pow_enabled; void (*cpu_idle_hook)(sbintime_t) = NULL; static void cpu_idle_60x(sbintime_t); static void cpu_idle_booke(sbintime_t); +#ifdef __powerpc64__ +static void cpu_idle_powerx(sbintime_t); +#endif struct cputab { const char *name; @@ -156,13 +162,13 @@ static const struct cputab models[] = { PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | - PPC_FEATURE2_HAS_VCRYPTO, NULL }, + PPC_FEATURE2_HAS_VCRYPTO, cpu_powerx_setup }, { "IBM POWER8", IBMPOWER8, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | - PPC_FEATURE2_HAS_VCRYPTO, NULL }, + PPC_FEATURE2_HAS_VCRYPTO, cpu_powerx_setup }, { "IBM POWER9", IBMPOWER9, REVFMT_MAJMIN, PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | @@ -610,6 +616,29 @@ cpu_970_setup(int cpuid, uint16_t vers) cpu_idle_hook = cpu_idle_60x; } +static void +cpu_powerx_setup(int cpuid, uint16_t vers) +{ + +#ifdef __powerpc64__ + if ((mfmsr() & PSL_HV) == 0) + return; + + /* Configure power-saving */ + switch (vers) { + case IBMPOWER8: + case IBMPOWER8E: + mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET); + isync(); + break; + default: + return; + } + + cpu_idle_hook = cpu_idle_powerx; +#endif +} + static int cpu_feature_bit(SYSCTL_HANDLER_ARGS) { @@ -696,3 +725,26 @@ cpu_idle_booke(sbintime_t sbt) #endif } +#ifdef __powerpc64__ +static void +cpu_idle_powerx(sbintime_t sbt) +{ + + /* Sleeping when running on one cpu gives no advantages - avoid it */ + if (smp_started == 0) + return; + + spinlock_enter(); + if (sched_runnable()) { + spinlock_exit(); + return; + } + + if (can_wakeup == 0) + can_wakeup = 1; + mb(); + + enter_idle_powerx(); + spinlock_exit(); +} +#endif Added: head/sys/powerpc/powerpc/cpu_subr64.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powerpc/cpu_subr64.S Wed Feb 21 14:28:40 2018 (r329712) @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 2017-2018 QCM Technologies. + * Copyright (c) 2017-2018 Semihalf. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "assym.s" + +#include + + .globl CNAME(power_save_sequence) + .p2align 3 +ENTRY(enter_idle_powerx) + mfsprg0 %r3 /* Get the pcpu pointer */ + ld %r3,PC_CURTHREAD(%r3) /* Get current thread */ + ld %r3,TD_PCB(%r3) /* Get PCB of current thread */ + std %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs. */ + std %r13,PCB_CONTEXT+1*8(%r3) + std %r14,PCB_CONTEXT+2*8(%r3) + std %r15,PCB_CONTEXT+3*8(%r3) + std %r16,PCB_CONTEXT+4*8(%r3) + std %r17,PCB_CONTEXT+5*8(%r3) + std %r18,PCB_CONTEXT+6*8(%r3) + std %r19,PCB_CONTEXT+7*8(%r3) + std %r20,PCB_CONTEXT+8*8(%r3) + std %r21,PCB_CONTEXT+9*8(%r3) + std %r22,PCB_CONTEXT+10*8(%r3) + std %r23,PCB_CONTEXT+11*8(%r3) + std %r24,PCB_CONTEXT+12*8(%r3) + std %r25,PCB_CONTEXT+13*8(%r3) + std %r26,PCB_CONTEXT+14*8(%r3) + std %r27,PCB_CONTEXT+15*8(%r3) + std %r28,PCB_CONTEXT+16*8(%r3) + std %r29,PCB_CONTEXT+17*8(%r3) + std %r30,PCB_CONTEXT+18*8(%r3) + std %r31,PCB_CONTEXT+19*8(%r3) + + mfcr %r16 /* Save the condition register */ + std %r16,PCB_CR(%r3) + mflr %r16 /* Save the link register */ + std %r16,PCB_LR(%r3) + std %r1,PCB_SP(%r3) /* Save the stack pointer */ + std %r2,PCB_TOC(%r3) /* Save the TOC pointer */ + + /* Set where we want to jump */ + bl 1f + .llong power_save_sequence /* Remember about 8 byte alignment */ +1: mflr %r3 + ld %r3,0(%r3) + mtsrr0 %r3 + + /* Set MSR */ + li %r3,0 + ori %r3,%r3,(PSL_ME | PSL_RI) + li %r8,0x9 /* PSL_SF and PSL_HV */ + insrdi %r3,%r8,4,0 + mtsrr1 %r3 + + rfid + + .p2align 2 +CNAME(power_save_sequence): + bl 1f + .llong 0x0 /* Playground for power-save sequence */ +1: mflr %r3 + + /* Start power-save sequence */ + std %r2,0(%r3) + ptesync + ld %r2,0(%r3) +2: cmpd %r2,%r2 + bne 2b + nap + b . From owner-svn-src-all@freebsd.org Wed Feb 21 14:30:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27FB6F06A3D; Wed, 21 Feb 2018 14:30:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCCC27E008; Wed, 21 Feb 2018 14:30:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD94F19B04; Wed, 21 Feb 2018 14:30:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LEUYVn098048; Wed, 21 Feb 2018 14:30:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LEUYRm098047; Wed, 21 Feb 2018 14:30:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211430.w1LEUYRm098047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 14:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329713 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:30:35 -0000 Author: avg Date: Wed Feb 21 14:30:34 2018 New Revision: 329713 URL: https://svnweb.freebsd.org/changeset/base/329713 Log: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks illumos/illumos-gate@a6c1eb3c08094a6db69aa1dc6315bc814e82e79c https://github.com/illumos/illumos-gate/commit/a6c1eb3c08094a6db69aa1dc6315bc814e82e79c https://www.illumos.org/issues/8731 annotate_ecksum() asserts that nui64s, calculated as nui64s = size / sizeof (uint64_t), is not greater than UINT16_MAX. This restriction is needed because histograms of incorrectly set and cleared bits have 16 bit counters and if the buffer consists of too many 64-bit words, then a counter can potentially overflow producing an incorrect result. When the largest buffer size was 128KB the greatest value of nui64s was 16K, well within the limit. But now we have support for large buffers and for buffer sizes of 512KB and above the restriction is violated. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fm.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fm.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fm.c Wed Feb 21 14:28:40 2018 (r329712) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fm.c Wed Feb 21 14:30:34 2018 (r329713) @@ -360,8 +360,8 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **d typedef struct zfs_ecksum_info { /* histograms of set and cleared bits by bit number in a 64-bit word */ - uint16_t zei_histogram_set[sizeof (uint64_t) * NBBY]; - uint16_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_set[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; /* inline arrays of bits set and cleared. */ uint64_t zei_bits_set[ZFM_MAX_INLINE]; @@ -386,7 +386,7 @@ typedef struct zfs_ecksum_info { } zfs_ecksum_info_t; static void -update_histogram(uint64_t value_arg, uint16_t *hist, uint32_t *count) +update_histogram(uint64_t value_arg, uint32_t *hist, uint32_t *count) { size_t i; size_t bits = 0; @@ -552,7 +552,7 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in if (badbuf == NULL || goodbuf == NULL) return (eip); - ASSERT3U(nui64s, <=, UINT16_MAX); + ASSERT3U(nui64s, <=, UINT32_MAX); ASSERT3U(size, ==, nui64s * sizeof (uint64_t)); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT3U(size, <=, UINT32_MAX); @@ -654,10 +654,10 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in } else { fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_BAD_SET_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_set, FM_EREPORT_PAYLOAD_ZFS_BAD_CLEARED_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_cleared, NULL); } From owner-svn-src-all@freebsd.org Wed Feb 21 14:31:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D06E2F06BB9; Wed, 21 Feb 2018 14:31:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 833EC7E233; Wed, 21 Feb 2018 14:31:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E54719C4B; Wed, 21 Feb 2018 14:31:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LEVmUX001150; Wed, 21 Feb 2018 14:31:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LEVmxp001149; Wed, 21 Feb 2018 14:31:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211431.w1LEVmxp001149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 14:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329714 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:31:49 -0000 Author: avg Date: Wed Feb 21 14:31:48 2018 New Revision: 329714 URL: https://svnweb.freebsd.org/changeset/base/329714 Log: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks illumos/illumos-gate@a6c1eb3c08094a6db69aa1dc6315bc814e82e79c https://github.com/illumos/illumos-gate/commit/a6c1eb3c08094a6db69aa1dc6315bc814e82e79c https://www.illumos.org/issues/8731 annotate_ecksum() asserts that nui64s, calculated as nui64s = size / sizeof (uint64_t), is not greater than UINT16_MAX. This restriction is needed because histograms of incorrectly set and cleared bits have 16 bit counters and if the buffer consists of too many 64-bit words, then a counter can potentially overflow producing an incorrect result. When the largest buffer size was 128KB the greatest value of nui64s was 16K, well within the limit. But now we have support for large buffers and for buffer sizes of 512KB and above the restriction is violated. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Wed Feb 21 14:30:34 2018 (r329713) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Wed Feb 21 14:31:48 2018 (r329714) @@ -360,8 +360,8 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **d typedef struct zfs_ecksum_info { /* histograms of set and cleared bits by bit number in a 64-bit word */ - uint16_t zei_histogram_set[sizeof (uint64_t) * NBBY]; - uint16_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_set[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; /* inline arrays of bits set and cleared. */ uint64_t zei_bits_set[ZFM_MAX_INLINE]; @@ -386,7 +386,7 @@ typedef struct zfs_ecksum_info { } zfs_ecksum_info_t; static void -update_histogram(uint64_t value_arg, uint16_t *hist, uint32_t *count) +update_histogram(uint64_t value_arg, uint32_t *hist, uint32_t *count) { size_t i; size_t bits = 0; @@ -552,7 +552,7 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in if (badbuf == NULL || goodbuf == NULL) return (eip); - ASSERT3U(nui64s, <=, UINT16_MAX); + ASSERT3U(nui64s, <=, UINT32_MAX); ASSERT3U(size, ==, nui64s * sizeof (uint64_t)); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT3U(size, <=, UINT32_MAX); @@ -654,10 +654,10 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in } else { fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_BAD_SET_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_set, FM_EREPORT_PAYLOAD_ZFS_BAD_CLEARED_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_cleared, NULL); } From owner-svn-src-all@freebsd.org Wed Feb 21 14:33:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F5F7F06F0C; Wed, 21 Feb 2018 14:33:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D59F47E55E; Wed, 21 Feb 2018 14:33:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D077219C8C; Wed, 21 Feb 2018 14:33:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LEX0mG002748; Wed, 21 Feb 2018 14:33:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LEX0aZ002743; Wed, 21 Feb 2018 14:33:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211433.w1LEX0aZ002743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 14:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329715 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:33:01 -0000 Author: avg Date: Wed Feb 21 14:33:00 2018 New Revision: 329715 URL: https://svnweb.freebsd.org/changeset/base/329715 Log: 8997 ztest assertion failure in zil_lwb_write_issue illumos/illumos-gate@f864f99efe57685e1762590c1a880dd16bca6da9 https://github.com/illumos/illumos-gate/commit/f864f99efe57685e1762590c1a880dd16bca6da9 https://www.illumos.org/issues/8997 When dmu_tx_assign is called from zil_lwb_write_issue, it's possible for either ERESTART or EIO to be returned. If ERESTART is returned, this will cause an assertion to fail directly in zil_lwb_write_issue, where the code assumes the return value is EIO if dmu_tx_assign returns a non-zero value. This can occur if the SPA is suspended when dmu_tx_assign is called, and most often occurs when running zloop. If EIO is returned, this can cause assertions to fail elsewhere in the ZIL code. For example, zil_commit_waiter_timeout contains the following logic: lwb_t *nlwb = zil_lwb_write_issue(zilog, lwb); ASSERT3S(lwb->lwb_state, !=, LWB_STATE_OPENED); In this case, if dmu_tx_assign returned EIO from within zil_lwb_write_issue, the lwb variable passed in will not be issued to disk. Thus, it's lwb_state field will remain LWB_STATE_OPENED and this assertion will fail. zil_commit_waiter_timeout assumes that after it calls zil_lwb_write_issue, the lwb will be issued to disk, and doesn't handle the case where this is not true; i.e. it doesn't handle the case where dmu_tx_assign returns EIO. Reviewed by: Matt Ahrens Reviewed by: Andriy Gapon Approved by: Robert Mustacchi Author: Prakash Surya Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Feb 21 14:31:48 2018 (r329714) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Feb 21 14:33:00 2018 (r329715) @@ -869,7 +869,7 @@ dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty) * decreasing performance. */ static int -dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how) +dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how) { spa_t *spa = tx->tx_pool->dp_spa; @@ -889,13 +889,13 @@ dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how) * of the failuremode setting. */ if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE && - txg_how != TXG_WAIT) + !(txg_how & TXG_WAIT)) return (SET_ERROR(EIO)); return (SET_ERROR(ERESTART)); } - if (!tx->tx_waited && + if (!tx->tx_dirty_delayed && dsl_pool_need_dirty_delay(tx->tx_pool)) { tx->tx_wait_dirty = B_TRUE; return (SET_ERROR(ERESTART)); @@ -983,41 +983,44 @@ dmu_tx_unassign(dmu_tx_t *tx) } /* - * Assign tx to a transaction group. txg_how can be one of: + * Assign tx to a transaction group; txg_how is a bitmask: * - * (1) TXG_WAIT. If the current open txg is full, waits until there's - * a new one. This should be used when you're not holding locks. - * It will only fail if we're truly out of space (or over quota). + * If TXG_WAIT is set and the currently open txg is full, this function + * will wait until there's a new txg. This should be used when no locks + * are being held. With this bit set, this function will only fail if + * we're truly out of space (or over quota). * - * (2) TXG_NOWAIT. If we can't assign into the current open txg without - * blocking, returns immediately with ERESTART. This should be used - * whenever you're holding locks. On an ERESTART error, the caller - * should drop locks, do a dmu_tx_wait(tx), and try again. + * If TXG_WAIT is *not* set and we can't assign into the currently open + * txg without blocking, this function will return immediately with + * ERESTART. This should be used whenever locks are being held. On an + * ERESTART error, the caller should drop all locks, call dmu_tx_wait(), + * and try again. * - * (3) TXG_WAITED. Like TXG_NOWAIT, but indicates that dmu_tx_wait() - * has already been called on behalf of this operation (though - * most likely on a different tx). + * If TXG_NOTHROTTLE is set, this indicates that this tx should not be + * delayed due on the ZFS Write Throttle (see comments in dsl_pool.c for + * details on the throttle). This is used by the VFS operations, after + * they have already called dmu_tx_wait() (though most likely on a + * different tx). */ int -dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) +dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how) { int err; ASSERT(tx->tx_txg == 0); - ASSERT(txg_how == TXG_WAIT || txg_how == TXG_NOWAIT || - txg_how == TXG_WAITED); + ASSERT0(txg_how & ~(TXG_WAIT | TXG_NOTHROTTLE)); ASSERT(!dsl_pool_sync_context(tx->tx_pool)); /* If we might wait, we must not hold the config lock. */ - ASSERT(txg_how != TXG_WAIT || !dsl_pool_config_held(tx->tx_pool)); + IMPLY((txg_how & TXG_WAIT), !dsl_pool_config_held(tx->tx_pool)); - if (txg_how == TXG_WAITED) - tx->tx_waited = B_TRUE; + if ((txg_how & TXG_NOTHROTTLE)) + tx->tx_dirty_delayed = B_TRUE; while ((err = dmu_tx_try_assign(tx, txg_how)) != 0) { dmu_tx_unassign(tx); - if (err != ERESTART || txg_how != TXG_WAIT) + if (err != ERESTART || !(txg_how & TXG_WAIT)) return (err); dmu_tx_wait(tx); @@ -1054,12 +1057,12 @@ dmu_tx_wait(dmu_tx_t *tx) tx->tx_wait_dirty = B_FALSE; /* - * Note: setting tx_waited only has effect if the caller - * used TX_WAIT. Otherwise they are going to destroy - * this tx and try again. The common case, zfs_write(), - * uses TX_WAIT. + * Note: setting tx_dirty_delayed only has effect if the + * caller used TX_WAIT. Otherwise they are going to + * destroy this tx and try again. The common case, + * zfs_write(), uses TX_WAIT. */ - tx->tx_waited = B_TRUE; + tx->tx_dirty_delayed = B_TRUE; } else if (spa_suspended(spa) || tx->tx_lasttried_txg == 0) { /* * If the pool is suspended we need to wait until it Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Feb 21 14:31:48 2018 (r329714) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Feb 21 14:33:00 2018 (r329715) @@ -231,11 +231,14 @@ typedef enum dmu_object_type { DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE), } dmu_object_type_t; -typedef enum txg_how { - TXG_WAIT = 1, - TXG_NOWAIT, - TXG_WAITED, -} txg_how_t; +/* + * These flags are intended to be used to specify the "txg_how" + * parameter when calling the dmu_tx_assign() function. See the comment + * above dmu_tx_assign() for more details on the meaning of these flags. + */ +#define TXG_NOWAIT (0ULL) +#define TXG_WAIT (1ULL<<0) +#define TXG_NOTHROTTLE (1ULL<<1) void byteswap_uint64_array(void *buf, size_t size); void byteswap_uint32_array(void *buf, size_t size); @@ -689,7 +692,7 @@ void dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t object); void dmu_tx_hold_sa(dmu_tx_t *tx, struct sa_handle *hdl, boolean_t may_grow); void dmu_tx_hold_sa_create(dmu_tx_t *tx, int total_size); void dmu_tx_abort(dmu_tx_t *tx); -int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how); +int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); void dmu_tx_wait(dmu_tx_t *tx); void dmu_tx_commit(dmu_tx_t *tx); void dmu_tx_mark_netfree(dmu_tx_t *tx); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h Wed Feb 21 14:31:48 2018 (r329714) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h Wed Feb 21 14:33:00 2018 (r329715) @@ -67,9 +67,6 @@ struct dmu_tx { /* placeholder for syncing context, doesn't need specific holds */ boolean_t tx_anyobj; - /* has this transaction already been delayed? */ - boolean_t tx_waited; - /* transaction is marked as being a "net free" of space */ boolean_t tx_netfree; @@ -79,6 +76,9 @@ struct dmu_tx { /* need to wait for sufficient dirty space */ boolean_t tx_wait_dirty; + /* has this transaction already been delayed? */ + boolean_t tx_dirty_delayed; + int tx_err; }; @@ -114,7 +114,7 @@ typedef struct dmu_tx_callback { * These routines are defined in dmu.h, and are called by the user. */ dmu_tx_t *dmu_tx_create(objset_t *dd); -int dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how); +int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); void dmu_tx_commit(dmu_tx_t *tx); void dmu_tx_abort(dmu_tx_t *tx); uint64_t dmu_tx_get_txg(dmu_tx_t *tx); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Feb 21 14:31:48 2018 (r329714) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Feb 21 14:33:00 2018 (r329715) @@ -135,7 +135,7 @@ * * If dmu_tx_assign() returns ERESTART and zfsvfs->z_assign is TXG_NOWAIT, * then drop all locks, call dmu_tx_wait(), and try again. On subsequent - * calls to dmu_tx_assign(), pass TXG_WAITED rather than TXG_NOWAIT, + * calls to dmu_tx_assign(), pass TXG_NOTHROTTLE in addition to TXG_NOWAIT, * to indicate that this operation has already called dmu_tx_wait(). * This will ensure that we don't retry forever, waiting a short bit * each time. @@ -160,7 +160,7 @@ * rw_enter(...); // grab any other locks you need * tx = dmu_tx_create(...); // get DMU tx * dmu_tx_hold_*(); // hold each object you might modify - * error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + * error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); * if (error) { * rw_exit(...); // drop locks * zfs_dirent_unlock(dl); // unlock directory entry @@ -1532,7 +1532,8 @@ top: dmu_tx_hold_write(tx, DMU_NEW_OBJECT, 0, acl_ids.z_aclp->z_acl_bytes); } - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, + (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); if (error == ERESTART) { @@ -1762,7 +1763,7 @@ top: */ dmu_tx_mark_netfree(tx); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); VN_RELE(vp); @@ -1999,7 +2000,7 @@ top: dmu_tx_hold_sa_create(tx, acl_ids.z_aclp->z_acl_bytes + ZFS_SA_BASE_ATTR_SIZE); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); if (error == ERESTART) { @@ -2136,7 +2137,7 @@ top: zfs_sa_upgrade_txholds(tx, zp); zfs_sa_upgrade_txholds(tx, dzp); dmu_tx_mark_netfree(tx); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { rw_exit(&zp->z_parent_lock); rw_exit(&zp->z_name_lock); @@ -3709,7 +3710,7 @@ top: zfs_sa_upgrade_txholds(tx, szp); dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { if (zl != NULL) zfs_rename_unlock(&zl); @@ -3902,7 +3903,7 @@ top: } if (fuid_dirtied) zfs_fuid_txhold(zfsvfs, tx); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); if (error == ERESTART) { @@ -4123,7 +4124,7 @@ top: dmu_tx_hold_zap(tx, dzp->z_id, TRUE, name); zfs_sa_upgrade_txholds(tx, szp); zfs_sa_upgrade_txholds(tx, dzp); - error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); if (error) { zfs_dirent_unlock(dl); if (error == ERESTART) { Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Feb 21 14:31:48 2018 (r329714) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Wed Feb 21 14:33:00 2018 (r329715) @@ -1208,22 +1208,13 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) tx = dmu_tx_create(zilog->zl_os); /* - * Since we are not going to create any new dirty data and we can even - * help with clearing the existing dirty data, we should not be subject - * to the dirty data based delays. - * We (ab)use TXG_WAITED to bypass the delay mechanism. - * One side effect from using TXG_WAITED is that dmu_tx_assign() can - * fail if the pool is suspended. Those are dramatic circumstances, - * so we return NULL to signal that the normal ZIL processing is not - * possible and txg_wait_synced() should be used to ensure that the data - * is on disk. + * Since we are not going to create any new dirty data, and we + * can even help with clearing the existing dirty data, we + * should not be subject to the dirty data based delays. We + * use TXG_NOTHROTTLE to bypass the delay mechanism. */ - error = dmu_tx_assign(tx, TXG_WAITED); - if (error != 0) { - ASSERT3S(error, ==, EIO); - dmu_tx_abort(tx); - return (NULL); - } + VERIFY0(dmu_tx_assign(tx, TXG_WAIT | TXG_NOTHROTTLE)); + dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); From owner-svn-src-all@freebsd.org Wed Feb 21 14:37:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E25F07573; Wed, 21 Feb 2018 14:37:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 090E17E86B; Wed, 21 Feb 2018 14:37:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F334E19C8F; Wed, 21 Feb 2018 14:37:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LEbnun002985; Wed, 21 Feb 2018 14:37:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LEbnWv002984; Wed, 21 Feb 2018 14:37:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211437.w1LEbnWv002984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 14:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329716 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:37:50 -0000 Author: kevans Date: Wed Feb 21 14:37:49 2018 New Revision: 329716 URL: https://svnweb.freebsd.org/changeset/base/329716 Log: lualoader: Use the key that interrupts autoboot as a menu choice This matches forth behavior. Hitting "6" when autobooting at the welcome menu will now take you directly to the "Boot Options" menu. We likely have some slight optimizations we should make, like not checking autoboot every time we open a new menu and things of this nature. Further work will go towards this end. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 14:33:00 2018 (r329715) +++ head/stand/lua/menu.lua Wed Feb 21 14:37:49 2018 (r329716) @@ -291,11 +291,13 @@ function menu.run(m) screen.defcursor() local alias_table = drawer.drawscreen(m) - menu.autoboot() + -- Might return nil, that's ok + local autoboot_key = menu.autoboot() cont = true while cont do - local key = io.getchar() + local key = autoboot_key or io.getchar() + autoboot_key = nil -- Special key behaviors if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and @@ -360,13 +362,13 @@ end function menu.autoboot() if menu.already_autoboot then - return + return nil end menu.already_autoboot = true local ab = loader.getenv("autoboot_delay") if ab ~= nil and ab:lower() == "no" then - return + return nil elseif tonumber(ab) == -1 then core.boot() end @@ -395,7 +397,7 @@ function menu.autoboot() print(" " .. " ") screen.defcursor() - return + return ch end end From owner-svn-src-all@freebsd.org Wed Feb 21 14:39:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF536F07774; Wed, 21 Feb 2018 14:39:25 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 370177EB03; Wed, 21 Feb 2018 14:39:25 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f48.google.com with SMTP id h78so2682336lfg.6; Wed, 21 Feb 2018 06:39:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=umHcsFu8mPiLYMGSZRx4q+7DzC5JC7nkfuGF5xL6vdk=; b=gdOUMACg1wjZVNCASBPsdXb3ARDyRGvnA1Gy0R6Y32n+WvLsXqPRygk7BFCILEc8xK LZqCJMEFL/0yvygFvmX/Kb+KsbyPAAN66Q7xXMZbUu5sqEpCvgxquFgGRmIbu3CXUUAG P2FuA8AdwFnLVFTakorL79AaQV40FCZpee09YJYAQmFzWz9Yj/LRXE+ms0AbqZLjPfnw yZVKroEWZ34RskZyWOzs/2T6I97aqcPAXYLEnAvsxlT817tDeBcgqM/lZEFbJrdq7NwY WiIRWy12hyqfpqZlhDgEAkSVAZjqQ/nQc6ShumogEC0IKnTXtag82YRJEppopE+VTtEd 9fgQ== X-Gm-Message-State: APf1xPBCPeC5N4XGuQgMIDpWlXqJgV4O881K5DhzFI0WQohkxFXgTHUW F1s3xdXidscqbuPRtSerC+nxNfjV X-Google-Smtp-Source: AH8x2256r87xbWsmLwWfCQErHc+w+OKbsCslo1aKbMFkdcB61wb8Y+q1gIJIqxgIg4CxKlL0EOSqBg== X-Received: by 10.46.106.15 with SMTP id f15mr2447153ljc.1.1519223957907; Wed, 21 Feb 2018 06:39:17 -0800 (PST) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com. [209.85.215.47]) by smtp.gmail.com with ESMTPSA id u65sm4388286lje.79.2018.02.21.06.39.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 06:39:17 -0800 (PST) Received: by mail-lf0-f47.google.com with SMTP id g72so2676842lfg.5; Wed, 21 Feb 2018 06:39:17 -0800 (PST) X-Received: by 10.46.4.74 with SMTP id 71mr2451586lje.51.1519223957438; Wed, 21 Feb 2018 06:39:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Wed, 21 Feb 2018 06:38:56 -0800 (PST) In-Reply-To: <201802211437.w1LEbnWv002984@repo.freebsd.org> References: <201802211437.w1LEbnWv002984@repo.freebsd.org> From: Kyle Evans Date: Wed, 21 Feb 2018 08:38:56 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329716 - head/stand/lua To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 14:39:25 -0000 On Wed, Feb 21, 2018 at 8:37 AM, Kyle Evans wrote: > Author: kevans > Date: Wed Feb 21 14:37:49 2018 > New Revision: 329716 > URL: https://svnweb.freebsd.org/changeset/base/329716 > > Log: > lualoader: Use the key that interrupts autoboot as a menu choice > > This matches forth behavior. Hitting "6" when autobooting at the welcome > menu will now take you directly to the "Boot Options" menu. > > We likely have some slight optimizations we should make, like not checking > autoboot every time we open a new menu and things of this nature. Further > work will go towards this end. > I forgot this: Reported by: idwer (IRC) From owner-svn-src-all@freebsd.org Wed Feb 21 15:07:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C54FF0A306; Wed, 21 Feb 2018 15:07:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09E3A80037; Wed, 21 Feb 2018 15:07:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3DF01A16B; Wed, 21 Feb 2018 15:07:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LF7nt5017990; Wed, 21 Feb 2018 15:07:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LF7nxu017985; Wed, 21 Feb 2018 15:07:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211507.w1LF7nxu017985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 15:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329717 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:07:50 -0000 Author: avg Date: Wed Feb 21 15:07:49 2018 New Revision: 329717 URL: https://svnweb.freebsd.org/changeset/base/329717 Log: MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue illumos/illumos-gate@f864f99efe57685e1762590c1a880dd16bca6da9 https://github.com/illumos/illumos-gate/commit/f864f99efe57685e1762590c1a880dd16bca6da9 https://www.illumos.org/issues/8997 When dmu_tx_assign is called from zil_lwb_write_issue, it's possible for either ERESTART or EIO to be returned. If ERESTART is returned, this will cause an assertion to fail directly in zil_lwb_write_issue, where the code assumes the return value is EIO if dmu_tx_assign returns a non-zero value. This can occur if the SPA is suspended when dmu_tx_assign is called, and most often occurs when running zloop. If EIO is returned, this can cause assertions to fail elsewhere in the ZIL code. For example, zil_commit_waiter_timeout contains the following logic: lwb_t *nlwb = zil_lwb_write_issue(zilog, lwb); ASSERT3S(lwb->lwb_state, !=, LWB_STATE_OPENED); In this case, if dmu_tx_assign returned EIO from within zil_lwb_write_issue, the lwb variable passed in will not be issued to disk. Thus, it's lwb_state field will remain LWB_STATE_OPENED and this assertion will fail. zil_commit_waiter_timeout assumes that after it calls zil_lwb_write_issue, the lwb will be issued to disk, and doesn't handle the case where this is not true; i.e. it doesn't handle the case where dmu_tx_assign returns EIO. Reviewed by: Matt Ahrens Reviewed by: Andriy Gapon Approved by: Robert Mustacchi Author: Prakash Surya MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Feb 21 14:37:49 2018 (r329716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Feb 21 15:07:49 2018 (r329717) @@ -858,7 +858,7 @@ dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty) * decreasing performance. */ static int -dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how) +dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how) { spa_t *spa = tx->tx_pool->dp_spa; @@ -878,13 +878,13 @@ dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how) * of the failuremode setting. */ if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE && - txg_how != TXG_WAIT) + !(txg_how & TXG_WAIT)) return (SET_ERROR(EIO)); return (SET_ERROR(ERESTART)); } - if (!tx->tx_waited && + if (!tx->tx_dirty_delayed && dsl_pool_need_dirty_delay(tx->tx_pool)) { tx->tx_wait_dirty = B_TRUE; return (SET_ERROR(ERESTART)); @@ -972,41 +972,44 @@ dmu_tx_unassign(dmu_tx_t *tx) } /* - * Assign tx to a transaction group. txg_how can be one of: + * Assign tx to a transaction group; txg_how is a bitmask: * - * (1) TXG_WAIT. If the current open txg is full, waits until there's - * a new one. This should be used when you're not holding locks. - * It will only fail if we're truly out of space (or over quota). + * If TXG_WAIT is set and the currently open txg is full, this function + * will wait until there's a new txg. This should be used when no locks + * are being held. With this bit set, this function will only fail if + * we're truly out of space (or over quota). * - * (2) TXG_NOWAIT. If we can't assign into the current open txg without - * blocking, returns immediately with ERESTART. This should be used - * whenever you're holding locks. On an ERESTART error, the caller - * should drop locks, do a dmu_tx_wait(tx), and try again. + * If TXG_WAIT is *not* set and we can't assign into the currently open + * txg without blocking, this function will return immediately with + * ERESTART. This should be used whenever locks are being held. On an + * ERESTART error, the caller should drop all locks, call dmu_tx_wait(), + * and try again. * - * (3) TXG_WAITED. Like TXG_NOWAIT, but indicates that dmu_tx_wait() - * has already been called on behalf of this operation (though - * most likely on a different tx). + * If TXG_NOTHROTTLE is set, this indicates that this tx should not be + * delayed due on the ZFS Write Throttle (see comments in dsl_pool.c for + * details on the throttle). This is used by the VFS operations, after + * they have already called dmu_tx_wait() (though most likely on a + * different tx). */ int -dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) +dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how) { int err; ASSERT(tx->tx_txg == 0); - ASSERT(txg_how == TXG_WAIT || txg_how == TXG_NOWAIT || - txg_how == TXG_WAITED); + ASSERT0(txg_how & ~(TXG_WAIT | TXG_NOTHROTTLE)); ASSERT(!dsl_pool_sync_context(tx->tx_pool)); /* If we might wait, we must not hold the config lock. */ - ASSERT(txg_how != TXG_WAIT || !dsl_pool_config_held(tx->tx_pool)); + IMPLY((txg_how & TXG_WAIT), !dsl_pool_config_held(tx->tx_pool)); - if (txg_how == TXG_WAITED) - tx->tx_waited = B_TRUE; + if ((txg_how & TXG_NOTHROTTLE)) + tx->tx_dirty_delayed = B_TRUE; while ((err = dmu_tx_try_assign(tx, txg_how)) != 0) { dmu_tx_unassign(tx); - if (err != ERESTART || txg_how != TXG_WAIT) + if (err != ERESTART || !(txg_how & TXG_WAIT)) return (err); dmu_tx_wait(tx); @@ -1043,12 +1046,12 @@ dmu_tx_wait(dmu_tx_t *tx) tx->tx_wait_dirty = B_FALSE; /* - * Note: setting tx_waited only has effect if the caller - * used TX_WAIT. Otherwise they are going to destroy - * this tx and try again. The common case, zfs_write(), - * uses TX_WAIT. + * Note: setting tx_dirty_delayed only has effect if the + * caller used TX_WAIT. Otherwise they are going to + * destroy this tx and try again. The common case, + * zfs_write(), uses TX_WAIT. */ - tx->tx_waited = B_TRUE; + tx->tx_dirty_delayed = B_TRUE; } else if (spa_suspended(spa) || tx->tx_lasttried_txg == 0) { /* * If the pool is suspended we need to wait until it Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Feb 21 14:37:49 2018 (r329716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Feb 21 15:07:49 2018 (r329717) @@ -231,11 +231,14 @@ typedef enum dmu_object_type { DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE), } dmu_object_type_t; -typedef enum txg_how { - TXG_WAIT = 1, - TXG_NOWAIT, - TXG_WAITED, -} txg_how_t; +/* + * These flags are intended to be used to specify the "txg_how" + * parameter when calling the dmu_tx_assign() function. See the comment + * above dmu_tx_assign() for more details on the meaning of these flags. + */ +#define TXG_NOWAIT (0ULL) +#define TXG_WAIT (1ULL<<0) +#define TXG_NOTHROTTLE (1ULL<<1) void byteswap_uint64_array(void *buf, size_t size); void byteswap_uint32_array(void *buf, size_t size); @@ -684,7 +687,7 @@ void dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t object); void dmu_tx_hold_sa(dmu_tx_t *tx, struct sa_handle *hdl, boolean_t may_grow); void dmu_tx_hold_sa_create(dmu_tx_t *tx, int total_size); void dmu_tx_abort(dmu_tx_t *tx); -int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how); +int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); void dmu_tx_wait(dmu_tx_t *tx); void dmu_tx_commit(dmu_tx_t *tx); void dmu_tx_mark_netfree(dmu_tx_t *tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Wed Feb 21 14:37:49 2018 (r329716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h Wed Feb 21 15:07:49 2018 (r329717) @@ -66,9 +66,6 @@ struct dmu_tx { /* placeholder for syncing context, doesn't need specific holds */ boolean_t tx_anyobj; - /* has this transaction already been delayed? */ - boolean_t tx_waited; - /* transaction is marked as being a "net free" of space */ boolean_t tx_netfree; @@ -78,6 +75,9 @@ struct dmu_tx { /* need to wait for sufficient dirty space */ boolean_t tx_wait_dirty; + /* has this transaction already been delayed? */ + boolean_t tx_dirty_delayed; + int tx_err; }; @@ -113,7 +113,7 @@ typedef struct dmu_tx_callback { * These routines are defined in dmu.h, and are called by the user. */ dmu_tx_t *dmu_tx_create(objset_t *dd); -int dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how); +int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); void dmu_tx_commit(dmu_tx_t *tx); void dmu_tx_abort(dmu_tx_t *tx); uint64_t dmu_tx_get_txg(dmu_tx_t *tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Feb 21 14:37:49 2018 (r329716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Feb 21 15:07:49 2018 (r329717) @@ -128,7 +128,7 @@ * * If dmu_tx_assign() returns ERESTART and zfsvfs->z_assign is TXG_NOWAIT, * then drop all locks, call dmu_tx_wait(), and try again. On subsequent - * calls to dmu_tx_assign(), pass TXG_WAITED rather than TXG_NOWAIT, + * calls to dmu_tx_assign(), pass TXG_NOTHROTTLE in addition to TXG_NOWAIT, * to indicate that this operation has already called dmu_tx_wait(). * This will ensure that we don't retry forever, waiting a short bit * each time. @@ -153,7 +153,7 @@ * rw_enter(...); // grab any other locks you need * tx = dmu_tx_create(...); // get DMU tx * dmu_tx_hold_*(); // hold each object you might modify - * error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); + * error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT); * if (error) { * rw_exit(...); // drop locks * zfs_dirent_unlock(dl); // unlock directory entry Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Feb 21 14:37:49 2018 (r329716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Wed Feb 21 15:07:49 2018 (r329717) @@ -1217,22 +1217,13 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) tx = dmu_tx_create(zilog->zl_os); /* - * Since we are not going to create any new dirty data and we can even - * help with clearing the existing dirty data, we should not be subject - * to the dirty data based delays. - * We (ab)use TXG_WAITED to bypass the delay mechanism. - * One side effect from using TXG_WAITED is that dmu_tx_assign() can - * fail if the pool is suspended. Those are dramatic circumstances, - * so we return NULL to signal that the normal ZIL processing is not - * possible and txg_wait_synced() should be used to ensure that the data - * is on disk. + * Since we are not going to create any new dirty data, and we + * can even help with clearing the existing dirty data, we + * should not be subject to the dirty data based delays. We + * use TXG_NOTHROTTLE to bypass the delay mechanism. */ - error = dmu_tx_assign(tx, TXG_WAITED); - if (error != 0) { - ASSERT3S(error, ==, EIO); - dmu_tx_abort(tx); - return (NULL); - } + VERIFY0(dmu_tx_assign(tx, TXG_WAIT | TXG_NOTHROTTLE)); + dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); From owner-svn-src-all@freebsd.org Wed Feb 21 15:10:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 481D4F0A6DB; Wed, 21 Feb 2018 15:10:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECE6B80310; Wed, 21 Feb 2018 15:10:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3C531A174; Wed, 21 Feb 2018 15:10:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFAXaH020447; Wed, 21 Feb 2018 15:10:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFAXWh020437; Wed, 21 Feb 2018 15:10:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211510.w1LFAXWh020437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 15:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329718 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 329718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:10:34 -0000 Author: avg Date: Wed Feb 21 15:10:33 2018 New Revision: 329718 URL: https://svnweb.freebsd.org/changeset/base/329718 Log: 8520 7198 lzc_rollback_to should support rolling back to origin illumos/illumos-gate@95643f75d23914a3e332adc9661ed51749e9858d https://github.com/illumos/illumos-gate/commit/95643f75d23914a3e332adc9661ed51749e9858d https://www.illumos.org/issues/8520 lzc_rollback_to() should support rolling back to a clone's origin. The current checks in zfs_ioc_rollback() would not allow that because the origin snapshot belongs to a different filesystem. The overly restrictive check was introduced in 7600, but it was not a regression as none of the existing tools provided a way to rollback to the origin. https://www.illumos.org/issues/7198 EINVAL is returned when a dataset does not have any snapshots, so there is nothing to roll back to. Although the code in zfs_do_rollback checks for that condition in advance, it's still possible that the snapshot(s) gets removed after the check and before the rollback sync task is executed. At the moment zfs command would crash when that happens. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Feb 21 15:07:49 2018 (r329717) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Feb 21 15:10:33 2018 (r329718) @@ -4023,17 +4023,31 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo * a new snapshot is created before this request is processed. */ err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name); - if (err == EXDEV) { - zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, - "'%s' is not the latest snapshot"), snap->zfs_name); - (void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY, + if (err != 0) { + char errbuf[1024]; + + (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), zhp->zfs_name); - return (err); - } else if (err != 0) { - (void) zfs_standard_error_fmt(zhp->zfs_hdl, errno, - dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), - zhp->zfs_name); + switch (err) { + case EEXIST: + zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, + "there is a snapshot or bookmark more recent " + "than '%s'"), snap->zfs_name); + (void) zfs_error(zhp->zfs_hdl, EZFS_EXISTS, errbuf); + break; + case ESRCH: + zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, + "'%s' is not found among snapshots of '%s'"), + snap->zfs_name, zhp->zfs_name); + (void) zfs_error(zhp->zfs_hdl, EZFS_NOENT, errbuf); + break; + case EINVAL: + (void) zfs_error(zhp->zfs_hdl, EZFS_BADTYPE, errbuf); + break; + default: + (void) zfs_standard_error(zhp->zfs_hdl, err, errbuf); + } return (err); } From owner-svn-src-all@freebsd.org Wed Feb 21 15:10:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CDC2F0A6D9; Wed, 21 Feb 2018 15:10:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA8DE8030D; Wed, 21 Feb 2018 15:10:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C59091A172; Wed, 21 Feb 2018 15:10:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFAXOv020324; Wed, 21 Feb 2018 15:10:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFAXq3020204; Wed, 21 Feb 2018 15:10:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211510.w1LFAXq3020204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 15:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329718 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 329718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:10:34 -0000 Author: avg Date: Wed Feb 21 15:10:33 2018 New Revision: 329718 URL: https://svnweb.freebsd.org/changeset/base/329718 Log: 8520 7198 lzc_rollback_to should support rolling back to origin illumos/illumos-gate@95643f75d23914a3e332adc9661ed51749e9858d https://github.com/illumos/illumos-gate/commit/95643f75d23914a3e332adc9661ed51749e9858d https://www.illumos.org/issues/8520 lzc_rollback_to() should support rolling back to a clone's origin. The current checks in zfs_ioc_rollback() would not allow that because the origin snapshot belongs to a different filesystem. The overly restrictive check was introduced in 7600, but it was not a regression as none of the existing tools provided a way to rollback to the origin. https://www.illumos.org/issues/7198 EINVAL is returned when a dataset does not have any snapshots, so there is nothing to roll back to. Although the code in zfs_do_rollback checks for that condition in advance, it's still possible that the snapshot(s) gets removed after the check and before the rollback sync task is executed. At the moment zfs command would crash when that happens. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Feb 21 15:07:49 2018 (r329717) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Feb 21 15:10:33 2018 (r329718) @@ -2539,7 +2539,7 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) /* must have a most recent snapshot */ if (dsl_dataset_phys(ds)->ds_prev_snap_txg < TXG_INITIAL) { dsl_dataset_rele(ds, FTAG); - return (SET_ERROR(EINVAL)); + return (SET_ERROR(ESRCH)); } /* @@ -2559,11 +2559,46 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) * the latest snapshot is it. */ if (ddra->ddra_tosnap != NULL) { - char namebuf[ZFS_MAX_DATASET_NAME_LEN]; + dsl_dataset_t *snapds; - dsl_dataset_name(ds->ds_prev, namebuf); - if (strcmp(namebuf, ddra->ddra_tosnap) != 0) - return (SET_ERROR(EXDEV)); + /* Check if the target snapshot exists at all. */ + error = dsl_dataset_hold(dp, ddra->ddra_tosnap, FTAG, &snapds); + if (error != 0) { + /* + * ESRCH is used to signal that the target snapshot does + * not exist, while ENOENT is used to report that + * the rolled back dataset does not exist. + * ESRCH is also used to cover other cases where the + * target snapshot is not related to the dataset being + * rolled back such as being in a different pool. + */ + if (error == ENOENT || error == EXDEV) + error = SET_ERROR(ESRCH); + dsl_dataset_rele(ds, FTAG); + return (error); + } + ASSERT(snapds->ds_is_snapshot); + + /* Check if the snapshot is the latest snapshot indeed. */ + if (snapds != ds->ds_prev) { + /* + * Distinguish between the case where the only problem + * is intervening snapshots (EEXIST) vs the snapshot + * not being a valid target for rollback (ESRCH). + */ + if (snapds->ds_dir == ds->ds_dir || + (dsl_dir_is_clone(ds->ds_dir) && + dsl_dir_phys(ds->ds_dir)->dd_origin_obj == + snapds->ds_object)) { + error = SET_ERROR(EEXIST); + } else { + error = SET_ERROR(ESRCH); + } + dsl_dataset_rele(snapds, FTAG); + dsl_dataset_rele(ds, FTAG); + return (error); + } + dsl_dataset_rele(snapds, FTAG); } /* must not have any bookmarks after the most recent snapshot */ @@ -2572,8 +2607,10 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) nvlist_t *bookmarks = fnvlist_alloc(); error = dsl_get_bookmarks_impl(ds, proprequest, bookmarks); fnvlist_free(proprequest); - if (error != 0) + if (error != 0) { + dsl_dataset_rele(ds, FTAG); return (error); + } for (nvpair_t *pair = nvlist_next_nvpair(bookmarks, NULL); pair != NULL; pair = nvlist_next_nvpair(bookmarks, pair)) { nvlist_t *valuenv = Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Feb 21 15:07:49 2018 (r329717) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Feb 21 15:10:33 2018 (r329718) @@ -3701,11 +3701,14 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, (void) nvlist_lookup_string(innvl, "target", &target); if (target != NULL) { - int fslen = strlen(fsname); + const char *cp = strchr(target, '@'); - if (strncmp(fsname, target, fslen) != 0) - return (SET_ERROR(EINVAL)); - if (target[fslen] != '@') + /* + * The snap name must contain an @, and the part after it must + * contain only valid characters. + */ + if (cp == NULL || + zfs_component_namecheck(cp + 1, NULL, NULL) != 0) return (SET_ERROR(EINVAL)); } From owner-svn-src-all@freebsd.org Wed Feb 21 15:12:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69353F0AAAB; Wed, 21 Feb 2018 15:12:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08889807E6; Wed, 21 Feb 2018 15:12:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 038861A2FC; Wed, 21 Feb 2018 15:12:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFCEiK023001; Wed, 21 Feb 2018 15:12:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFCEc6022998; Wed, 21 Feb 2018 15:12:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802211512.w1LFCEc6022998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Feb 2018 15:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329719 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:12:15 -0000 Author: avg Date: Wed Feb 21 15:12:14 2018 New Revision: 329719 URL: https://svnweb.freebsd.org/changeset/base/329719 Log: MFV r329718: 8520 7198 lzc_rollback_to should support rolling back to origin illumos/illumos-gate@95643f75d23914a3e332adc9661ed51749e9858d https://github.com/illumos/illumos-gate/commit/95643f75d23914a3e332adc9661ed51749e9858d https://www.illumos.org/issues/8520 lzc_rollback_to() should support rolling back to a clone's origin. The current checks in zfs_ioc_rollback() would not allow that because the origin snapshot belongs to a different filesystem. The overly restrictive check was introduced in 7600, but it was not a regression as none of the existing tools provided a way to rollback to the origin. https://www.illumos.org/issues/7198 EINVAL is returned when a dataset does not have any snapshots, so there is nothing to roll back to. Although the code in zfs_do_rollback checks for that condition in advance, it's still possible that the snapshot(s) gets removed after the check and before the rollback sync task is executed. At the moment zfs command would crash when that happens. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Andriy Gapon MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Feb 21 15:10:33 2018 (r329718) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Feb 21 15:12:14 2018 (r329719) @@ -4054,17 +4054,31 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo * a new snapshot is created before this request is processed. */ err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name); - if (err == EXDEV) { - zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, - "'%s' is not the latest snapshot"), snap->zfs_name); - (void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY, + if (err != 0) { + char errbuf[1024]; + + (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), zhp->zfs_name); - return (err); - } else if (err != 0) { - (void) zfs_standard_error_fmt(zhp->zfs_hdl, errno, - dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), - zhp->zfs_name); + switch (err) { + case EEXIST: + zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, + "there is a snapshot or bookmark more recent " + "than '%s'"), snap->zfs_name); + (void) zfs_error(zhp->zfs_hdl, EZFS_EXISTS, errbuf); + break; + case ESRCH: + zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN, + "'%s' is not found among snapshots of '%s'"), + snap->zfs_name, zhp->zfs_name); + (void) zfs_error(zhp->zfs_hdl, EZFS_NOENT, errbuf); + break; + case EINVAL: + (void) zfs_error(zhp->zfs_hdl, EZFS_BADTYPE, errbuf); + break; + default: + (void) zfs_standard_error(zhp->zfs_hdl, err, errbuf); + } return (err); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Feb 21 15:10:33 2018 (r329718) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Feb 21 15:12:14 2018 (r329719) @@ -2553,7 +2553,7 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) /* must have a most recent snapshot */ if (dsl_dataset_phys(ds)->ds_prev_snap_txg < TXG_INITIAL) { dsl_dataset_rele(ds, FTAG); - return (SET_ERROR(EINVAL)); + return (SET_ERROR(ESRCH)); } /* @@ -2573,11 +2573,46 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) * the latest snapshot is it. */ if (ddra->ddra_tosnap != NULL) { - char namebuf[ZFS_MAX_DATASET_NAME_LEN]; + dsl_dataset_t *snapds; - dsl_dataset_name(ds->ds_prev, namebuf); - if (strcmp(namebuf, ddra->ddra_tosnap) != 0) - return (SET_ERROR(EXDEV)); + /* Check if the target snapshot exists at all. */ + error = dsl_dataset_hold(dp, ddra->ddra_tosnap, FTAG, &snapds); + if (error != 0) { + /* + * ESRCH is used to signal that the target snapshot does + * not exist, while ENOENT is used to report that + * the rolled back dataset does not exist. + * ESRCH is also used to cover other cases where the + * target snapshot is not related to the dataset being + * rolled back such as being in a different pool. + */ + if (error == ENOENT || error == EXDEV) + error = SET_ERROR(ESRCH); + dsl_dataset_rele(ds, FTAG); + return (error); + } + ASSERT(snapds->ds_is_snapshot); + + /* Check if the snapshot is the latest snapshot indeed. */ + if (snapds != ds->ds_prev) { + /* + * Distinguish between the case where the only problem + * is intervening snapshots (EEXIST) vs the snapshot + * not being a valid target for rollback (ESRCH). + */ + if (snapds->ds_dir == ds->ds_dir || + (dsl_dir_is_clone(ds->ds_dir) && + dsl_dir_phys(ds->ds_dir)->dd_origin_obj == + snapds->ds_object)) { + error = SET_ERROR(EEXIST); + } else { + error = SET_ERROR(ESRCH); + } + dsl_dataset_rele(snapds, FTAG); + dsl_dataset_rele(ds, FTAG); + return (error); + } + dsl_dataset_rele(snapds, FTAG); } /* must not have any bookmarks after the most recent snapshot */ @@ -2586,8 +2621,10 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) nvlist_t *bookmarks = fnvlist_alloc(); error = dsl_get_bookmarks_impl(ds, proprequest, bookmarks); fnvlist_free(proprequest); - if (error != 0) + if (error != 0) { + dsl_dataset_rele(ds, FTAG); return (error); + } for (nvpair_t *pair = nvlist_next_nvpair(bookmarks, NULL); pair != NULL; pair = nvlist_next_nvpair(bookmarks, pair)) { nvlist_t *valuenv = Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Feb 21 15:10:33 2018 (r329718) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Feb 21 15:12:14 2018 (r329719) @@ -3852,11 +3852,14 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, (void) nvlist_lookup_string(innvl, "target", &target); if (target != NULL) { - int fslen = strlen(fsname); + const char *cp = strchr(target, '@'); - if (strncmp(fsname, target, fslen) != 0) - return (SET_ERROR(EINVAL)); - if (target[fslen] != '@') + /* + * The snap name must contain an @, and the part after it must + * contain only valid characters. + */ + if (cp == NULL || + zfs_component_namecheck(cp + 1, NULL, NULL) != 0) return (SET_ERROR(EINVAL)); } From owner-svn-src-all@freebsd.org Wed Feb 21 15:15:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CE1AF0AFB7; Wed, 21 Feb 2018 15:15:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8B880B92; Wed, 21 Feb 2018 15:15:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A2211A316; Wed, 21 Feb 2018 15:15:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFFWNb023165; Wed, 21 Feb 2018 15:15:32 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFFW4h023164; Wed, 21 Feb 2018 15:15:32 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802211515.w1LFFW4h023164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Wed, 21 Feb 2018 15:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329720 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 329720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:15:32 -0000 Author: nwhitehorn Date: Wed Feb 21 15:15:31 2018 New Revision: 329720 URL: https://svnweb.freebsd.org/changeset/base/329720 Log: Add definitions for the new Radix MMU mode on POWER9+ CPUs. Modified: head/sys/powerpc/include/pte.h Modified: head/sys/powerpc/include/pte.h ============================================================================== --- head/sys/powerpc/include/pte.h Wed Feb 21 15:12:14 2018 (r329719) +++ head/sys/powerpc/include/pte.h Wed Feb 21 15:15:31 2018 (r329720) @@ -125,6 +125,37 @@ struct lpteg { #define LPTE_RW LPTE_BW #define LPTE_RO LPTE_BR +/* POWER ISA 3.0 Radix Table Definitions */ +#define RPTE_VALID 0x8000000000000000ULL +#define RPTE_LEAF 0x4000000000000000ULL /* is a PTE: always 1 */ +#define RPTE_SW0 0x2000000000000000ULL +#define RPTE_RPN_MASK 0x00FFFFFFFFFFF000ULL +#define RPTE_RPN_SHIFT 12 +#define RPTE_SW1 0x0000000000000800ULL +#define RPTE_SW2 0x0000000000000400ULL +#define RPTE_SW3 0x0000000000000200ULL +#define RPTE_R 0x0000000000000100ULL +#define RPTE_C 0x0000000000000080ULL + +#define RPTE_ATTR_MASK 0x0000000000000030ULL +#define RPTE_ATTR_MEM 0x0000000000000000ULL /* PTE M */ +#define RPTE_ATTR_SAO 0x0000000000000010ULL /* PTE WIM */ +#define RPTE_ATTR_GUARDEDIO 0x0000000000000020ULL /* PTE IMG */ +#define RPTE_ATTR_UNGUARDEDIO 0x0000000000000030ULL /* PTE IM */ + +#define RPTE_EAA_MASK 0x000000000000000FULL +#define RPTE_EAA_P 0x0000000000000008ULL /* Supervisor only */ +#define RPTE_EAA_R 0x0000000000000004ULL /* Read allowed */ +#define RPTE_EAA_W 0x0000000000000002ULL /* Write (+read) */ +#define RPTE_EAA_X 0x0000000000000001ULL /* Execute allowed */ + +#define RPDE_VALID RPTE_VALID +#define RPDE_LEAF RPTE_LEAF /* is a PTE: always 0 */ +#define RPDE_NLB_MASK 0x0FFFFFFFFFFFFF00ULL +#define RPDE_NLB_SHIFT 8 +#define RPDE_NLS_MASK 0x000000000000001FULL + + #ifndef LOCORE typedef struct pte pte_t; typedef struct lpte lpte_t; From owner-svn-src-all@freebsd.org Wed Feb 21 15:15:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EAD2F0B0A8; Wed, 21 Feb 2018 15:15:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E10BE80CD6; Wed, 21 Feb 2018 15:15:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBFC91A318; Wed, 21 Feb 2018 15:15:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFFwYC023229; Wed, 21 Feb 2018 15:15:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFFwTU023228; Wed, 21 Feb 2018 15:15:58 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802211515.w1LFFwTU023228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Wed, 21 Feb 2018 15:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329721 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 329721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:15:59 -0000 Author: nwhitehorn Date: Wed Feb 21 15:15:58 2018 New Revision: 329721 URL: https://svnweb.freebsd.org/changeset/base/329721 Log: Add definition for the PowerPC A2. Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Wed Feb 21 15:15:31 2018 (r329720) +++ head/sys/powerpc/include/spr.h Wed Feb 21 15:15:58 2018 (r329721) @@ -170,6 +170,7 @@ #define IBMPOWER3PLUS 0x0041 #define IBM970MP 0x0044 #define IBM970GX 0x0045 +#define IBMPOWERPCA2 0x0049 #define IBMPOWER7PLUS 0x004a #define IBMPOWER8E 0x004b #define IBMPOWER8 0x004d From owner-svn-src-all@freebsd.org Wed Feb 21 15:18:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AFDAF0B4BD; Wed, 21 Feb 2018 15:18:24 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id A23448105D; Wed, 21 Feb 2018 15:18:23 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:5c38:d7dc:2091:57b5] (unknown [IPv6:2001:630:212:2a8:5c38:d7dc:2091:57b5]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9582B4EBEA; Wed, 21 Feb 2018 15:11:14 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329612 - in head/sys: kern sys From: Andrew Turner In-Reply-To: <201802200006.w1K067ZL032311@repo.freebsd.org> Date: Wed, 21 Feb 2018 15:11:13 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201802200006.w1K067ZL032311@repo.freebsd.org> To: Jeff Roberson X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:18:24 -0000 > On 20 Feb 2018, at 00:06, Jeff Roberson wrote: >=20 > Author: jeff > Date: Tue Feb 20 00:06:07 2018 > New Revision: 329612 > URL: https://svnweb.freebsd.org/changeset/base/329612 >=20 > Log: > Further parallelize the buffer cache. >=20 > Provide multiple clean queues partitioned into 'domains'. Each = domain manages > its own bufspace and has its own bufspace daemon. Each domain has a = set of > subqueues indexed by the current cpuid to reduce lock contention on = the cleanq. >=20 > Refine the sleep/wakeup around the bufspace daemon to use atomics as = much as > possible. >=20 > Add a B_REUSE flag that is used to requeue bufs during the scan to = approximate > LRU rather than locking the queue on every use of a frequently = accessed buf. >=20 > Implement bufspace_reserve with only atomic_fetchadd to avoid loop = restarts. >=20 > Reviewed by: markj > Tested by: pho > Sponsored by: Netflix, Dell/EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14274 I=E2=80=99m seeing the following panic on FreeBSD/arm64 after this = change. Andrew panic: bq_remove: Remove buffer 0xffff00004082f260 from wrong queue. cpuid =3D 4 time =3D 1519088201 KDB: stack backtrace: db_trace_self() at db_trace_self_wrapper+0x28 pc =3D 0xffff00000062fee4 lr =3D 0xffff0000000c0450 sp =3D 0xffff000040364480 fp =3D 0xffff000040364690 db_trace_self_wrapper() at vpanic+0x184 pc =3D 0xffff0000000c0450 lr =3D 0xffff000000354ce8 sp =3D 0xffff0000403646a0 fp =3D 0xffff000040364720 vpanic() at kassert_panic+0x158 pc =3D 0xffff000000354ce8 lr =3D 0xffff000000354b60 sp =3D 0xffff000040364730 fp =3D 0xffff0000403647f0 kassert_panic() at bq_remove+0x178 pc =3D 0xffff000000354b60 lr =3D 0xffff0000003f7014 sp =3D 0xffff000040364800 fp =3D 0xffff000040364810 bq_remove() at buf_recycle+0x100 pc =3D 0xffff0000003f7014 lr =3D 0xffff0000003fca80 sp =3D 0xffff000040364820 fp =3D 0xffff000040364880 buf_recycle() at bufspace_daemon+0xb4 pc =3D 0xffff0000003fca80 lr =3D 0xffff0000003fd31c sp =3D 0xffff000040364890 fp =3D 0xffff000040364910 bufspace_daemon() at fork_exit+0x7c pc =3D 0xffff0000003fd31c lr =3D 0xffff000000318388 sp =3D 0xffff000040364920 fp =3D 0xffff000040364950 fork_exit() at fork_trampoline+0x10 pc =3D 0xffff000000318388 lr =3D 0xffff000000649ec4 sp =3D 0xffff000040364960 fp =3D 0x0000000000000000 KDB: enter: panic= From owner-svn-src-all@freebsd.org Wed Feb 21 15:51:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91177F0F443; Wed, 21 Feb 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43F66828F9; Wed, 21 Feb 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F00F1A958; Wed, 21 Feb 2018 15:51:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFpnZe042315; Wed, 21 Feb 2018 15:51:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFpn57042314; Wed, 21 Feb 2018 15:51:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802211551.w1LFpn57042314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Feb 2018 15:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329722 - head/cddl/usr.sbin/zdb X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/usr.sbin/zdb X-SVN-Commit-Revision: 329722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:51:49 -0000 Author: asomers Date: Wed Feb 21 15:51:48 2018 New Revision: 329722 URL: https://svnweb.freebsd.org/changeset/base/329722 Log: zdb: raise WARNS from 0 to 2 This has only been possible since r329694 and r329508 MFC after: 3 weeks X-MFC-With: 329694 X-MFC-With: 329508 Sponsored by: Spectra Logic Modified: head/cddl/usr.sbin/zdb/Makefile Modified: head/cddl/usr.sbin/zdb/Makefile ============================================================================== --- head/cddl/usr.sbin/zdb/Makefile Wed Feb 21 15:15:58 2018 (r329721) +++ head/cddl/usr.sbin/zdb/Makefile Wed Feb 21 15:51:48 2018 (r329722) @@ -6,7 +6,7 @@ PROG= zdb MAN= zdb.8 SRCS= zdb.c zdb_il.c -WARNS?= 0 +WARNS?= 2 CSTD= c99 CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris From owner-svn-src-all@freebsd.org Wed Feb 21 15:54:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE95FF0FA9D; Wed, 21 Feb 2018 15:54:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 715F682CB9; Wed, 21 Feb 2018 15:54:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 685301A98A; Wed, 21 Feb 2018 15:54:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFsNZC043129; Wed, 21 Feb 2018 15:54:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFsN3m043128; Wed, 21 Feb 2018 15:54:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802211554.w1LFsN3m043128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Feb 2018 15:54:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329723 - head/usr.bin/ministat X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/ministat X-SVN-Commit-Revision: 329723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:54:23 -0000 Author: emaste Date: Wed Feb 21 15:54:23 2018 New Revision: 329723 URL: https://svnweb.freebsd.org/changeset/base/329723 Log: ministat: disallow negative variance / nan Stddev With all values identical it was possible for Var() to return a negative value due to limited floating point precision, resulting in "nan" reported as Stddev. Variance cannot actually be negative, so just return 0. We can later investigate alternate algorithms for calculating variance to reduce the effect of catastrophic cancellation here. Reported by: Arshan Khanifar Approved by: phk Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/ministat/ministat.c Modified: head/usr.bin/ministat/ministat.c ============================================================================== --- head/usr.bin/ministat/ministat.c Wed Feb 21 15:51:48 2018 (r329722) +++ head/usr.bin/ministat/ministat.c Wed Feb 21 15:54:23 2018 (r329723) @@ -208,6 +208,12 @@ static double Var(struct dataset *ds) { + /* + * Due to limited precision it is possible that sy^2/n > syy, + * but variance cannot actually be negative. + */ + if (ds->syy <= ds->sy * ds->sy / ds->n) + return (0); return (ds->syy - ds->sy * ds->sy / ds->n) / (ds->n - 1.0); } From owner-svn-src-all@freebsd.org Wed Feb 21 15:57:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 818FFF0FFCD; Wed, 21 Feb 2018 15:57:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E71682F53; Wed, 21 Feb 2018 15:57:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04BD31A992; Wed, 21 Feb 2018 15:57:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFvOiU043304; Wed, 21 Feb 2018 15:57:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFvOhQ043300; Wed, 21 Feb 2018 15:57:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201802211557.w1LFvOhQ043300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 21 Feb 2018 15:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329724 - head/libexec/getty X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/getty X-SVN-Commit-Revision: 329724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:57:25 -0000 Author: trasz Date: Wed Feb 21 15:57:24 2018 New Revision: 329724 URL: https://svnweb.freebsd.org/changeset/base/329724 Log: Build getty(8) with WARNS=6. Reviewed by: imp@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14197 Modified: head/libexec/getty/Makefile head/libexec/getty/chat.c head/libexec/getty/main.c head/libexec/getty/subr.c Modified: head/libexec/getty/Makefile ============================================================================== --- head/libexec/getty/Makefile Wed Feb 21 15:54:23 2018 (r329723) +++ head/libexec/getty/Makefile Wed Feb 21 15:57:24 2018 (r329724) @@ -6,7 +6,7 @@ SRCS= main.c init.c subr.c chat.c LIBADD= util MAN= gettytab.5 ttys.5 getty.8 -WARNS?= 1 +WARNS?= 6 WFORMAT=0 .include Modified: head/libexec/getty/chat.c ============================================================================== --- head/libexec/getty/chat.c Wed Feb 21 15:54:23 2018 (r329723) +++ head/libexec/getty/chat.c Wed Feb 21 15:57:24 2018 (r329724) @@ -62,7 +62,7 @@ static int chat_unalarm(void); static int getdigit(unsigned char **, int, int); static char **read_chat(char **); static char *cleanchr(char **, unsigned char); -static char *cleanstr(const unsigned char *, int); +static const char *cleanstr(const unsigned char *, int); static const char *result(int); static int chat_expect(const char *); static int chat_send(char const *); @@ -270,7 +270,7 @@ cleanchr(char **buf, unsigned char ch) * clean a string for display (ctrl/meta characters) */ -static char * +static const char * cleanstr(const unsigned char *s, int l) { static unsigned char * tmp = NULL; @@ -281,7 +281,7 @@ cleanstr(const unsigned char *s, int l) if (tmp == NULL) { tmplen = 0; - return (char *)"(mem alloc error)"; + return "(mem alloc error)"; } else { int i = 0; char * p = tmp; Modified: head/libexec/getty/main.c ============================================================================== --- head/libexec/getty/main.c Wed Feb 21 15:54:23 2018 (r329723) +++ head/libexec/getty/main.c Wed Feb 21 15:57:24 2018 (r329724) @@ -252,14 +252,15 @@ main(int argc, char *argv[]) } if (AC) { - int i, rfds; + fd_set rfds; struct timeval to; + int i; - rfds = 1 << 0; /* FD_SET */ + FD_ZERO(&rfds); + FD_SET(0, &rfds); to.tv_sec = RT; to.tv_usec = 0; - i = select(32, (fd_set*)&rfds, (fd_set*)NULL, - (fd_set*)NULL, RT ? &to : NULL); + i = select(32, &rfds, NULL, NULL, RT ? &to : NULL); if (i < 0) { syslog(LOG_ERR, "select %s: %m", ttyn); } else if (i == 0) { @@ -708,7 +709,7 @@ prompt(void) static char * get_line(int fd) { - int i = 0; + size_t i = 0; static char linebuf[512]; /* Modified: head/libexec/getty/subr.c ============================================================================== --- head/libexec/getty/subr.c Wed Feb 21 15:54:23 2018 (r329723) +++ head/libexec/getty/subr.c Wed Feb 21 15:57:24 2018 (r329724) @@ -68,12 +68,13 @@ gettable(const char *name, char *buf) long n; int l; char *p; - char *msg = NULL; - const char *dba[2]; + static char path_gettytab[PATH_MAX]; + char *dba[2]; static int firsttime = 1; - dba[0] = _PATH_GETTYTAB; + strlcpy(path_gettytab, _PATH_GETTYTAB, sizeof(path_gettytab)); + dba[0] = path_gettytab; dba[1] = NULL; if (firsttime) { @@ -101,27 +102,23 @@ gettable(const char *name, char *buf) firsttime = 0; } - switch (cgetent(&buf, (char **)dba, name)) { + switch (cgetent(&buf, dba, name)) { case 1: - msg = "%s: couldn't resolve 'tc=' in gettytab '%s'"; + syslog(LOG_ERR, "getty: couldn't resolve 'tc=' in gettytab '%s'", name); + return; case 0: break; case -1: - msg = "%s: unknown gettytab entry '%s'"; - break; + syslog(LOG_ERR, "getty: unknown gettytab entry '%s'", name); + return; case -2: - msg = "%s: retrieving gettytab entry '%s': %m"; - break; + syslog(LOG_ERR, "getty: retrieving gettytab entry '%s': %m", name); + return; case -3: - msg = "%s: recursive 'tc=' reference gettytab entry '%s'"; - break; + syslog(LOG_ERR, "getty: recursive 'tc=' reference gettytab entry '%s'", name); + return; default: - msg = "%s: unexpected cgetent() error for entry '%s'"; - break; - } - - if (msg != NULL) { - syslog(LOG_ERR, msg, "getty", name); + syslog(LOG_ERR, "getty: unexpected cgetent() error for entry '%s'", name); return; } From owner-svn-src-all@freebsd.org Wed Feb 21 15:57:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6C6EF10032; Wed, 21 Feb 2018 15:57:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40DCE8305F; Wed, 21 Feb 2018 15:57:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BCAC1A993; Wed, 21 Feb 2018 15:57:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFvbs5043364; Wed, 21 Feb 2018 15:57:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFvajr043355; Wed, 21 Feb 2018 15:57:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802211557.w1LFvajr043355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Feb 2018 15:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329725 - in head/stand: . common efi/libefi efi/loader i386/loader sparc64/loader userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . common efi/libefi efi/loader i386/loader sparc64/loader userboot/userboot X-SVN-Commit-Revision: 329725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:57:38 -0000 Author: imp Date: Wed Feb 21 15:57:36 2018 New Revision: 329725 URL: https://svnweb.freebsd.org/changeset/base/329725 Log: Consolidate three copies of ZFS commands into a central location. There's no reason to have multiple copies of lszfs and reloadbe. Consolidate them into one location. Also ldi_get_size is the same everywhere (except sparc64). Make it the same everywhere as the common definition is more general and will work on spar64. Added: head/stand/common/zfs_cmd.c (contents, props changed) Modified: head/stand/efi/libefi/efizfs.c head/stand/efi/loader/Makefile head/stand/efi/loader/main.c head/stand/i386/loader/main.c head/stand/loader.mk head/stand/sparc64/loader/Makefile head/stand/sparc64/loader/main.c head/stand/userboot/userboot/main.c Added: head/stand/common/zfs_cmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/common/zfs_cmd.c Wed Feb 21 15:57:36 2018 (r329725) @@ -0,0 +1,108 @@ +/*- + * Copyright (c) 2018 Warner Losh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * MD bootstrap main() and assorted miscellaneous + * commands. + */ + +#include +#include +#include +#include + +#include "bootstrap.h" + +#ifdef LOADER_ZFS_SUPPORT +#include "../zfs/libzfs.h" +#endif + +COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", + command_lszfs); + +static int +command_lszfs(int argc, char *argv[]) +{ + int err; + + if (argc != 2) { + command_errmsg = "a single dataset must be supplied"; + return (CMD_ERROR); + } + + err = zfs_list(argv[1]); + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + return (CMD_OK); +} + +COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", + command_reloadbe); + +static int +command_reloadbe(int argc, char *argv[]) +{ + int err; + char *root; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + + if (argc == 2) { + err = zfs_bootenv(argv[1]); + } else { + root = getenv("zfs_be_root"); + if (root == NULL) { + /* There does not appear to be a ZFS pool here, exit without error */ + return (CMD_OK); + } + err = zfs_bootenv(root); + } + + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + + return (CMD_OK); +} + +uint64_t +ldi_get_size(void *priv) +{ + int fd = (uintptr_t) priv; + uint64_t size; + + ioctl(fd, DIOCGMEDIASIZE, &size); + return (size); +} Modified: head/stand/efi/libefi/efizfs.c ============================================================================== --- head/stand/efi/libefi/efizfs.c Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/efi/libefi/efizfs.c Wed Feb 21 15:57:36 2018 (r329725) @@ -109,14 +109,4 @@ efi_zfs_probe(void) } } } - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); -} #endif Modified: head/stand/efi/loader/Makefile ============================================================================== --- head/stand/efi/loader/Makefile Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/efi/loader/Makefile Wed Feb 21 15:57:36 2018 (r329725) @@ -28,6 +28,7 @@ SRCS= autoload.c \ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT +HAVE_ZFS= yes .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/efi/loader/main.c Wed Feb 21 15:57:36 2018 (r329725) @@ -747,61 +747,6 @@ command_mode(int argc, char *argv[]) return (CMD_OK); } -#ifdef EFI_ZFS_BOOT -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} -#endif - #ifdef LOADER_FDT_SUPPORT extern int command_fdt_internal(int argc, char *argv[]); Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/i386/loader/main.c Wed Feb 21 15:57:36 2018 (r329725) @@ -374,63 +374,6 @@ command_heap(int argc, char *argv[]) return(CMD_OK); } -#ifdef LOADER_ZFS_SUPPORT -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - /* There does not appear to be a ZFS pool here, exit without error */ - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} -#endif - /* ISA bus access functions for PnP. */ static int isa_inb(int port) @@ -463,15 +406,5 @@ i386_zfs_probe(void) sprintf(devname, "disk%d:", unit); zfs_probe_dev(devname, NULL); } -} - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); } #endif Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/loader.mk Wed Feb 21 15:57:36 2018 (r329725) @@ -130,7 +130,8 @@ CFLAGS+= -DLOADER_MBR_SUPPORT CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs -.if ${MACHINE} == "amd64" +SRCS+= zfs_cmd.c +.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 # Have to override to use 32-bit version of zfs library... # kinda lame to select that there XXX LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a Modified: head/stand/sparc64/loader/Makefile ============================================================================== --- head/stand/sparc64/loader/Makefile Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/sparc64/loader/Makefile Wed Feb 21 15:57:36 2018 (r329725) @@ -19,6 +19,10 @@ NEWVERSWHAT?= "bootstrap loader" sparc64 VERSION_FILE= ${.CURDIR}/../loader/version INSTALLFLAGS= -b +.if ${MK_ZFS} != "no" +HAVE_ZFS= yes +.endif + # Architecture-specific loader code .PATH: ${BOOTSRC}/sparc64/loader SRCS= locore.S main.c vers.c Modified: head/stand/sparc64/loader/main.c ============================================================================== --- head/stand/sparc64/loader/main.c Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/sparc64/loader/main.c Wed Feb 21 15:57:36 2018 (r329725) @@ -735,15 +735,6 @@ tlb_init_sun4u(void) #ifdef LOADER_ZFS_SUPPORT -/* Set by sparc64_zfs_probe to provide partition size. */ -static size_t part_size; - -uint64_t -ldi_get_size(void *priv __unused) -{ - return ((uint64_t)part_size); -} - static void sparc64_zfs_probe(void) { @@ -799,7 +790,6 @@ sparc64_zfs_probe(void) if (part == 2 || vtoc.part[part].tag != VTOC_TAG_FREEBSD_ZFS) continue; - part_size = vtoc.map[part].nblks; (void)sprintf(devname, "%s:%c", alias, part + 'a'); /* Get the GUID of the ZFS pool on the boot device. */ if (strcmp(devname, bootpath) == 0) @@ -948,7 +938,7 @@ static const char *const page_sizes[] = { static void pmap_print_tte_sun4u(tte_t tag, tte_t tte) -{ + printf("%s %s ", page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], Modified: head/stand/userboot/userboot/main.c ============================================================================== --- head/stand/userboot/userboot/main.c Wed Feb 21 15:57:24 2018 (r329724) +++ head/stand/userboot/userboot/main.c Wed Feb 21 15:57:36 2018 (r329725) @@ -218,70 +218,7 @@ userboot_zfs_probe(void) userboot_zfs_found = 1; } } - -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "a single dataset must be supplied"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); -} -#endif /* USERBOOT_ZFS_SUPPORT */ +#endif COMMAND_SET(quit, "quit", "exit the loader", command_quit); From owner-svn-src-all@freebsd.org Wed Feb 21 15:58:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 629D2F1015D; Wed, 21 Feb 2018 15:58:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03228831AF; Wed, 21 Feb 2018 15:58:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F25231A996; Wed, 21 Feb 2018 15:58:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LFw0jE043429; Wed, 21 Feb 2018 15:58:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LFw0XU043427; Wed, 21 Feb 2018 15:58:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802211558.w1LFw0XU043427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Feb 2018 15:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329726 - head/stand/i386/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/i386/loader X-SVN-Commit-Revision: 329726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 15:58:01 -0000 Author: imp Date: Wed Feb 21 15:58:00 2018 New Revision: 329726 URL: https://svnweb.freebsd.org/changeset/base/329726 Log: Honor settings for including / excluding cd9660, ufs, ext2fs and msdos. The Makefile gives the impression that ext2fs and msdos were excluded (they weren't) and that you could exclude cd9660 and ufs support (you couldn't). Allow those to be excluded. We need to look, in the future, at trimming the number of supported filesystems, and this will make that easier. Modified: head/stand/i386/loader/Makefile head/stand/i386/loader/conf.c Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Wed Feb 21 15:57:36 2018 (r329725) +++ head/stand/i386/loader/Makefile Wed Feb 21 15:58:00 2018 (r329726) @@ -5,9 +5,9 @@ HAVE_GELI= yes LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes -LOADER_CD9660_SUPPORT?= no -LOADER_EXT2FS_SUPPORT?= no -LOADER_MSDOS_SUPPORT?= no +LOADER_CD9660_SUPPORT?= yes +LOADER_EXT2FS_SUPPORT?= yes +LOADER_MSDOS_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= yes Modified: head/stand/i386/loader/conf.c ============================================================================== --- head/stand/i386/loader/conf.c Wed Feb 21 15:57:36 2018 (r329725) +++ head/stand/i386/loader/conf.c Wed Feb 21 15:58:00 2018 (r329726) @@ -69,10 +69,18 @@ struct fs_ops *file_system[] = { #if defined(LOADER_ZFS_SUPPORT) &zfs_fsops, #endif +#if defined(LOADER_UFS_SUPPORT) &ufs_fsops, +#endif +#if defined(LOADER_EXT2FS_SUPPORT) &ext2fs_fsops, +#endif +#if defined(LOADER_MSDOS_SUPPORT) &dosfs_fsops, +#endif +#if defined(LOADER_CD9660_SUPPORT) &cd9660_fsops, +#endif #if defined(LOADER_NANDFS_SUPPORT) &nandfs_fsops, #endif From owner-svn-src-all@freebsd.org Wed Feb 21 16:26:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ABDBF12670; Wed, 21 Feb 2018 16:26:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4CB58478F; Wed, 21 Feb 2018 16:26:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF5511AE6A; Wed, 21 Feb 2018 16:26:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGQGJs058755; Wed, 21 Feb 2018 16:26:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGQGb8058753; Wed, 21 Feb 2018 16:26:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211626.w1LGQGb8058753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 16:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329727 - head/stand/zfs X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/zfs X-SVN-Commit-Revision: 329727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:26:17 -0000 Author: kevans Date: Wed Feb 21 16:26:16 2018 New Revision: 329727 URL: https://svnweb.freebsd.org/changeset/base/329727 Log: stand/zfs: Add all bootenvs to environment For the benefit of lualoader, add all bootenvs to environment when init_zfs_bootenv is invoked. All of the boot environment logic can then be implemented in pure lua, rather than going back and forth with C to implement paging. This stores all boot environments in bootenvs[idx] and the final count of bootenvs in bootenvs_count. While here, make a copy of currdev for init_zfs_bootenv since it will be modifying it and the caller may not necessarily want that. Some of the logic was shifted around so that the 'currdev' pointer remains at the beginning of the string and 'beroot' is moved around as needed to modify it or ultimately store it in zfs_be_root. The original zfs_bootenv that this was copied from will be able to go away only if/when forth eventually goes away. Tested with: lualoader (and local changes to add boot env. support) Tested with: forth Reviewed by: cem (earlier version), imp Differential Revision: https://reviews.freebsd.org/D14435 Modified: head/stand/zfs/libzfs.h head/stand/zfs/zfs.c Modified: head/stand/zfs/libzfs.h ============================================================================== --- head/stand/zfs/libzfs.h Wed Feb 21 15:58:00 2018 (r329726) +++ head/stand/zfs/libzfs.h Wed Feb 21 16:26:16 2018 (r329727) @@ -82,7 +82,7 @@ char *zfs_fmtdev(void *vdev); int zfs_probe_dev(const char *devname, uint64_t *pool_guid); int zfs_list(const char *name); uint64_t ldi_get_size(void *); -void init_zfs_bootenv(char *currdev); +void init_zfs_bootenv(const char *currdev); int zfs_bootenv(const char *name); int zfs_belist_add(const char *name, uint64_t __unused); int zfs_set_env(void); Modified: head/stand/zfs/zfs.c ============================================================================== --- head/stand/zfs/zfs.c Wed Feb 21 15:58:00 2018 (r329726) +++ head/stand/zfs/zfs.c Wed Feb 21 16:26:16 2018 (r329727) @@ -60,8 +60,10 @@ static off_t zfs_seek(struct open_file *f, off_t offse static int zfs_stat(struct open_file *f, struct stat *sb); static int zfs_readdir(struct open_file *f, struct dirent *d); -struct devsw zfs_dev; +static void zfs_bootenv_initial(const char *); +truct devsw zfs_dev; + struct fs_ops zfs_fsops = { "zfs", zfs_open, @@ -770,27 +772,83 @@ zfs_list(const char *name) } void -init_zfs_bootenv(char *currdev) +init_zfs_bootenv(const char *currdev_in) { - char *beroot; + char *beroot, *currdev; + int currdev_len; - if (strlen(currdev) == 0) + currdev = NULL; + currdev_len = strlen(currdev_in); + if (currdev_len == 0) return; - if(strncmp(currdev, "zfs:", 4) != 0) + if (strncmp(currdev_in, "zfs:", 4) != 0) return; + currdev = strdup(currdev_in); + if (currdev == NULL) + return; /* Remove the trailing : */ - currdev[strlen(currdev) - 1] = '\0'; + currdev[currdev_len - 1] = '\0'; setenv("zfs_be_active", currdev, 1); setenv("zfs_be_currpage", "1", 1); - /* Forward past zfs: */ - currdev = strchr(currdev, ':'); - currdev++; /* Remove the last element (current bootenv) */ beroot = strrchr(currdev, '/'); if (beroot != NULL) beroot[0] = '\0'; - beroot = currdev; + beroot = strchr(currdev, ':') + 1; setenv("zfs_be_root", beroot, 1); + zfs_bootenv_initial(beroot); + free(currdev); +} + +static void +zfs_bootenv_initial(const char *name) +{ + char poolname[ZFS_MAXNAMELEN], *dsname; + char envname[32], envval[256]; + uint64_t objid; + spa_t *spa; + int bootenvs_idx, len, rv; + + SLIST_INIT(&zfs_be_head); + zfs_env_count = 0; + len = strlen(name); + dsname = strchr(name, '/'); + if (dsname != NULL) { + len = dsname - name; + dsname++; + } else + dsname = ""; + strlcpy(poolname, name, len + 1); + spa = spa_find_by_name(poolname); + if (spa == NULL) + return; + rv = zfs_lookup_dataset(spa, dsname, &objid); + if (rv != 0) + return; + rv = zfs_callback_dataset(spa, objid, zfs_belist_add); + bootenvs_idx = 0; + /* Populate the initial environment variables */ + SLIST_FOREACH_SAFE(zfs_be, &zfs_be_head, entries, zfs_be_tmp) { + /* Enumerate all bootenvs for general usage */ + snprintf(envname, sizeof(envname), "bootenvs[%d]", bootenvs_idx); + snprintf(envval, sizeof(envval), "zfs:%s/%s", name, zfs_be->name); + rv = setenv(envname, envval, 1); + if (rv != 0) + break; + bootenvs_idx++; + } + snprintf(envval, sizeof(envval), "%d", bootenvs_idx); + setenv("bootenvs_count", envval, 1); + + /* Clean up the SLIST of ZFS BEs */ + while (!SLIST_EMPTY(&zfs_be_head)) { + zfs_be = SLIST_FIRST(&zfs_be_head); + SLIST_REMOVE_HEAD(&zfs_be_head, entries); + free(zfs_be); + } + + return; + } int From owner-svn-src-all@freebsd.org Wed Feb 21 16:33:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB70F1300B; Wed, 21 Feb 2018 16:33:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEBF684D2E; Wed, 21 Feb 2018 16:33:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C93851B001; Wed, 21 Feb 2018 16:33:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGX8nL063579; Wed, 21 Feb 2018 16:33:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGX8S4063578; Wed, 21 Feb 2018 16:33:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211633.w1LGX8S4063578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 16:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329728 - head/stand/zfs X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/zfs X-SVN-Commit-Revision: 329728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:33:09 -0000 Author: kevans Date: Wed Feb 21 16:33:08 2018 New Revision: 329728 URL: https://svnweb.freebsd.org/changeset/base/329728 Log: stand/zfs: Unbreak build, 'truct' ~= 'struct' Modified: head/stand/zfs/zfs.c Modified: head/stand/zfs/zfs.c ============================================================================== --- head/stand/zfs/zfs.c Wed Feb 21 16:26:16 2018 (r329727) +++ head/stand/zfs/zfs.c Wed Feb 21 16:33:08 2018 (r329728) @@ -62,7 +62,7 @@ static int zfs_readdir(struct open_file *f, struct dir static void zfs_bootenv_initial(const char *); -truct devsw zfs_dev; +struct devsw zfs_dev; struct fs_ops zfs_fsops = { "zfs", From owner-svn-src-all@freebsd.org Wed Feb 21 16:34:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 286DCF13101; Wed, 21 Feb 2018 16:34:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C30D584E8A; Wed, 21 Feb 2018 16:34:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE0651B002; Wed, 21 Feb 2018 16:34:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGY4Ex063649; Wed, 21 Feb 2018 16:34:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGY4xc063647; Wed, 21 Feb 2018 16:34:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802211634.w1LGY4xc063647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 21 Feb 2018 16:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329729 - in head/sys/modules/spi: at45d mx25l X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules/spi: at45d mx25l X-SVN-Commit-Revision: 329729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:34:05 -0000 Author: ian Date: Wed Feb 21 16:34:04 2018 New Revision: 329729 URL: https://svnweb.freebsd.org/changeset/base/329729 Log: Remove some files that snuck in via cut and paste. Having these compiled into the module causes the kobj method descriptors to be resolved incorrectly (by the compile-time linker instead of the kernel linker), which then leads to hours of frustrating debugging. Modified: head/sys/modules/spi/at45d/Makefile head/sys/modules/spi/mx25l/Makefile Modified: head/sys/modules/spi/at45d/Makefile ============================================================================== --- head/sys/modules/spi/at45d/Makefile Wed Feb 21 16:33:08 2018 (r329728) +++ head/sys/modules/spi/at45d/Makefile Wed Feb 21 16:34:04 2018 (r329729) @@ -9,7 +9,6 @@ SRCS= at45d.c SRCS+= \ bus_if.h \ device_if.h \ - spibus_if.c \ spibus_if.h \ .if !empty(OPT_FDT) Modified: head/sys/modules/spi/mx25l/Makefile ============================================================================== --- head/sys/modules/spi/mx25l/Makefile Wed Feb 21 16:33:08 2018 (r329728) +++ head/sys/modules/spi/mx25l/Makefile Wed Feb 21 16:34:04 2018 (r329729) @@ -9,7 +9,6 @@ SRCS= mx25l.c SRCS+= \ bus_if.h \ device_if.h \ - spibus_if.c \ spibus_if.h \ .if !empty(OPT_FDT) From owner-svn-src-all@freebsd.org Wed Feb 21 16:36:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 938CBF133AA; Wed, 21 Feb 2018 16:36:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45C9E850C1; Wed, 21 Feb 2018 16:36:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40AA01B00E; Wed, 21 Feb 2018 16:36:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGajvZ063817; Wed, 21 Feb 2018 16:36:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGajiB063816; Wed, 21 Feb 2018 16:36:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802211636.w1LGajiB063816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 21 Feb 2018 16:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329730 - head/sys/modules/imx/imx_i2c X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/imx/imx_i2c X-SVN-Commit-Revision: 329730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:36:45 -0000 Author: ian Date: Wed Feb 21 16:36:44 2018 New Revision: 329730 URL: https://svnweb.freebsd.org/changeset/base/329730 Log: Add required header files. Reported by: andreast@ Modified: head/sys/modules/imx/imx_i2c/Makefile Modified: head/sys/modules/imx/imx_i2c/Makefile ============================================================================== --- head/sys/modules/imx/imx_i2c/Makefile Wed Feb 21 16:34:04 2018 (r329729) +++ head/sys/modules/imx/imx_i2c/Makefile Wed Feb 21 16:36:44 2018 (r329730) @@ -8,6 +8,8 @@ SRCS= imx_i2c.c SRCS+= \ bus_if.h \ device_if.h \ + fdt_pinctrl_if.h + gpio_if.h \ iicbus_if.h \ ofw_bus_if.h \ opt_platform.h \ From owner-svn-src-all@freebsd.org Wed Feb 21 16:50:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50E92F1447C; Wed, 21 Feb 2018 16:50:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06F5785AD1; Wed, 21 Feb 2018 16:50:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1E8D1B1AA; Wed, 21 Feb 2018 16:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGofa5069077; Wed, 21 Feb 2018 16:50:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGofal069075; Wed, 21 Feb 2018 16:50:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211650.w1LGofal069075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 16:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329731 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:50:42 -0000 Author: kevans Date: Wed Feb 21 16:50:41 2018 New Revision: 329731 URL: https://svnweb.freebsd.org/changeset/base/329731 Log: lualoader: Add boot environment support This looks a little bit differently than the forth version for the time being, just to get off the ground- rather than a paging system, it's implemented as a simple carousel like the kernel selector. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D14436 Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 16:36:44 2018 (r329730) +++ head/stand/lua/core.lua Wed Feb 21 16:50:41 2018 (r329731) @@ -242,6 +242,41 @@ function core.kernelList() return kernels end +function core.bootenvDefault() + return loader.getenv("zfs_be_active") +end + +function core.bootenvList() + local bootenv_count = tonumber(loader.getenv("bootenvs_count")) + local bootenvs = {} + local curenv + local curenv_idx = 0 + local envcount = 0 + local unique = {} + + if bootenv_count == nil or bootenv_count <= 0 then + return bootenvs + end + + -- Currently selected bootenv is always first/default + curenv = core.bootenvDefault() + if curenv ~= nil then + envcount = envcount + 1 + bootenvs[envcount] = curenv + unique[curenv] = true + end + + for curenv_idx = 0, bootenv_count - 1 do + curenv = loader.getenv("bootenvs[" .. curenv_idx .. "]") + if curenv ~= nil and unique[curenv] == nil then + envcount = envcount + 1 + bootenvs[envcount] = curenv + unique[curenv] = true + end + end + return bootenvs +end + function core.setDefaults() core.setACPI(core.getACPIPresent(true)) core.setSafeMode(false) @@ -262,6 +297,15 @@ end function core.isSingleUserBoot() local single_user = loader.getenv("boot_single") return single_user ~= nil and single_user:lower() == "yes" +end + +function core.isZFSBoot() + local c = loader.getenv("currdev") + + if c ~= nil then + return c:match("^zfs:") ~= nil + end + return false end function core.isSerialBoot() Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 16:36:44 2018 (r329730) +++ head/stand/lua/menu.lua Wed Feb 21 16:50:41 2018 (r329731) @@ -50,6 +50,12 @@ local OnOff = function(str, b) end end +local bootenvSet = function(env) + loader.setenv("vfs.root.mountfrom", env) + loader.setenv("currdev", env .. ":") + config.reload() +end + -- Module exports menu.handlers = { -- Menu handlers take the current menu and selected entry as parameters, @@ -89,6 +95,58 @@ menu.handlers = { } -- loader menu tree is rooted at menu.welcome +menu.boot_environments = { + entries = { + -- return to welcome menu + { + entry_type = core.MENU_RETURN, + name = "Back to main menu" .. + color.highlight(" [Backspace]"), + }, + { + entry_type = core.MENU_CAROUSEL_ENTRY, + carousel_id = "be_active", + items = core.bootenvList, + name = function(idx, choice, all_choices) + if #all_choices == 0 then + return "Active: " + end + + local is_default = (idx == 1) + local bootenv_name = "" + local name_color + if is_default then + name_color = color.escapef(color.GREEN) + else + name_color = color.escapef(color.BLUE) + end + bootenv_name = bootenv_name .. name_color .. + choice .. color.default() + return color.highlight("A").."ctive: " .. + bootenv_name .. " (" .. idx .. " of " .. + #all_choices .. ")" + end, + func = function(idx, choice, all_choices) + bootenvSet(choice) + end, + alias = {"a", "A"}, + }, + { + entry_type = core.MENU_ENTRY, + name = function() + return color.highlight("b") .. "ootfs: " .. + core.bootenvDefault() + end, + func = function() + -- Reset active boot environment to the default + config.setCarouselIndex("be_active", 1) + bootenvSet(core.bootenvDefault()) + end, + alias = {"b", "B"}, + }, + }, +} + menu.boot_options = { entries = { -- return to welcome menu @@ -269,6 +327,17 @@ menu.welcome = { name = "Boot " .. color.highlight("O") .. "ptions", submenu = menu.boot_options, alias = {"o", "O"} + }, + -- boot environments + { + entry_type = core.MENU_SUBMENU, + visible = function() + return core.isZFSBoot() and + #core.bootenvList() > 1 + end, + name = "Boot " .. color.highlight("E") .. "nvironments", + submenu = menu.boot_environments, + alias = {"e", "E"}, }, }, } From owner-svn-src-all@freebsd.org Wed Feb 21 16:51:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23774F144F7; Wed, 21 Feb 2018 16:51:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C3F7A85C1F; Wed, 21 Feb 2018 16:51:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A46B61B1BD; Wed, 21 Feb 2018 16:51:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGp2iU069137; Wed, 21 Feb 2018 16:51:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGp2Vk069134; Wed, 21 Feb 2018 16:51:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802211651.w1LGp2Vk069134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 16:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329732 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/l... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib... X-SVN-Commit-Revision: 329732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:51:03 -0000 Author: mav Date: Wed Feb 21 16:51:02 2018 New Revision: 329732 URL: https://svnweb.freebsd.org/changeset/base/329732 Log: MFV r329502: 7614 zfs device evacuation/removal illumos/illumos-gate@5cabbc6b49070407fb9610cfe73d4c0e0dea3e77 https://www.illumos.org/issues/7614: This project allows top-level vdevs to be removed from the storage pool with “zpool removeâ€, reducing the total amount of storage in the pool. This operation copies all allocated regions of the device to be removed onto other devices, recording the mapping from old to new location. After the removal is complete, read and free operations to the removed (now “indirectâ€) vdev must be remapped and performed at the new location on disk. The indirect mapping table is kept in memory whenever the pool is loaded, so there is minimal performance overhead when doing operations on the indirect vdev. The size of the in-memory mapping table will be reduced when its entries become “obsolete†because they are no longer used by any block pointers in the pool. An entry becomes obsolete when all the blocks that use it are freed. An entry can also become obsolete when all the snapshots that reference it are deleted, and the block pointers that reference it have been “remapped†in all filesystems/zvols (and clones). Whenever an indirect block is written, all the block pointers in it will be “remapped†to their new (concrete) locations if possible. This process can be accelerated by using the “zfs remap†command to proactively rewrite all indirect blocks that reference indirect (removed) vdevs. Note that when a device is removed, we do not verify the checksum of the data that is copied. This makes the process much faster, but if it were used on redundant vdevs (i.e. mirror or raidz vdevs), it would be possible to copy the wrong data, when we have the correct data on e.g. the other side of the mirror. Therefore, mirror and raidz devices can not be removed. Reviewed by: Alex Reece Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: Richard Laager Reviewed by: Tim Chase Approved by: Garrett D'Amore Author: Prashanth Sreenivasa Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_births.h - copied unchanged from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_births.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_mapping.h - copied unchanged from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_indirect_mapping.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h - copied unchanged from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c - copied, changed from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_births.c - copied unchanged from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_births.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c - copied, changed from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c - copied, changed from r329502, vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_reftree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deadlist.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_priority.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/conf/files Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Feb 21 16:50:41 2018 (r329731) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Feb 21 16:51:02 2018 (r329732) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. */ @@ -77,8 +77,10 @@ dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \ - (((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \ - DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES)) + (idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA ? \ + DMU_OT_ZAP_OTHER : \ + (idx) == DMU_OTN_UINT64_DATA || (idx) == DMU_OTN_UINT64_METADATA ? \ + DMU_OT_UINT64_OTHER : DMU_OT_NUMTYPES) #ifndef lint extern int reference_tracking_enable; @@ -667,8 +669,8 @@ get_metaslab_refcount(vdev_t *vd) { int refcount = 0; - if (vd->vdev_top == vd && !vd->vdev_removing) { - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + if (vd->vdev_top == vd) { + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -683,6 +685,45 @@ get_metaslab_refcount(vdev_t *vd) } static int +get_obsolete_refcount(vdev_t *vd) +{ + int refcount = 0; + + uint64_t obsolete_sm_obj = vdev_obsolete_sm_object(vd); + if (vd->vdev_top == vd && obsolete_sm_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(vd->vdev_spa->spa_meta_objset, + obsolete_sm_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + refcount++; + } + } else { + ASSERT3P(vd->vdev_obsolete_sm, ==, NULL); + ASSERT3U(obsolete_sm_obj, ==, 0); + } + for (unsigned c = 0; c < vd->vdev_children; c++) { + refcount += get_obsolete_refcount(vd->vdev_child[c]); + } + + return (refcount); +} + +static int +get_prev_obsolete_spacemap_refcount(spa_t *spa) +{ + uint64_t prev_obj = + spa->spa_condensing_indirect_phys.scip_prev_obsolete_sm_object; + if (prev_obj != 0) { + dmu_object_info_t doi; + VERIFY0(dmu_object_info(spa->spa_meta_objset, prev_obj, &doi)); + if (doi.doi_bonus_size == sizeof (space_map_phys_t)) { + return (1); + } + } + return (0); +} + +static int verify_spacemap_refcounts(spa_t *spa) { uint64_t expected_refcount = 0; @@ -693,6 +734,8 @@ verify_spacemap_refcounts(spa_t *spa) &expected_refcount); actual_refcount = get_dtl_refcount(spa->spa_root_vdev); actual_refcount += get_metaslab_refcount(spa->spa_root_vdev); + actual_refcount += get_obsolete_refcount(spa->spa_root_vdev); + actual_refcount += get_prev_obsolete_spacemap_refcount(spa); if (expected_refcount != actual_refcount) { (void) printf("space map refcount mismatch: expected %lld != " @@ -708,12 +751,19 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", - "INVALID", "INVALID", "INVALID", "INVALID" }; + char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) return; + (void) printf("space map object %llu:\n", + (longlong_t)sm->sm_phys->smp_object); + (void) printf(" smp_objsize = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_objsize); + (void) printf(" smp_alloc = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_alloc); + /* * Print out the freelist entries in both encoded and decoded form. */ @@ -818,9 +868,7 @@ dump_metaslab(metaslab_t *msp) if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); - mutex_enter(&msp->ms_lock); dump_spacemap(spa->spa_meta_objset, msp->ms_sm); - mutex_exit(&msp->ms_lock); } } @@ -878,6 +926,78 @@ dump_metaslab_groups(spa_t *spa) } static void +print_vdev_indirect(vdev_t *vd) +{ + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + vdev_indirect_births_t *vib = vd->vdev_indirect_births; + + if (vim == NULL) { + ASSERT3P(vib, ==, NULL); + return; + } + + ASSERT3U(vdev_indirect_mapping_object(vim), ==, + vic->vic_mapping_object); + ASSERT3U(vdev_indirect_births_object(vib), ==, + vic->vic_births_object); + + (void) printf("indirect births obj %llu:\n", + (longlong_t)vic->vic_births_object); + (void) printf(" vib_count = %llu\n", + (longlong_t)vdev_indirect_births_count(vib)); + for (uint64_t i = 0; i < vdev_indirect_births_count(vib); i++) { + vdev_indirect_birth_entry_phys_t *cur_vibe = + &vib->vib_entries[i]; + (void) printf("\toffset %llx -> txg %llu\n", + (longlong_t)cur_vibe->vibe_offset, + (longlong_t)cur_vibe->vibe_phys_birth_txg); + } + (void) printf("\n"); + + (void) printf("indirect mapping obj %llu:\n", + (longlong_t)vic->vic_mapping_object); + (void) printf(" vim_max_offset = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_max_offset(vim)); + (void) printf(" vim_bytes_mapped = 0x%llx\n", + (longlong_t)vdev_indirect_mapping_bytes_mapped(vim)); + (void) printf(" vim_count = %llu\n", + (longlong_t)vdev_indirect_mapping_num_entries(vim)); + + if (dump_opt['d'] <= 5 && dump_opt['m'] <= 3) + return; + + uint32_t *counts = vdev_indirect_mapping_load_obsolete_counts(vim); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + (void) printf("\t<%llx:%llx:%llx> -> " + "<%llx:%llx:%llx> (%x obsolete)\n", + (longlong_t)vd->vdev_id, + (longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (longlong_t)DVA_GET_VDEV(&vimep->vimep_dst), + (longlong_t)DVA_GET_OFFSET(&vimep->vimep_dst), + (longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + counts[i]); + } + (void) printf("\n"); + + uint64_t obsolete_sm_object = vdev_obsolete_sm_object(vd); + if (obsolete_sm_object != 0) { + objset_t *mos = vd->vdev_spa->spa_meta_objset; + (void) printf("obsolete space map object %llu:\n", + (u_longlong_t)obsolete_sm_object); + ASSERT(vd->vdev_obsolete_sm != NULL); + ASSERT3U(space_map_object(vd->vdev_obsolete_sm), ==, + obsolete_sm_object); + dump_spacemap(mos, vd->vdev_obsolete_sm); + (void) printf("\n"); + } +} + +static void dump_metaslabs(spa_t *spa) { vdev_t *vd, *rvd = spa->spa_root_vdev; @@ -913,6 +1033,8 @@ dump_metaslabs(spa_t *spa) vd = rvd->vdev_child[c]; print_vdev_metaslab_header(vd); + print_vdev_indirect(vd); + for (m = 0; m < vd->vdev_ms_count; m++) dump_metaslab(vd->vdev_ms[m]); (void) printf("\n"); @@ -1090,9 +1212,7 @@ dump_dtl(vdev_t *vd, int indent) continue; (void) snprintf(prefix, sizeof (prefix), "\t%*s%s", indent + 2, "", name[t]); - mutex_enter(rt->rt_lock); range_tree_walk(rt, dump_dtl_seg, prefix); - mutex_exit(rt->rt_lock); if (dump_opt['d'] > 5 && vd->vdev_children == 0) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } @@ -2107,9 +2227,16 @@ dump_dir(objset_t *os) if (dump_opt['i'] != 0 || verbosity >= 2) dump_intent_log(dmu_objset_zil(os)); - if (dmu_objset_ds(os) != NULL) - dump_deadlist(&dmu_objset_ds(os)->ds_deadlist); + if (dmu_objset_ds(os) != NULL) { + dsl_dataset_t *ds = dmu_objset_ds(os); + dump_deadlist(&ds->ds_deadlist); + if (dsl_dataset_remap_deadlist_exists(ds)) { + (void) printf("ds_remap_deadlist:\n"); + dump_deadlist(&ds->ds_remap_deadlist); + } + } + if (verbosity < 2) return; @@ -2452,6 +2579,7 @@ dump_label(const char *dev) } static uint64_t dataset_feature_count[SPA_FEATURES]; +static uint64_t remap_deadlist_count = 0; /*ARGSUSED*/ static int @@ -2472,6 +2600,10 @@ dump_one_dir(const char *dsname, void *arg) dataset_feature_count[f]++; } + if (dsl_dataset_remap_deadlist_exists(dmu_objset_ds(os))) { + remap_deadlist_count++; + } + dump_dir(os); close_objset(os, FTAG); fuid_table_destroy(); @@ -2511,6 +2643,7 @@ static const char *zdb_ot_extname[] = { typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; + uint64_t zcb_removing_size; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; uint64_t zcb_embedded_blocks[NUM_BP_EMBEDDED_TYPES]; @@ -2523,6 +2656,7 @@ typedef struct zdb_cb { int zcb_readfails; int zcb_haderrors; spa_t *zcb_spa; + uint32_t **zcb_vd_obsolete_counts; } zdb_cb_t; static void @@ -2797,12 +2931,208 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) ASSERT(error == ENOENT); } +/* ARGSUSED */ static void +claim_segment_impl_cb(uint64_t inner_offset, vdev_t *vd, uint64_t offset, + uint64_t size, void *arg) +{ + /* + * This callback was called through a remap from + * a device being removed. Therefore, the vdev that + * this callback is applied to is a concrete + * vdev. + */ + ASSERT(vdev_is_concrete(vd)); + + VERIFY0(metaslab_claim_impl(vd, offset, size, + spa_first_txg(vd->vdev_spa))); +} + +static void +claim_segment_cb(void *arg, uint64_t offset, uint64_t size) +{ + vdev_t *vd = arg; + + vdev_indirect_ops.vdev_op_remap(vd, offset, size, + claim_segment_impl_cb, NULL); +} + +/* + * After accounting for all allocated blocks that are directly referenced, + * we might have missed a reference to a block from a partially complete + * (and thus unused) indirect mapping object. We perform a secondary pass + * through the metaslabs we have already mapped and claim the destination + * blocks. + */ +static void +zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) +{ + if (spa->spa_vdev_removal == NULL) + return; + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + + spa_vdev_removal_t *svr = spa->spa_vdev_removal; + vdev_t *vd = svr->svr_vdev; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) { + metaslab_t *msp = vd->vdev_ms[msi]; + + if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim)) + break; + + ASSERT0(range_tree_space(svr->svr_allocd_segs)); + + if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, + svr->svr_allocd_segs, SM_ALLOC)); + + /* + * Clear everything past what has been synced, + * because we have not allocated mappings for it yet. + */ + range_tree_clear(svr->svr_allocd_segs, + vdev_indirect_mapping_max_offset(vim), + msp->ms_sm->sm_start + msp->ms_sm->sm_size - + vdev_indirect_mapping_max_offset(vim)); + } + + zcb->zcb_removing_size += + range_tree_space(svr->svr_allocd_segs); + range_tree_vacate(svr->svr_allocd_segs, claim_segment_cb, vd); + } + + spa_config_exit(spa, SCL_CONFIG, FTAG); +} + +/* + * vm_idxp is an in-out parameter which (for indirect vdevs) is the + * index in vim_entries that has the first entry in this metaslab. On + * return, it will be set to the first entry after this metaslab. + */ +static void +zdb_leak_init_ms(metaslab_t *msp, uint64_t *vim_idxp) +{ + metaslab_group_t *mg = msp->ms_group; + vdev_t *vd = mg->mg_vd; + vdev_t *rvd = vd->vdev_spa->spa_root_vdev; + + mutex_enter(&msp->ms_lock); + metaslab_unload(msp); + + /* + * We don't want to spend the CPU manipulating the size-ordered + * tree, so clear the range_tree ops. + */ + msp->ms_tree->rt_ops = NULL; + + (void) fprintf(stderr, + "\rloading vdev %llu of %llu, metaslab %llu of %llu ...", + (longlong_t)vd->vdev_id, + (longlong_t)rvd->vdev_children, + (longlong_t)msp->ms_id, + (longlong_t)vd->vdev_ms_count); + + /* + * For leak detection, we overload the metaslab ms_tree to + * contain allocated segments instead of free segments. As a + * result, we can't use the normal metaslab_load/unload + * interfaces. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + for (; *vim_idxp < vdev_indirect_mapping_num_entries(vim); + (*vim_idxp)++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[*vim_idxp]; + uint64_t ent_offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + uint64_t ent_len = DVA_GET_ASIZE(&vimep->vimep_dst); + ASSERT3U(ent_offset, >=, msp->ms_start); + if (ent_offset >= msp->ms_start + msp->ms_size) + break; + + /* + * Mappings do not cross metaslab boundaries, + * because we create them by walking the metaslabs. + */ + ASSERT3U(ent_offset + ent_len, <=, + msp->ms_start + msp->ms_size); + range_tree_add(msp->ms_tree, ent_offset, ent_len); + } + } else if (msp->ms_sm != NULL) { + VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); + } + + if (!msp->ms_loaded) { + msp->ms_loaded = B_TRUE; + } + mutex_exit(&msp->ms_lock); +} + +/* ARGSUSED */ +static int +increment_indirect_mapping_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + zdb_cb_t *zcb = arg; + spa_t *spa = zcb->zcb_spa; + vdev_t *vd; + const dva_t *dva = &bp->blk_dva[0]; + + ASSERT(!dump_opt['L']); + ASSERT3U(BP_GET_NDVAS(bp), ==, 1); + + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + vd = vdev_lookup_top(zcb->zcb_spa, DVA_GET_VDEV(dva)); + ASSERT3P(vd, !=, NULL); + spa_config_exit(spa, SCL_VDEV, FTAG); + + ASSERT(vd->vdev_indirect_config.vic_mapping_object != 0); + ASSERT3P(zcb->zcb_vd_obsolete_counts[vd->vdev_id], !=, NULL); + + vdev_indirect_mapping_increment_obsolete_count( + vd->vdev_indirect_mapping, + DVA_GET_OFFSET(dva), DVA_GET_ASIZE(dva), + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + + return (0); +} + +static uint32_t * +zdb_load_obsolete_counts(vdev_t *vd) +{ + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + spa_t *spa = vd->vdev_spa; + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + uint32_t *counts; + + EQUIV(vdev_obsolete_sm_object(vd) != 0, vd->vdev_obsolete_sm != NULL); + counts = vdev_indirect_mapping_load_obsolete_counts(vim); + if (vd->vdev_obsolete_sm != NULL) { + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + vd->vdev_obsolete_sm); + } + if (scip->scip_vdev == vd->vdev_id && + scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, + prev_obsolete_sm); + space_map_close(prev_obsolete_sm); + } + return (counts); +} + +static void zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) { zcb->zcb_spa = spa; if (!dump_opt['L']) { + dsl_pool_t *dp = spa->spa_dsl_pool; vdev_t *rvd = spa->spa_root_vdev; /* @@ -2813,50 +3143,51 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + zcb->zcb_vd_obsolete_counts = + umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), + UMEM_NOFAIL); + + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; - metaslab_group_t *mg = vd->vdev_mg; - for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - ASSERT3P(msp->ms_group, ==, mg); - mutex_enter(&msp->ms_lock); - metaslab_unload(msp); + uint64_t vim_idx = 0; + ASSERT3U(c, ==, vd->vdev_id); + + /* + * Note: we don't check for mapping leaks on + * removing vdevs because their ms_tree's are + * used to look for leaks in allocated space. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + zcb->zcb_vd_obsolete_counts[c] = + zdb_load_obsolete_counts(vd); + /* - * For leak detection, we overload the metaslab - * ms_tree to contain allocated segments - * instead of free segments. As a result, - * we can't use the normal metaslab_load/unload - * interfaces. + * Normally, indirect vdevs don't have any + * metaslabs. We want to set them up for + * zio_claim(). */ - if (msp->ms_sm != NULL) { - (void) fprintf(stderr, - "\rloading space map for " - "vdev %llu of %llu, " - "metaslab %llu of %llu ...", - (longlong_t)c, - (longlong_t)rvd->vdev_children, - (longlong_t)m, - (longlong_t)vd->vdev_ms_count); + VERIFY0(vdev_metaslab_init(vd, 0)); + } - /* - * We don't want to spend the CPU - * manipulating the size-ordered - * tree, so clear the range_tree - * ops. - */ - msp->ms_tree->rt_ops = NULL; - VERIFY0(space_map_load(msp->ms_sm, - msp->ms_tree, SM_ALLOC)); - - if (!msp->ms_loaded) { - msp->ms_loaded = B_TRUE; - } - } - mutex_exit(&msp->ms_lock); + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { + zdb_leak_init_ms(vd->vdev_ms[m], &vim_idx); } + if (vd->vdev_ops == &vdev_indirect_ops) { + ASSERT3U(vim_idx, ==, + vdev_indirect_mapping_num_entries( + vd->vdev_indirect_mapping)); + } } (void) fprintf(stderr, "\n"); + + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, + increment_indirect_mapping_cb, zcb, NULL); + } } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -2866,18 +3197,93 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) spa_config_exit(spa, SCL_CONFIG, FTAG); } -static void -zdb_leak_fini(spa_t *spa) +static boolean_t +zdb_check_for_obsolete_leaks(vdev_t *vd, zdb_cb_t *zcb) { + boolean_t leaks = B_FALSE; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + uint64_t total_leaked = 0; + + ASSERT(vim != NULL); + + for (uint64_t i = 0; i < vdev_indirect_mapping_num_entries(vim); i++) { + vdev_indirect_mapping_entry_phys_t *vimep = + &vim->vim_entries[i]; + uint64_t obsolete_bytes = 0; + uint64_t offset = DVA_MAPPING_GET_SRC_OFFSET(vimep); + metaslab_t *msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; + + /* + * This is not very efficient but it's easy to + * verify correctness. + */ + for (uint64_t inner_offset = 0; + inner_offset < DVA_GET_ASIZE(&vimep->vimep_dst); + inner_offset += 1 << vd->vdev_ashift) { + if (range_tree_contains(msp->ms_tree, + offset + inner_offset, 1 << vd->vdev_ashift)) { + obsolete_bytes += 1 << vd->vdev_ashift; + } + } + + int64_t bytes_leaked = obsolete_bytes - + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]; + ASSERT3U(DVA_GET_ASIZE(&vimep->vimep_dst), >=, + zcb->zcb_vd_obsolete_counts[vd->vdev_id][i]); + if (bytes_leaked != 0 && + (vdev_obsolete_counts_are_precise(vd) || + dump_opt['d'] >= 5)) { + (void) printf("obsolete indirect mapping count " + "mismatch on %llu:%llx:%llx : %llx bytes leaked\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)DVA_MAPPING_GET_SRC_OFFSET(vimep), + (u_longlong_t)DVA_GET_ASIZE(&vimep->vimep_dst), + (u_longlong_t)bytes_leaked); + } + total_leaked += ABS(bytes_leaked); + } + + if (!vdev_obsolete_counts_are_precise(vd) && total_leaked > 0) { + int pct_leaked = total_leaked * 100 / + vdev_indirect_mapping_bytes_mapped(vim); + (void) printf("cannot verify obsolete indirect mapping " + "counts of vdev %llu because precise feature was not " + "enabled when it was removed: %d%% (%llx bytes) of mapping" + "unreferenced\n", + (u_longlong_t)vd->vdev_id, pct_leaked, + (u_longlong_t)total_leaked); + } else if (total_leaked > 0) { + (void) printf("obsolete indirect mapping count mismatch " + "for vdev %llu -- %llx total bytes mismatched\n", + (u_longlong_t)vd->vdev_id, + (u_longlong_t)total_leaked); + leaks |= B_TRUE; + } + + vdev_indirect_mapping_free_obsolete_counts(vim, + zcb->zcb_vd_obsolete_counts[vd->vdev_id]); + zcb->zcb_vd_obsolete_counts[vd->vdev_id] = NULL; + + return (leaks); +} + +static boolean_t +zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) +{ + boolean_t leaks = B_FALSE; if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (unsigned m = 0; m < vd->vdev_ms_count; m++) { + + if (zcb->zcb_vd_obsolete_counts[c] != NULL) { + leaks |= zdb_check_for_obsolete_leaks(vd, zcb); + } + + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); - mutex_enter(&msp->ms_lock); /* * The ms_tree has been overloaded to @@ -2887,18 +3293,30 @@ zdb_leak_fini(spa_t *spa) * represents an allocated block that we * did not claim during the traversal. * Claimed blocks would have been removed - * from the ms_tree. + * from the ms_tree. For indirect vdevs, + * space remaining in the tree represents + * parts of the mapping that are not + * referenced, which is not a bug. */ - range_tree_vacate(msp->ms_tree, zdb_leak, vd); + if (vd->vdev_ops == &vdev_indirect_ops) { + range_tree_vacate(msp->ms_tree, + NULL, NULL); + } else { + range_tree_vacate(msp->ms_tree, + zdb_leak, vd); + } if (msp->ms_loaded) { msp->ms_loaded = B_FALSE; } - - mutex_exit(&msp->ms_lock); } } + + umem_free(zcb->zcb_vd_obsolete_counts, + rvd->vdev_children * sizeof (uint32_t *)); + zcb->zcb_vd_obsolete_counts = NULL; } + return (leaks); } /* ARGSUSED */ @@ -2949,10 +3367,14 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, count_block_cb, &zcb, NULL); } + + zdb_claim_removing(spa, &zcb); + if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, @@ -2994,7 +3416,7 @@ dump_block_stats(spa_t *spa) /* * Report any leaked segments. */ - zdb_leak_fini(spa); + leaks |= zdb_leak_fini(spa, &zcb); tzb = &zcb.zcb_type[ZB_TOTAL][ZDB_OT_TOTAL]; @@ -3002,7 +3424,8 @@ dump_block_stats(spa_t *spa) norm_space = metaslab_class_get_space(spa_normal_class(spa)); total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); - total_found = tzb->zb_asize - zcb.zcb_dedup_asize; + total_found = tzb->zb_asize - zcb.zcb_dedup_asize + + zcb.zcb_removing_size; if (total_found == total_alloc) { if (!dump_opt['L']) @@ -3069,6 +3492,24 @@ dump_block_stats(spa_t *spa) (longlong_t)tzb->zb_ditto_samevdev); } + for (uint64_t v = 0; v < spa->spa_root_vdev->vdev_children; v++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[v]; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + + if (vim == NULL) { + continue; + } + + char mem[32]; + zdb_nicenum(vdev_indirect_mapping_num_entries(vim), + mem, vdev_indirect_mapping_size(vim)); + + (void) printf("\tindirect vdev id %llu has %llu segments " + "(%s in memory)\n", + (longlong_t)vd->vdev_id, + (longlong_t)vdev_indirect_mapping_num_entries(vim), mem); + } + if (dump_opt['b'] >= 2) { int l, t, level; (void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" @@ -3275,6 +3716,124 @@ dump_simulated_ddt(spa_t *spa) dump_dedup_ratio(&dds_total); } +static int +verify_device_removal_feature_counts(spa_t *spa) +{ + uint64_t dr_feature_refcount = 0; + uint64_t oc_feature_refcount = 0; + uint64_t indirect_vdev_count = 0; + uint64_t precise_vdev_count = 0; + uint64_t obsolete_counts_object_count = 0; + uint64_t obsolete_sm_count = 0; + uint64_t obsolete_counts_count = 0; + uint64_t scip_count = 0; + uint64_t obsolete_bpobj_count = 0; + int ret = 0; + + spa_condensing_indirect_phys_t *scip = + &spa->spa_condensing_indirect_phys; + if (scip->scip_next_mapping_object != 0) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[scip->scip_vdev]; + ASSERT(scip->scip_prev_obsolete_sm_object != 0); + ASSERT3P(vd->vdev_ops, ==, &vdev_indirect_ops); + + (void) printf("Condensing indirect vdev %llu: new mapping " + "object %llu, prev obsolete sm %llu\n", + (u_longlong_t)scip->scip_vdev, + (u_longlong_t)scip->scip_next_mapping_object, + (u_longlong_t)scip->scip_prev_obsolete_sm_object); + if (scip->scip_prev_obsolete_sm_object != 0) { + space_map_t *prev_obsolete_sm = NULL; + VERIFY0(space_map_open(&prev_obsolete_sm, + spa->spa_meta_objset, + scip->scip_prev_obsolete_sm_object, + 0, vd->vdev_asize, 0)); + space_map_update(prev_obsolete_sm); + dump_spacemap(spa->spa_meta_objset, prev_obsolete_sm); + (void) printf("\n"); + space_map_close(prev_obsolete_sm); + } + + scip_count += 2; + } + + for (uint64_t i = 0; i < spa->spa_root_vdev->vdev_children; i++) { + vdev_t *vd = spa->spa_root_vdev->vdev_child[i]; + vdev_indirect_config_t *vic = &vd->vdev_indirect_config; + + if (vic->vic_mapping_object != 0) { + ASSERT(vd->vdev_ops == &vdev_indirect_ops || + vd->vdev_removing); + indirect_vdev_count++; + + if (vd->vdev_indirect_mapping->vim_havecounts) { + obsolete_counts_count++; + } + } + if (vdev_obsolete_counts_are_precise(vd)) { + ASSERT(vic->vic_mapping_object != 0); + precise_vdev_count++; + } + if (vdev_obsolete_sm_object(vd) != 0) { + ASSERT(vic->vic_mapping_object != 0); + obsolete_sm_count++; + } + } + + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_DEVICE_REMOVAL], + &dr_feature_refcount); + (void) feature_get_refcount(spa, + &spa_feature_table[SPA_FEATURE_OBSOLETE_COUNTS], + &oc_feature_refcount); + + if (dr_feature_refcount != indirect_vdev_count) { + ret = 1; + (void) printf("Number of indirect vdevs (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)indirect_vdev_count, + (u_longlong_t)dr_feature_refcount); + } else { + (void) printf("Verified device_removal feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)dr_feature_refcount); + } + + if (zap_contains(spa_meta_objset(spa), DMU_POOL_DIRECTORY_OBJECT, + DMU_POOL_OBSOLETE_BPOBJ) == 0) { + obsolete_bpobj_count++; + } + + + obsolete_counts_object_count = precise_vdev_count; + obsolete_counts_object_count += obsolete_sm_count; + obsolete_counts_object_count += obsolete_counts_count; + obsolete_counts_object_count += scip_count; + obsolete_counts_object_count += obsolete_bpobj_count; + obsolete_counts_object_count += remap_deadlist_count; + + if (oc_feature_refcount != obsolete_counts_object_count) { + ret = 1; + (void) printf("Number of obsolete counts objects (%llu) " \ + "does not match feature count (%llu)\n", + (u_longlong_t)obsolete_counts_object_count, + (u_longlong_t)oc_feature_refcount); + (void) printf("pv:%llu os:%llu oc:%llu sc:%llu " + "ob:%llu rd:%llu\n", + (u_longlong_t)precise_vdev_count, + (u_longlong_t)obsolete_sm_count, + (u_longlong_t)obsolete_counts_count, + (u_longlong_t)scip_count, + (u_longlong_t)obsolete_bpobj_count, + (u_longlong_t)remap_deadlist_count); + } else { + (void) printf("Verified indirect_refcount feature refcount " \ + "of %llu is correct\n", + (u_longlong_t)oc_feature_refcount); + } + return (ret); +} + static void dump_zpool(spa_t *spa) { @@ -3308,18 +3867,24 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { + dsl_pool_t *dp = spa->spa_dsl_pool; dump_full_bpobj(&spa->spa_deferred_bpobj, "Deferred frees", 0); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { - dump_full_bpobj( - &spa->spa_dsl_pool->dp_free_bpobj, + dump_full_bpobj(&dp->dp_free_bpobj, "Pool snapshot frees", 0); } + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + dump_full_bpobj(&dp->dp_obsolete_bpobj, + "Pool obsolete blocks", 0); + } if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) { dump_bptree(spa->spa_meta_objset, - spa->spa_dsl_pool->dp_bptree_obj, + dp->dp_bptree_obj, "Pool dataset frees"); } dump_dtl(spa->spa_root_vdev, 0); @@ -3351,6 +3916,10 @@ dump_zpool(spa_t *spa) (longlong_t)refcount); } } + + if (rc == 0) { + rc = verify_device_removal_feature_counts(spa); + } } if (rc == 0 && (dump_opt['b'] || dump_opt['c'])) rc = dump_block_stats(spa); @@ -3661,7 +4230,8 @@ zdb_read_block(char *thing, spa_t *spa) psize, ZIO_TYPE_READ, ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY | - ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW, NULL, NULL)); + ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW | ZIO_FLAG_OPTIONAL, + NULL, NULL)); } error = zio_wait(zio); Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Feb 21 16:50:41 2018 (r329731) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Feb 21 16:51:02 2018 (r329732) @@ -112,6 +112,7 @@ static int zfs_do_diff(int argc, char **argv); static int zfs_do_jail(int argc, char **argv); static int zfs_do_unjail(int argc, char **argv); static int zfs_do_bookmark(int argc, char **argv); +static int zfs_do_remap(int argc, char **argv); static int zfs_do_channel_program(int argc, char **argv); /* @@ -161,6 +162,7 @@ typedef enum { HELP_HOLDS, HELP_RELEASE, HELP_DIFF, + HELP_REMAP, HELP_BOOKMARK, HELP_CHANNEL_PROGRAM, } zfs_help_t; @@ -220,6 +222,7 @@ static zfs_command_t command_table[] = { { NULL }, { "jail", zfs_do_jail, HELP_JAIL }, { "unjail", zfs_do_unjail, HELP_UNJAIL }, + { "remap", zfs_do_remap, HELP_REMAP }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -342,6 +345,8 @@ get_usage(zfs_help_t idx) case HELP_DIFF: return (gettext("\tdiff [-FHt] " "[snapshot|filesystem]\n")); + case HELP_REMAP: + return (gettext("\tremap \n")); case HELP_BOOKMARK: return (gettext("\tbookmark \n")); case HELP_CHANNEL_PROGRAM: @@ -4170,6 +4175,7 @@ zfs_do_receive(int argc, char **argv) #define ZFS_DELEG_PERM_RELEASE "release" #define ZFS_DELEG_PERM_DIFF "diff" #define ZFS_DELEG_PERM_BOOKMARK "bookmark" +#define ZFS_DELEG_PERM_REMAP "remap" #define ZFS_NUM_DELEG_NOTES ZFS_DELEG_NOTE_NONE @@ -4190,6 +4196,7 @@ static zfs_deleg_perm_tab_t zfs_deleg_perm_tbl[] = { { ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE }, { ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT }, { ZFS_DELEG_PERM_BOOKMARK, ZFS_DELEG_NOTE_BOOKMARK }, + { ZFS_DELEG_PERM_REMAP, ZFS_DELEG_NOTE_REMAP }, { ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA }, { ZFS_DELEG_PERM_GROUPUSED, ZFS_DELEG_NOTE_GROUPUSED }, @@ -6978,7 +6985,7 @@ zfs_do_diff(int argc, char **argv) if (argc < 1) { (void) fprintf(stderr, - gettext("must provide at least one snapshot name\n")); + gettext("must provide at least one snapshot name\n")); usage(B_FALSE); } @@ -7017,6 +7024,22 @@ zfs_do_diff(int argc, char **argv) zfs_close(zhp); return (err != 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 16:57:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69132F14DBF; Wed, 21 Feb 2018 16:57:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 167BD86217; Wed, 21 Feb 2018 16:57:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 116561B35F; Wed, 21 Feb 2018 16:57:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LGv3Ge074209; Wed, 21 Feb 2018 16:57:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LGv3X2074208; Wed, 21 Feb 2018 16:57:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211657.w1LGv3X2074208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 16:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329733 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 16:57:04 -0000 Author: kevans Date: Wed Feb 21 16:57:03 2018 New Revision: 329733 URL: https://svnweb.freebsd.org/changeset/base/329733 Log: lualoader: Make kernel autodetection contingent on loader.conf(5) var Instead of based it off of whether 'kernels' was specified, base it off of a new variable: kernels_autodetect. If set to yes, we'll run the autodetection bits and add any detected kernels to the already existing list *after* both 'kernel' and 'kernels'. Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Wed Feb 21 16:51:02 2018 (r329732) +++ head/stand/lua/core.lua Wed Feb 21 16:57:03 2018 (r329733) @@ -189,6 +189,7 @@ end function core.kernelList() local k = loader.getenv("kernel") local v = loader.getenv("kernels") + local autodetect = loader.getenv("kernels_autodetect") or "" local kernels = {} local unique = {} @@ -207,9 +208,12 @@ function core.kernelList() unique[n] = true end end + end - -- We will not automatically detect kernels to be displayed if - -- loader.conf(5) explicitly set 'kernels'. + -- Base whether we autodetect kernels or not on a loader.conf(5) + -- setting, kernels_autodetect. If it's set to 'yes', we'll add + -- any kernels we detect based on the criteria described. + if autodetect:lower() ~= "yes" then return kernels end From owner-svn-src-all@freebsd.org Wed Feb 21 17:03:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25AC9F159C7; Wed, 21 Feb 2018 17:03:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABC3486984; Wed, 21 Feb 2018 17:03:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f48.google.com with SMTP id d10so3073991itj.2; Wed, 21 Feb 2018 09:03:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=CqY6p4dJa820/WAYZFvRerX3ahP3ocIbQiAzlkBJbys=; b=TyBFgwFCarEDa8h3O1kr33C/hcQggPE1wjFcuL8PntgY/s5qO4VjCQozz/nZa02Avk Mr1NK+nZytJcatMe9f4m5N7MlBRT1Xtggc7VbnHf2xIAj6zwWXgx+TNBlhm66+JBXmTc oARzR+Q+PJWp6ZeEHCgJiJLYZovQQ12UyrEjql2xmOZrXFDV6XfpIpNp1GOoAJJcld0z nk/m1asEU7sq2PRYyXYdIuT6hnovQnKBYekJKNkTVa7mue3xU3D4NkBWr8U03dIh7mWF DXqDBaGvRk20DyrDTNL1I2E3WJ+QnJHunQDboH0Gp3ElHuf0EKrdOGYb7i24Es7UWIzp yF9A== X-Gm-Message-State: APf1xPA7VDTM/f9AtMQLMkJZQT3K4JECBtBMqyQrICoOZVE75g3LieEe 7532NR6qAvB+pvzBZKCVuuQjzH/J X-Google-Smtp-Source: AH8x224t+0TfepcUu88UBKK/OEgh5NKpn8KIR/IvbqHlw8ExGhuKD4ah8vxqbbIYOrP27n++DNGuHg== X-Received: by 10.36.78.133 with SMTP id r127mr4085513ita.36.1519232578941; Wed, 21 Feb 2018 09:02:58 -0800 (PST) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com. [209.85.223.172]) by smtp.gmail.com with ESMTPSA id i21sm11826206itb.18.2018.02.21.09.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 09:02:58 -0800 (PST) Received: by mail-io0-f172.google.com with SMTP id l12so2836482ioc.10; Wed, 21 Feb 2018 09:02:58 -0800 (PST) X-Received: by 10.107.41.16 with SMTP id p16mr4985054iop.173.1519232578342; Wed, 21 Feb 2018 09:02:58 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Wed, 21 Feb 2018 09:02:57 -0800 (PST) In-Reply-To: References: <201802200006.w1K067ZL032311@repo.freebsd.org> From: Conrad Meyer Date: Wed, 21 Feb 2018 09:02:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329612 - in head/sys: kern sys To: Andrew Turner Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 17:03:06 -0000 Do you have r329672 yet? Best, Conrad On Wed, Feb 21, 2018 at 7:11 AM, Andrew Turner wrote= : > >> On 20 Feb 2018, at 00:06, Jeff Roberson wrote: >> >> Author: jeff >> Date: Tue Feb 20 00:06:07 2018 >> New Revision: 329612 >> URL: https://svnweb.freebsd.org/changeset/base/329612 >> >> Log: >> Further parallelize the buffer cache. >> >> Provide multiple clean queues partitioned into 'domains'. Each domain = manages >> its own bufspace and has its own bufspace daemon. Each domain has a se= t of >> subqueues indexed by the current cpuid to reduce lock contention on the= cleanq. >> >> Refine the sleep/wakeup around the bufspace daemon to use atomics as mu= ch as >> possible. >> >> Add a B_REUSE flag that is used to requeue bufs during the scan to appr= oximate >> LRU rather than locking the queue on every use of a frequently accessed= buf. >> >> Implement bufspace_reserve with only atomic_fetchadd to avoid loop rest= arts. >> >> Reviewed by: markj >> Tested by: pho >> Sponsored by: Netflix, Dell/EMC Isilon >> Differential Revision: https://reviews.freebsd.org/D14274 > > I=E2=80=99m seeing the following panic on FreeBSD/arm64 after this change= . > > Andrew > > panic: bq_remove: Remove buffer 0xffff00004082f260 from wrong queue. > cpuid =3D 4 > time =3D 1519088201 > KDB: stack backtrace: > db_trace_self() at db_trace_self_wrapper+0x28 > pc =3D 0xffff00000062fee4 lr =3D 0xffff0000000c0450 > sp =3D 0xffff000040364480 fp =3D 0xffff000040364690 > > db_trace_self_wrapper() at vpanic+0x184 > pc =3D 0xffff0000000c0450 lr =3D 0xffff000000354ce8 > sp =3D 0xffff0000403646a0 fp =3D 0xffff000040364720 > > vpanic() at kassert_panic+0x158 > pc =3D 0xffff000000354ce8 lr =3D 0xffff000000354b60 > sp =3D 0xffff000040364730 fp =3D 0xffff0000403647f0 > > kassert_panic() at bq_remove+0x178 > pc =3D 0xffff000000354b60 lr =3D 0xffff0000003f7014 > sp =3D 0xffff000040364800 fp =3D 0xffff000040364810 > > bq_remove() at buf_recycle+0x100 > pc =3D 0xffff0000003f7014 lr =3D 0xffff0000003fca80 > sp =3D 0xffff000040364820 fp =3D 0xffff000040364880 > > buf_recycle() at bufspace_daemon+0xb4 > pc =3D 0xffff0000003fca80 lr =3D 0xffff0000003fd31c > sp =3D 0xffff000040364890 fp =3D 0xffff000040364910 > > bufspace_daemon() at fork_exit+0x7c > pc =3D 0xffff0000003fd31c lr =3D 0xffff000000318388 > sp =3D 0xffff000040364920 fp =3D 0xffff000040364950 > > fork_exit() at fork_trampoline+0x10 > pc =3D 0xffff000000318388 lr =3D 0xffff000000649ec4 > sp =3D 0xffff000040364960 fp =3D 0x0000000000000000 > > KDB: enter: panic From owner-svn-src-all@freebsd.org Wed Feb 21 17:06:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B4E5F15DF7; Wed, 21 Feb 2018 17:06:10 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id D995086BA8; Wed, 21 Feb 2018 17:06:08 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:5c38:d7dc:2091:57b5] (unknown [IPv6:2001:630:212:2a8:5c38:d7dc:2091:57b5]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id CC7854E63F; Wed, 21 Feb 2018 17:06:07 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329612 - in head/sys: kern sys From: Andrew Turner In-Reply-To: Date: Wed, 21 Feb 2018 17:06:06 +0000 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201802200006.w1K067ZL032311@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 17:06:10 -0000 Yes, I=E2=80=99m still getting it on r329721. Andrew > On 21 Feb 2018, at 17:02, Conrad Meyer wrote: >=20 > Do you have r329672 yet? >=20 > Best, > Conrad >=20 > On Wed, Feb 21, 2018 at 7:11 AM, Andrew Turner = wrote: >>=20 >>> On 20 Feb 2018, at 00:06, Jeff Roberson wrote: >>>=20 >>> Author: jeff >>> Date: Tue Feb 20 00:06:07 2018 >>> New Revision: 329612 >>> URL: https://svnweb.freebsd.org/changeset/base/329612 >>>=20 >>> Log: >>> Further parallelize the buffer cache. >>>=20 >>> Provide multiple clean queues partitioned into 'domains'. Each = domain manages >>> its own bufspace and has its own bufspace daemon. Each domain has a = set of >>> subqueues indexed by the current cpuid to reduce lock contention on = the cleanq. >>>=20 >>> Refine the sleep/wakeup around the bufspace daemon to use atomics as = much as >>> possible. >>>=20 >>> Add a B_REUSE flag that is used to requeue bufs during the scan to = approximate >>> LRU rather than locking the queue on every use of a frequently = accessed buf. >>>=20 >>> Implement bufspace_reserve with only atomic_fetchadd to avoid loop = restarts. >>>=20 >>> Reviewed by: markj >>> Tested by: pho >>> Sponsored by: Netflix, Dell/EMC Isilon >>> Differential Revision: https://reviews.freebsd.org/D14274 >>=20 >> I=E2=80=99m seeing the following panic on FreeBSD/arm64 after this = change. >>=20 >> Andrew >>=20 >> panic: bq_remove: Remove buffer 0xffff00004082f260 from wrong queue. >> cpuid =3D 4 >> time =3D 1519088201 >> KDB: stack backtrace: >> db_trace_self() at db_trace_self_wrapper+0x28 >> pc =3D 0xffff00000062fee4 lr =3D 0xffff0000000c0450 >> sp =3D 0xffff000040364480 fp =3D 0xffff000040364690 >>=20 >> db_trace_self_wrapper() at vpanic+0x184 >> pc =3D 0xffff0000000c0450 lr =3D 0xffff000000354ce8 >> sp =3D 0xffff0000403646a0 fp =3D 0xffff000040364720 >>=20 >> vpanic() at kassert_panic+0x158 >> pc =3D 0xffff000000354ce8 lr =3D 0xffff000000354b60 >> sp =3D 0xffff000040364730 fp =3D 0xffff0000403647f0 >>=20 >> kassert_panic() at bq_remove+0x178 >> pc =3D 0xffff000000354b60 lr =3D 0xffff0000003f7014 >> sp =3D 0xffff000040364800 fp =3D 0xffff000040364810 >>=20 >> bq_remove() at buf_recycle+0x100 >> pc =3D 0xffff0000003f7014 lr =3D 0xffff0000003fca80 >> sp =3D 0xffff000040364820 fp =3D 0xffff000040364880 >>=20 >> buf_recycle() at bufspace_daemon+0xb4 >> pc =3D 0xffff0000003fca80 lr =3D 0xffff0000003fd31c >> sp =3D 0xffff000040364890 fp =3D 0xffff000040364910 >>=20 >> bufspace_daemon() at fork_exit+0x7c >> pc =3D 0xffff0000003fd31c lr =3D 0xffff000000318388 >> sp =3D 0xffff000040364920 fp =3D 0xffff000040364950 >>=20 >> fork_exit() at fork_trampoline+0x10 >> pc =3D 0xffff000000318388 lr =3D 0xffff000000649ec4 >> sp =3D 0xffff000040364960 fp =3D 0x0000000000000000 >>=20 >> KDB: enter: panic >=20 From owner-svn-src-all@freebsd.org Wed Feb 21 17:33:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF242F1829A; Wed, 21 Feb 2018 17:33:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8541E87E70; Wed, 21 Feb 2018 17:33:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8046C1B9C4; Wed, 21 Feb 2018 17:33:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LHX1qS094339; Wed, 21 Feb 2018 17:33:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LHX1Fo094338; Wed, 21 Feb 2018 17:33:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211733.w1LHX1Fo094338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 17:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329734 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 17:33:02 -0000 Author: kevans Date: Wed Feb 21 17:33:01 2018 New Revision: 329734 URL: https://svnweb.freebsd.org/changeset/base/329734 Log: lualoader: Don't execute menu.autoboot() for every opened menu Attempt to autoboot when we open the default menu, and only when we open the default menu. This alleviates the need for checking menu.already_autoboot, because we're not trying to autoboot every time we open a submenu. I note that escaping to loader prompt and going back to the menu (by running require('menu').run() at the loader prompt) will happily work and not re-initiate the autoboot sequence since "Escape to loader prompt" disables the autoboot_delay. Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Feb 21 16:57:03 2018 (r329733) +++ head/stand/lua/menu.lua Wed Feb 21 17:33:01 2018 (r329734) @@ -361,8 +361,10 @@ function menu.run(m) local alias_table = drawer.drawscreen(m) -- Might return nil, that's ok - local autoboot_key = menu.autoboot() - + local autoboot_key; + if m == menu.default then + autoboot_key = menu.autoboot() + end cont = true while cont do local key = autoboot_key or io.getchar() @@ -430,11 +432,6 @@ function menu.skip() end function menu.autoboot() - if menu.already_autoboot then - return nil - end - menu.already_autoboot = true - local ab = loader.getenv("autoboot_delay") if ab ~= nil and ab:lower() == "no" then return nil From owner-svn-src-all@freebsd.org Wed Feb 21 17:46:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3962BF19082; Wed, 21 Feb 2018 17:46:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB82C685F6; Wed, 21 Feb 2018 17:46:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D66FB1BB5C; Wed, 21 Feb 2018 17:46:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LHkDMo099327; Wed, 21 Feb 2018 17:46:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LHkDIW099326; Wed, 21 Feb 2018 17:46:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802211746.w1LHkDIW099326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Feb 2018 17:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r329735 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 329735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 17:46:14 -0000 Author: brooks Date: Wed Feb 21 17:46:13 2018 New Revision: 329735 URL: https://svnweb.freebsd.org/changeset/base/329735 Log: Remove my entry. Its been years since I needed it. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Wed Feb 21 17:33:01 2018 (r329734) +++ svnadmin/conf/sizelimit.conf Wed Feb 21 17:46:13 2018 (r329735) @@ -16,7 +16,6 @@ # First field is username, second field is the raised limit required. achim bapt -brooks davidcs dim imp From owner-svn-src-all@freebsd.org Wed Feb 21 18:09:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1D14F1AA51; Wed, 21 Feb 2018 18:09:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9333E693E5; Wed, 21 Feb 2018 18:09:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E21F1BE82; Wed, 21 Feb 2018 18:09:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LI97x5011698; Wed, 21 Feb 2018 18:09:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LI97iE011697; Wed, 21 Feb 2018 18:09:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802211809.w1LI97iE011697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 18:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329736 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:09:08 -0000 Author: mav Date: Wed Feb 21 18:09:07 2018 New Revision: 329736 URL: https://svnweb.freebsd.org/changeset/base/329736 Log: 8969 Cannot boot from RAIDZ with parity > 1 illumos/illumos-gate@0fb055e81fd0cda5221da8ddd98b2f8d1fc6bdbe At present it is possible to boot from a root pool that is on RAIDZ but not one that is on RAIDZ2 or RAIDZ3. This is because, at the time the pool version is checked to ensure support for dual/triple parity, the uberblock has not yet been loaded into the SPA and therefore the code determines that the pool version is too old and returns ENOTSUP. Reviewed by: Igor Kozhukhov Reviewed by: Andriy Gapon Reviewed by: Pavel Zakharov Reviewed by: Andy Stormont Reviewed by: Toomas Soome Approved by: Gordon Ross Author: Andy Fiddaman Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 17:46:13 2018 (r329735) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 18:09:07 2018 (r329736) @@ -29,6 +29,7 @@ * Copyright 2016 Toomas Soome * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -4051,6 +4052,9 @@ spa_import_rootpool(char *devpath, char *devid) spa = spa_add(pname, config, NULL); spa->spa_is_root = B_TRUE; spa->spa_import_flags = ZFS_IMPORT_VERBATIM; + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &spa->spa_ubsync.ub_version) != 0) + spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; /* * Build up a vdev tree based on the boot device's label config. From owner-svn-src-all@freebsd.org Wed Feb 21 18:10:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95852F1ACDE; Wed, 21 Feb 2018 18:10:51 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47332696E7; Wed, 21 Feb 2018 18:10:51 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41F561BE9F; Wed, 21 Feb 2018 18:10:51 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LIApXr012657; Wed, 21 Feb 2018 18:10:51 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LIApvC012656; Wed, 21 Feb 2018 18:10:51 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201802211810.w1LIApvC012656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Wed, 21 Feb 2018 18:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329737 - head/stand/i386/boot2 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/stand/i386/boot2 X-SVN-Commit-Revision: 329737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:10:52 -0000 Author: benno Date: Wed Feb 21 18:10:50 2018 New Revision: 329737 URL: https://svnweb.freebsd.org/changeset/base/329737 Log: Purely whitespace changes bringing this file closer to style(9). Curiously, changing whitespace seems to cause the md5 of the .o files to differ these days hence the following testing strategy: Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) Modified: head/stand/i386/boot2/boot2.c Modified: head/stand/i386/boot2/boot2.c ============================================================================== --- head/stand/i386/boot2/boot2.c Wed Feb 21 18:09:07 2018 (r329736) +++ head/stand/i386/boot2/boot2.c Wed Feb 21 18:10:50 2018 (r329737) @@ -72,33 +72,33 @@ extern uint32_t _end; static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ static const unsigned char flags[NOPT] = { - RBX_DUAL, - RBX_SERIAL, - RBX_ASKNAME, - RBX_CDROM, - RBX_CONFIG, - RBX_KDB, - RBX_GDB, - RBX_MUTE, - RBX_NOINTR, - RBX_PAUSE, - RBX_QUIET, - RBX_DFLTROOT, - RBX_SINGLE, - RBX_VERBOSE + RBX_DUAL, + RBX_SERIAL, + RBX_ASKNAME, + RBX_CDROM, + RBX_CONFIG, + RBX_KDB, + RBX_GDB, + RBX_MUTE, + RBX_NOINTR, + RBX_PAUSE, + RBX_QUIET, + RBX_DFLTROOT, + RBX_SINGLE, + RBX_VERBOSE }; static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; static struct dsk { - unsigned drive; - unsigned type; - unsigned unit; - uint8_t slice; - uint8_t part; - unsigned start; - int init; + unsigned drive; + unsigned type; + unsigned unit; + uint8_t slice; + uint8_t part; + unsigned start; + int init; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; @@ -126,18 +126,19 @@ static void memcpy(void *, const void *, int); static void memcpy(void *dst, const void *src, int len) { - const char *s = src; - char *d = dst; + const char *s = src; + char *d = dst; - while (len--) - *d++ = *s++; + while (len--) + *d++ = *s++; } static inline int strcmp(const char *s1, const char *s2) { - for (; *s1 == *s2 && *s1; s1++, s2++); - return (unsigned char)*s1 - (unsigned char)*s2; + + for (; *s1 == *s2 && *s1; s1++, s2++); + return (unsigned char)*s1 - (unsigned char)*s2; } #define UFS_SMALL_CGBASE @@ -146,501 +147,512 @@ strcmp(const char *s1, const char *s2) static int xfsread(ufs_ino_t inode, void *buf, size_t nbyte) { - if ((size_t)fsread(inode, buf, nbyte) != nbyte) { - printf("Invalid %s\n", "format"); - return -1; - } - return 0; + + if ((size_t)fsread(inode, buf, nbyte) != nbyte) { + printf("Invalid %s\n", "format"); + return -1; + } + return 0; } static inline void getstr(void) { - char *s; - int c; + char *s; + int c; - s = cmd; - for (;;) { - switch (c = xgetc(0)) { - case 0: - break; - case '\177': - case '\b': - if (s > cmd) { - s--; - printf("\b \b"); - } - break; - case '\n': - case '\r': - *s = 0; - return; - default: - if (s - cmd < sizeof(cmd) - 1) - *s++ = c; - putchar(c); + s = cmd; + for (;;) { + switch (c = xgetc(0)) { + case 0: + break; + case '\177': + case '\b': + if (s > cmd) { + s--; + printf("\b \b"); + } + break; + case '\n': + case '\r': + *s = 0; + return; + default: + if (s - cmd < sizeof(cmd) - 1) + *s++ = c; + putchar(c); + } } - } } static inline void putc(int c) { - v86.addr = 0x10; - v86.eax = 0xe00 | (c & 0xff); - v86.ebx = 0x7; - v86int(); + + v86.addr = 0x10; + v86.eax = 0xe00 | (c & 0xff); + v86.ebx = 0x7; + v86int(); } int main(void) { - uint8_t autoboot; - ufs_ino_t ino; - size_t nbyte; + uint8_t autoboot; + ufs_ino_t ino; + size_t nbyte; - dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); - v86.ctl = V86_FLAGS; - v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - dsk.drive = *(uint8_t *)PTOV(ARGS); - dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; - dsk.unit = dsk.drive & DRV_MASK; - dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_size = sizeof(bootinfo); + dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); + v86.ctl = V86_FLAGS; + v86.efl = PSL_RESERVED_DEFAULT | PSL_I; + dsk.drive = *(uint8_t *)PTOV(ARGS); + dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; + dsk.unit = dsk.drive & DRV_MASK; + dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; + bootinfo.bi_version = BOOTINFO_VERSION; + bootinfo.bi_size = sizeof(bootinfo); - /* Process configuration file */ + /* Process configuration file */ - autoboot = 1; + autoboot = 1; - if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) { - nbyte = fsread(ino, cmd, sizeof(cmd) - 1); - cmd[nbyte] = '\0'; - } + if ((ino = lookup(PATH_CONFIG)) || + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } - if (*cmd) { - memcpy(cmddup, cmd, sizeof(cmd)); - if (parse()) - autoboot = 0; - if (!OPT_CHECK(RBX_QUIET)) - printf("%s: %s", PATH_CONFIG, cmddup); - /* Do not process this command twice */ - *cmd = 0; - } + if (*cmd) { + memcpy(cmddup, cmd, sizeof(cmd)); + if (parse()) + autoboot = 0; + if (!OPT_CHECK(RBX_QUIET)) + printf("%s: %s", PATH_CONFIG, cmddup); + /* Do not process this command twice */ + *cmd = 0; + } - /* - * Try to exec stage 3 boot loader. If interrupted by a keypress, - * or in case of failure, try to load a kernel directly instead. - */ + /* + * Try to exec stage 3 boot loader. If interrupted by a keypress, + * or in case of failure, try to load a kernel directly instead. + */ - if (!kname) { - kname = PATH_LOADER; - if (autoboot && !keyhit(3*SECOND)) { - load(); - kname = PATH_KERNEL; + if (!kname) { + kname = PATH_LOADER; + if (autoboot && !keyhit(3*SECOND)) { + load(); + kname = PATH_KERNEL; + } } - } - /* Present the user with the boot2 prompt. */ + /* Present the user with the boot2 prompt. */ - for (;;) { - if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/x86 boot\n" - "Default: %u:%s(%u,%c)%s\n" - "boot: ", - dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, - 'a' + dsk.part, kname); - if (DO_SIO) - sio_flush(); - if (!autoboot || keyhit(3*SECOND)) - getstr(); - else if (!autoboot || !OPT_CHECK(RBX_QUIET)) - putchar('\n'); - autoboot = 0; - if (parse()) - putchar('\a'); - else - load(); - } + for (;;) { + if (!autoboot || !OPT_CHECK(RBX_QUIET)) + printf("\nFreeBSD/x86 boot\n" + "Default: %u:%s(%u,%c)%s\n" + "boot: ", + dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, + 'a' + dsk.part, kname); + if (DO_SIO) + sio_flush(); + if (!autoboot || keyhit(3*SECOND)) + getstr(); + else if (!autoboot || !OPT_CHECK(RBX_QUIET)) + putchar('\n'); + autoboot = 0; + if (parse()) + putchar('\a'); + else + load(); + } } /* XXX - Needed for btxld to link the boot2 binary; do not remove. */ void exit(int x) { + } static void load(void) { - union { - struct exec ex; - Elf32_Ehdr eh; - } hdr; - static Elf32_Phdr ep[2]; - static Elf32_Shdr es[2]; - caddr_t p; - ufs_ino_t ino; - uint32_t addr; - int k; - uint8_t i, j; + union { + struct exec ex; + Elf32_Ehdr eh; + } hdr; + static Elf32_Phdr ep[2]; + static Elf32_Shdr es[2]; + caddr_t p; + ufs_ino_t ino; + uint32_t addr; + int k; + uint8_t i, j; - if (!(ino = lookup(kname))) { - if (!ls) - printf("No %s\n", kname); - return; - } - if (xfsread(ino, &hdr, sizeof(hdr))) - return; - - if (N_GETMAGIC(hdr.ex) == ZMAGIC) { - addr = hdr.ex.a_entry & 0xffffff; - p = PTOV(addr); - fs_off = PAGE_SIZE; - if (xfsread(ino, p, hdr.ex.a_text)) - return; - p += roundup2(hdr.ex.a_text, PAGE_SIZE); - if (xfsread(ino, p, hdr.ex.a_data)) - return; - } else if (IS_ELF(hdr.eh)) { - fs_off = hdr.eh.e_phoff; - for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { - if (xfsread(ino, ep + j, sizeof(ep[0]))) + if (!(ino = lookup(kname))) { + if (!ls) + printf("No %s\n", kname); return; - if (ep[j].p_type == PT_LOAD) - j++; } - for (i = 0; i < 2; i++) { - p = PTOV(ep[i].p_paddr & 0xffffff); - fs_off = ep[i].p_offset; - if (xfsread(ino, p, ep[i].p_filesz)) + if (xfsread(ino, &hdr, sizeof(hdr))) return; - } - p += roundup2(ep[1].p_memsz, PAGE_SIZE); - bootinfo.bi_symtab = VTOP(p); - if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { - fs_off = hdr.eh.e_shoff + sizeof(es[0]) * - (hdr.eh.e_shstrndx + 1); - if (xfsread(ino, &es, sizeof(es))) + + if (N_GETMAGIC(hdr.ex) == ZMAGIC) { + addr = hdr.ex.a_entry & 0xffffff; + p = PTOV(addr); + fs_off = PAGE_SIZE; + if (xfsread(ino, p, hdr.ex.a_text)) + return; + p += roundup2(hdr.ex.a_text, PAGE_SIZE); + if (xfsread(ino, p, hdr.ex.a_data)) + return; + } else if (IS_ELF(hdr.eh)) { + fs_off = hdr.eh.e_phoff; + for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { + if (xfsread(ino, ep + j, sizeof(ep[0]))) + return; + if (ep[j].p_type == PT_LOAD) + j++; + } + for (i = 0; i < 2; i++) { + p = PTOV(ep[i].p_paddr & 0xffffff); + fs_off = ep[i].p_offset; + if (xfsread(ino, p, ep[i].p_filesz)) + return; + } + p += roundup2(ep[1].p_memsz, PAGE_SIZE); + bootinfo.bi_symtab = VTOP(p); + if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { + fs_off = hdr.eh.e_shoff + sizeof(es[0]) * + (hdr.eh.e_shstrndx + 1); + if (xfsread(ino, &es, sizeof(es))) + return; + for (i = 0; i < 2; i++) { + *(Elf32_Word *)p = es[i].sh_size; + p += sizeof(es[i].sh_size); + fs_off = es[i].sh_offset; + if (xfsread(ino, p, es[i].sh_size)) + return; + p += es[i].sh_size; + } + } + addr = hdr.eh.e_entry & 0xffffff; + bootinfo.bi_esymtab = VTOP(p); + } else { + printf("Invalid %s\n", "format"); return; - for (i = 0; i < 2; i++) { - *(Elf32_Word *)p = es[i].sh_size; - p += sizeof(es[i].sh_size); - fs_off = es[i].sh_offset; - if (xfsread(ino, p, es[i].sh_size)) - return; - p += es[i].sh_size; - } } - addr = hdr.eh.e_entry & 0xffffff; - bootinfo.bi_esymtab = VTOP(p); - } else { - printf("Invalid %s\n", "format"); - return; - } - bootinfo.bi_kernelname = VTOP(kname); - bootinfo.bi_bios_dev = dsk.drive; - __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), - MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), - 0, 0, 0, VTOP(&bootinfo)); + bootinfo.bi_kernelname = VTOP(kname); + bootinfo.bi_bios_dev = dsk.drive; + __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), + MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), + 0, 0, 0, VTOP(&bootinfo)); } static int parse() { - char *arg = cmd; - char *ep, *p, *q; - const char *cp; - unsigned int drv; - int c, i, j; - size_t k; + char *arg = cmd; + char *ep, *p, *q; + const char *cp; + unsigned int drv; + int c, i, j; + size_t k; - while ((c = *arg++)) { - if (c == ' ' || c == '\t' || c == '\n') - continue; - for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); - ep = p; - if (*p) - *p++ = 0; - if (c == '-') { - while ((c = *arg++)) { - if (c == 'P') { - if (*(uint8_t *)PTOV(0x496) & 0x10) { - cp = "yes"; - } else { - opts |= OPT_SET(RBX_DUAL) | OPT_SET(RBX_SERIAL); - cp = "no"; - } - printf("Keyboard: %s\n", cp); - continue; + while ((c = *arg++)) { + if (c == ' ' || c == '\t' || c == '\n') + continue; + for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); + ep = p; + if (*p) + *p++ = 0; + if (c == '-') { + while ((c = *arg++)) { + if (c == 'P') { + if (*(uint8_t *)PTOV(0x496) & 0x10) { + cp = "yes"; + } else { + opts |= OPT_SET(RBX_DUAL) | + OPT_SET(RBX_SERIAL); + cp = "no"; + } + printf("Keyboard: %s\n", cp); + continue; #if SERIAL - } else if (c == 'S') { - j = 0; - while ((unsigned int)(i = *arg++ - '0') <= 9) - j = j * 10 + i; - if (j > 0 && i == -'0') { - comspeed = j; - break; - } - /* Fall through to error below ('S' not in optstr[]). */ + } else if (c == 'S') { + j = 0; + while ((u_int)(i = *arg++ - '0') <= 9) + j = j * 10 + i; + if (j > 0 && i == -'0') { + comspeed = j; + break; + } + /* + * Fall through to error below + * ('S' not in optstr[]). + */ #endif - } - for (i = 0; c != optstr[i]; i++) - if (i == NOPT - 1) - return -1; - opts ^= OPT_SET(flags[i]); - } + } + for (i = 0; c != optstr[i]; i++) + if (i == NOPT - 1) + return -1; + opts ^= OPT_SET(flags[i]); + } #if SERIAL - ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : - OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (DO_SIO) { - if (sio_init(115200 / comspeed) != 0) - ioctrl &= ~IO_SERIAL; - } + ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : + OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; + if (DO_SIO) { + if (sio_init(115200 / comspeed) != 0) + ioctrl &= ~IO_SERIAL; + } #endif - } else { - for (q = arg--; *q && *q != '('; q++); - if (*q) { - drv = -1; - if (arg[1] == ':') { - drv = *arg - '0'; - if (drv > 9) - return (-1); - arg += 2; + } else { + for (q = arg--; *q && *q != '('; q++); + if (*q) { + drv = -1; + if (arg[1] == ':') { + drv = *arg - '0'; + if (drv > 9) + return (-1); + arg += 2; + } + if (q - arg != 2) + return (-1); + for (i = 0; arg[0] != dev_nm[i][0] || + arg[1] != dev_nm[i][1]; i++) + if (i == NDEV - 1) + return -1; + dsk.type = i; + arg += 3; + dsk.unit = *arg - '0'; + if (arg[1] != ',' || dsk.unit > 9) + return -1; + arg += 2; + dsk.slice = WHOLE_DISK_SLICE; + if (arg[1] == ',') { + dsk.slice = *arg - '0' + 1; + if (dsk.slice > NDOSPART + 1) + return -1; + arg += 2; + } + if (arg[1] != ')') + return -1; + dsk.part = *arg - 'a'; + if (dsk.part > 7) + return (-1); + arg += 2; + if (drv == -1) + drv = dsk.unit; + dsk.drive = (dsk.type <= TYPE_MAXHARD + ? DRV_HARD : 0) + drv; + dsk_meta = 0; + } + k = ep - arg; + if (k > 0) { + if (k >= sizeof(knamebuf)) + return -1; + memcpy(knamebuf, arg, k + 1); + kname = knamebuf; + } } - if (q - arg != 2) - return -1; - for (i = 0; arg[0] != dev_nm[i][0] || - arg[1] != dev_nm[i][1]; i++) - if (i == NDEV - 1) - return -1; - dsk.type = i; - arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) - return -1; - arg += 2; - dsk.slice = WHOLE_DISK_SLICE; - if (arg[1] == ',') { - dsk.slice = *arg - '0' + 1; - if (dsk.slice > NDOSPART + 1) - return -1; - arg += 2; - } - if (arg[1] != ')') - return -1; - dsk.part = *arg - 'a'; - if (dsk.part > 7) - return (-1); - arg += 2; - if (drv == -1) - drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD - ? DRV_HARD : 0) + drv; - dsk_meta = 0; - } - k = ep - arg; - if (k > 0) { - if (k >= sizeof(knamebuf)) - return -1; - memcpy(knamebuf, arg, k + 1); - kname = knamebuf; - } + arg = p; } - arg = p; - } - return 0; + return 0; } static int dskread(void *buf, unsigned lba, unsigned nblk) { - struct dos_partition *dp; - struct disklabel *d; - char *sec; - unsigned i; - uint8_t sl; - const char *reason; + struct dos_partition *dp; + struct disklabel *d; + char *sec; + unsigned i; + uint8_t sl; + const char *reason; - if (!dsk_meta) { - sec = dmadat->secbuf; - dsk.start = 0; - if (drvread(sec, DOSBBSECTOR, 1)) - return -1; - dp = (void *)(sec + DOSPARTOFF); - sl = dsk.slice; - if (sl < BASE_SLICE) { - for (i = 0; i < NDOSPART; i++) - if (dp[i].dp_typ == DOSPTYP_386BSD && - (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) { - sl = BASE_SLICE + i; - if (dp[i].dp_flag & 0x80 || - dsk.slice == COMPATIBILITY_SLICE) - break; + if (!dsk_meta) { + sec = dmadat->secbuf; + dsk.start = 0; + if (drvread(sec, DOSBBSECTOR, 1)) + return -1; + dp = (void *)(sec + DOSPARTOFF); + sl = dsk.slice; + if (sl < BASE_SLICE) { + for (i = 0; i < NDOSPART; i++) + if (dp[i].dp_typ == DOSPTYP_386BSD && + (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) { + sl = BASE_SLICE + i; + if (dp[i].dp_flag & 0x80 || + dsk.slice == COMPATIBILITY_SLICE) + break; + } + if (dsk.slice == WHOLE_DISK_SLICE) + dsk.slice = sl; } - if (dsk.slice == WHOLE_DISK_SLICE) - dsk.slice = sl; + if (sl != WHOLE_DISK_SLICE) { + if (sl != COMPATIBILITY_SLICE) + dp += sl - BASE_SLICE; + if (dp->dp_typ != DOSPTYP_386BSD) { + reason = "slice"; + goto error; + } + dsk.start = dp->dp_start; + } + if (drvread(sec, dsk.start + LABELSECTOR, 1)) + return -1; + d = (void *)(sec + LABELOFFSET); + if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { + if (dsk.part != RAW_PART) { + reason = "label"; + goto error; + } + } else { + if (!dsk.init) { + if (d->d_type == DTYPE_SCSI) + dsk.type = TYPE_DA; + dsk.init++; + } + if (dsk.part >= d->d_npartitions || + !d->d_partitions[dsk.part].p_size) { + reason = "partition"; + goto error; + } + dsk.start += d->d_partitions[dsk.part].p_offset; + dsk.start -= d->d_partitions[RAW_PART].p_offset; + } } - if (sl != WHOLE_DISK_SLICE) { - if (sl != COMPATIBILITY_SLICE) - dp += sl - BASE_SLICE; - if (dp->dp_typ != DOSPTYP_386BSD) { - reason = "slice"; - goto error; - } - dsk.start = dp->dp_start; - } - if (drvread(sec, dsk.start + LABELSECTOR, 1)) - return -1; - d = (void *)(sec + LABELOFFSET); - if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { - if (dsk.part != RAW_PART) { - reason = "label"; - goto error; - } - } else { - if (!dsk.init) { - if (d->d_type == DTYPE_SCSI) - dsk.type = TYPE_DA; - dsk.init++; - } - if (dsk.part >= d->d_npartitions || - !d->d_partitions[dsk.part].p_size) { - reason = "partition"; - goto error; - } - dsk.start += d->d_partitions[dsk.part].p_offset; - dsk.start -= d->d_partitions[RAW_PART].p_offset; - } - } - return drvread(buf, dsk.start + lba, nblk); + return drvread(buf, dsk.start + lba, nblk); error: - printf("Invalid %s\n", reason); - return -1; + printf("Invalid %s\n", reason); + return -1; } static void printf(const char *fmt,...) { - va_list ap; - static char buf[10]; - char *s; - unsigned u; - int c; + va_list ap; + static char buf[10]; + char *s; + unsigned u; + int c; - va_start(ap, fmt); - while ((c = *fmt++)) { - if (c == '%') { - c = *fmt++; - switch (c) { - case 'c': - putchar(va_arg(ap, int)); - continue; - case 's': - for (s = va_arg(ap, char *); *s; s++) - putchar(*s); - continue; - case 'u': - u = va_arg(ap, unsigned); - s = buf; - do - *s++ = '0' + u % 10U; - while (u /= 10U); - while (--s >= buf) - putchar(*s); - continue; - } + va_start(ap, fmt); + while ((c = *fmt++)) { + if (c == '%') { + c = *fmt++; + switch (c) { + case 'c': + putchar(va_arg(ap, int)); + continue; + case 's': + for (s = va_arg(ap, char *); *s; s++) + putchar(*s); + continue; + case 'u': + u = va_arg(ap, unsigned); + s = buf; + do + *s++ = '0' + u % 10U; + while (u /= 10U); + while (--s >= buf) + putchar(*s); + continue; + } + } + putchar(c); } - putchar(c); - } - va_end(ap); - return; + va_end(ap); + return; } static void putchar(int c) { - if (c == '\n') - xputc('\r'); - xputc(c); + + if (c == '\n') + xputc('\r'); + xputc(c); } static int drvread(void *buf, unsigned lba, unsigned nblk) { - static unsigned c = 0x2d5c7c2f; + static unsigned c = 0x2d5c7c2f; - if (!OPT_CHECK(RBX_QUIET)) { - xputc(c = c << 8 | c >> 24); - xputc('\b'); - } - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.addr = XREADORG; /* call to xread in boot1 */ - v86.es = VTOPSEG(buf); - v86.eax = lba; - v86.ebx = VTOPOFF(buf); - v86.ecx = lba >> 16; - v86.edx = nblk << 8 | dsk.drive; - v86int(); - v86.ctl = V86_FLAGS; - if (V86_CY(v86.efl)) { - printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); - return -1; - } - return 0; + if (!OPT_CHECK(RBX_QUIET)) { + xputc(c = c << 8 | c >> 24); + xputc('\b'); + } + v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; + v86.addr = XREADORG; /* call to xread in boot1 */ + v86.es = VTOPSEG(buf); + v86.eax = lba; + v86.ebx = VTOPOFF(buf); + v86.ecx = lba >> 16; + v86.edx = nblk << 8 | dsk.drive; + v86int(); + v86.ctl = V86_FLAGS; + if (V86_CY(v86.efl)) { + printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); + return -1; + } + return 0; } static int keyhit(unsigned ticks) { - uint32_t t0, t1; + uint32_t t0, t1; - if (OPT_CHECK(RBX_NOINTR)) - return 0; - t0 = 0; - for (;;) { - if (xgetc(1)) - return 1; - t1 = *(uint32_t *)PTOV(0x46c); - if (!t0) - t0 = t1; - if ((uint32_t)(t1 - t0) >= ticks) - return 0; - } + if (OPT_CHECK(RBX_NOINTR)) + return 0; + t0 = 0; + for (;;) { + if (xgetc(1)) + return 1; + t1 = *(uint32_t *)PTOV(0x46c); + if (!t0) + t0 = t1; + if ((uint32_t)(t1 - t0) >= ticks) + return 0; + } } static int xputc(int c) { - if (DO_KBD) - putc(c); - if (DO_SIO) - sio_putc(c); - return c; + + if (DO_KBD) + putc(c); + if (DO_SIO) + sio_putc(c); + return c; } static int getc(int fn) { - v86.addr = 0x16; - v86.eax = fn << 8; - v86int(); - return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); + + v86.addr = 0x16; + v86.eax = fn << 8; + v86int(); + return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); } static int xgetc(int fn) { - if (OPT_CHECK(RBX_NOINTR)) - return 0; - for (;;) { - if (DO_KBD && getc(1)) - return fn ? 1 : getc(0); - if (DO_SIO && sio_ischar()) - return fn ? 1 : sio_getc(); - if (fn) - return 0; - } + + if (OPT_CHECK(RBX_NOINTR)) + return 0; + for (;;) { + if (DO_KBD && getc(1)) + return fn ? 1 : getc(0); + if (DO_SIO && sio_ischar()) + return fn ? 1 : sio_getc(); + if (fn) + return 0; + } } From owner-svn-src-all@freebsd.org Wed Feb 21 18:12:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1497F1B0EB; Wed, 21 Feb 2018 18:12:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98B8269A28; Wed, 21 Feb 2018 18:12:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93B171C021; Wed, 21 Feb 2018 18:12:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LICJOl016555; Wed, 21 Feb 2018 18:12:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LICJAO016554; Wed, 21 Feb 2018 18:12:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802211812.w1LICJAO016554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 18:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329738 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:12:20 -0000 Author: mav Date: Wed Feb 21 18:12:19 2018 New Revision: 329738 URL: https://svnweb.freebsd.org/changeset/base/329738 Log: MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1 illumos/illumos-gate@0fb055e81fd0cda5221da8ddd98b2f8d1fc6bdbe At present it is possible to boot from a root pool that is on RAIDZ but not one that is on RAIDZ2 or RAIDZ3. This is because, at the time the pool version is checked to ensure support for dual/triple parity, the uberblock has not yet been loaded into the SPA and therefore the code determines that the pool version is too old and returns ENOTSUP. Reviewed by: Igor Kozhukhov Reviewed by: Andriy Gapon Reviewed by: Pavel Zakharov Reviewed by: Andy Stormont Reviewed by: Toomas Soome Approved by: Gordon Ross Author: Andy Fiddaman FreeBSD already had this fixed, so this is just a diff reduction. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 18:10:50 2018 (r329737) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 18:12:19 2018 (r329738) @@ -30,6 +30,7 @@ * Copyright 2016 Toomas Soome * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -4141,6 +4142,9 @@ spa_import_rootpool(char *devpath, char *devid) spa = spa_add(pname, config, NULL); spa->spa_is_root = B_TRUE; spa->spa_import_flags = ZFS_IMPORT_VERBATIM; + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &spa->spa_ubsync.ub_version) != 0) + spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; /* * Build up a vdev tree based on the boot device's label config. From owner-svn-src-all@freebsd.org Wed Feb 21 18:23:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3B35F1C2FA; Wed, 21 Feb 2018 18:23:08 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CFE36A438; Wed, 21 Feb 2018 18:23:08 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [96.71.141.85] (port=5265 helo=[192.168.0.77]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eoXoY-000AAu-VQ; Wed, 21 Feb 2018 17:04:19 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r329731 - head/stand/lua From: Devin Teske In-Reply-To: <201802211650.w1LGofal069075@repo.freebsd.org> Date: Wed, 21 Feb 2018 12:23:52 -0600 Cc: Devin Teske , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201802211650.w1LGofal069075@repo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3273) Sender: devin@shxd.cx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:23:08 -0000 > On Feb 21, 2018, at 10:50 AM, Kyle Evans wrote: > > Author: kevans > Date: Wed Feb 21 16:50:41 2018 > New Revision: 329731 > URL: https://svnweb.freebsd.org/changeset/base/329731 > > Log: > lualoader: Add boot environment support > > This looks a little bit differently than the forth version for the time > being, just to get off the ground- rather than a paging system, it's > implemented as a simple carousel like the kernel selector. Keep up the great work Kyle! -- Cheers, Devin From owner-svn-src-all@freebsd.org Wed Feb 21 18:29:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7201F1CA47; Wed, 21 Feb 2018 18:29:33 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31B0C6A815; Wed, 21 Feb 2018 18:29:33 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f49.google.com with SMTP id t204so3731158lff.9; Wed, 21 Feb 2018 10:29:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jMVxEIH4B8u8d6elOT4UVRGY5WRwcT41FPHJDAoPgdM=; b=sD310TWbgD+YawtHl+yNIhMQKfLCZhDDua7gBKn+Pkky3LyQSBYZ0BlBDyPhHDb8Uz EakLmgqIC9Xw+aioXRqqhf1nAJCO1BA8+eGontkM7Tg/dckrfT8M2xpM8aXcG8u26Bgf LMoQLWIANB8tAbqXFQgpjiQUmvzrgeWxHw32/SdSrubpogLxcgNCFSGEj+hDpZ2g7a3s m9tdvFtOexGzslnXkg9Ys9sVJ8EFq7jnqc9KlNmMy/TIOhJvsY+mxBfTctas9uVedibC hbgEQkTjvigIgcxvJmXK5grzhaf6lwce5SMTd8uXxbIeaOyumdKdyFDa5pfvfRb2zLJ8 TTyA== X-Gm-Message-State: APf1xPAMTngXtxN2/LOllOsAgIr5MwQ6awslv56JEb2AhOCaMcC3w0ok blFqPRB0ibXuLdDUsrCvIYn8ayhX X-Google-Smtp-Source: AH8x224N5AdoMGO7ldw33zg6mlZePI84fWEI+kdK4pMziKWvb28KnjBTF0DHztbQoqOnAKe3kQ0ORg== X-Received: by 10.46.99.130 with SMTP id s2mr2913684lje.17.1519237766131; Wed, 21 Feb 2018 10:29:26 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id w23sm1053123lfd.10.2018.02.21.10.29.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 10:29:25 -0800 (PST) Subject: Re: svn commit: r329738 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802211812.w1LICJAO016554@repo.freebsd.org> Cc: Alexander Motin From: Andriy Gapon Message-ID: Date: Wed, 21 Feb 2018 20:29:23 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802211812.w1LICJAO016554@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:29:34 -0000 On 21/02/2018 20:12, Alexander Motin wrote: > Author: mav > Date: Wed Feb 21 18:12:19 2018 > New Revision: 329738 > URL: https://svnweb.freebsd.org/changeset/base/329738 > > Log: > MFV r329736: 8969 Cannot boot from RAIDZ with parity > 1 > > illumos/illumos-gate@0fb055e81fd0cda5221da8ddd98b2f8d1fc6bdbe > > At present it is possible to boot from a root pool that is on RAIDZ but not > one that is on RAIDZ2 or RAIDZ3. This is because, at the time the pool > version is checked to ensure support for dual/triple parity, the uberblock > has not yet been loaded into the SPA and therefore the code determines that > the pool version is too old and returns ENOTSUP. Just a note that this change is to the illumos specific code. The FreeBSD counterpart had the fix for long time. > Reviewed by: Igor Kozhukhov > Reviewed by: Andriy Gapon > Reviewed by: Pavel Zakharov > Reviewed by: Andy Stormont > Reviewed by: Toomas Soome > Approved by: Gordon Ross > Author: Andy Fiddaman > > FreeBSD already had this fixed, so this is just a diff reduction. > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c > Directory Properties: > head/sys/cddl/contrib/opensolaris/ (props changed) > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 18:10:50 2018 (r329737) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 18:12:19 2018 (r329738) > @@ -30,6 +30,7 @@ > * Copyright 2016 Toomas Soome > * Copyright 2017 Joyent, Inc. > * Copyright (c) 2017 Datto Inc. > + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. > */ > > /* > @@ -4141,6 +4142,9 @@ spa_import_rootpool(char *devpath, char *devid) > spa = spa_add(pname, config, NULL); > spa->spa_is_root = B_TRUE; > spa->spa_import_flags = ZFS_IMPORT_VERBATIM; > + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, > + &spa->spa_ubsync.ub_version) != 0) > + spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; > > /* > * Build up a vdev tree based on the boot device's label config. > -- Andriy Gapon From owner-svn-src-all@freebsd.org Wed Feb 21 18:31:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05BF9F1CCEB; Wed, 21 Feb 2018 18:31:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAFB06AA90; Wed, 21 Feb 2018 18:31:21 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BFCA1C215; Wed, 21 Feb 2018 18:31:21 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LIVLRl026565; Wed, 21 Feb 2018 18:31:21 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LIVLkg026562; Wed, 21 Feb 2018 18:31:21 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802211831.w1LIVLkg026562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Feb 2018 18:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329739 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 329739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:31:22 -0000 Author: brooks Date: Wed Feb 21 18:31:21 2018 New Revision: 329739 URL: https://svnweb.freebsd.org/changeset/base/329739 Log: MFC r329525: Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). The description of kern.ipc.shmsegs was wrong since 2005. I updated the others (which were more correct) to match. PR: 225933 Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14391 Modified: stable/11/sys/kern/sysv_msg.c stable/11/sys/kern/sysv_sem.c stable/11/sys/kern/sysv_shm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sysv_msg.c ============================================================================== --- stable/11/sys/kern/sysv_msg.c Wed Feb 21 18:12:19 2018 (r329738) +++ stable/11/sys/kern/sysv_msg.c Wed Feb 21 18:31:21 2018 (r329739) @@ -1493,7 +1493,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, "Number of message segments"); SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_msqids, "", "Message queue IDs"); + NULL, 0, sysctl_msqids, "", + "Array of struct msqid_kernel for each potential message queue"); static int msg_prison_check(void *obj, void *data) Modified: stable/11/sys/kern/sysv_sem.c ============================================================================== --- stable/11/sys/kern/sysv_sem.c Wed Feb 21 18:12:19 2018 (r329738) +++ stable/11/sys/kern/sysv_sem.c Wed Feb 21 18:31:21 2018 (r329739) @@ -221,7 +221,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RWTUN, "Adjust on exit max value"); SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_sema, "", "Semaphore id pool"); + NULL, 0, sysctl_sema, "", + "Array of struct semid_kernel for each potential semaphore"); static struct syscall_helper_data sem_syscalls[] = { SYSCALL_INIT_HELPER(__semctl), Modified: stable/11/sys/kern/sysv_shm.c ============================================================================== --- stable/11/sys/kern/sysv_shm.c Wed Feb 21 18:12:19 2018 (r329738) +++ stable/11/sys/kern/sysv_shm.c Wed Feb 21 18:31:21 2018 (r329739) @@ -190,7 +190,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shm_allow_removed, CTL "Enable/Disable attachment to attached segments marked for removal"); SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_shmsegs, "", - "Current number of shared memory segments allocated"); + "Array of struct shmid_kernel for each potential shared memory segment"); static struct sx sysvshmsx; #define SYSVSHM_LOCK() sx_xlock(&sysvshmsx) From owner-svn-src-all@freebsd.org Wed Feb 21 18:32:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A4D7F1CF44; Wed, 21 Feb 2018 18:32:07 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A93406AC5A; Wed, 21 Feb 2018 18:32:06 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3F1E1C246; Wed, 21 Feb 2018 18:32:06 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LIW6a5028130; Wed, 21 Feb 2018 18:32:06 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LIW6fJ028129; Wed, 21 Feb 2018 18:32:06 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201802211832.w1LIW6fJ028129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Wed, 21 Feb 2018 18:32:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329740 - head/stand/i386/boot2 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/stand/i386/boot2 X-SVN-Commit-Revision: 329740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:32:07 -0000 Author: benno Date: Wed Feb 21 18:32:06 2018 New Revision: 329740 URL: https://svnweb.freebsd.org/changeset/base/329740 Log: Further style(9) changes. Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) Modified: head/stand/i386/boot2/boot2.c Modified: head/stand/i386/boot2/boot2.c ============================================================================== --- head/stand/i386/boot2/boot2.c Wed Feb 21 18:31:21 2018 (r329739) +++ head/stand/i386/boot2/boot2.c Wed Feb 21 18:32:06 2018 (r329740) @@ -126,9 +126,12 @@ static void memcpy(void *, const void *, int); static void memcpy(void *dst, const void *src, int len) { - const char *s = src; - char *d = dst; + const char *s; + char *d; + s = src; + d = dst; + while (len--) *d++ = *s++; } @@ -138,7 +141,7 @@ strcmp(const char *s1, const char *s2) { for (; *s1 == *s2 && *s1; s1++, s2++); - return (unsigned char)*s1 - (unsigned char)*s2; + return ((unsigned char)*s1 - (unsigned char)*s2); } #define UFS_SMALL_CGBASE @@ -150,9 +153,9 @@ xfsread(ufs_ino_t inode, void *buf, size_t nbyte) if ((size_t)fsread(inode, buf, nbyte) != nbyte) { printf("Invalid %s\n", "format"); - return -1; + return (-1); } - return 0; + return (0); } static inline void @@ -354,13 +357,14 @@ load(void) static int parse() { - char *arg = cmd; - char *ep, *p, *q; + char *arg, *ep, *p, *q; const char *cp; unsigned int drv; int c, i, j; size_t k; + arg = cmd; + while ((c = *arg++)) { if (c == ' ' || c == '\t' || c == '\n') continue; @@ -397,7 +401,7 @@ parse() } for (i = 0; c != optstr[i]; i++) if (i == NOPT - 1) - return -1; + return (-1); opts ^= OPT_SET(flags[i]); } #if SERIAL @@ -423,22 +427,22 @@ parse() for (i = 0; arg[0] != dev_nm[i][0] || arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) - return -1; + return (-1); dsk.type = i; arg += 3; dsk.unit = *arg - '0'; if (arg[1] != ',' || dsk.unit > 9) - return -1; + return (-1); arg += 2; dsk.slice = WHOLE_DISK_SLICE; if (arg[1] == ',') { dsk.slice = *arg - '0' + 1; if (dsk.slice > NDOSPART + 1) - return -1; + return (-1); arg += 2; } if (arg[1] != ')') - return -1; + return (-1); dsk.part = *arg - 'a'; if (dsk.part > 7) return (-1); @@ -452,14 +456,14 @@ parse() k = ep - arg; if (k > 0) { if (k >= sizeof(knamebuf)) - return -1; + return (-1); memcpy(knamebuf, arg, k + 1); kname = knamebuf; } } arg = p; } - return 0; + return (0); } static int @@ -476,7 +480,7 @@ dskread(void *buf, unsigned lba, unsigned nblk) sec = dmadat->secbuf; dsk.start = 0; if (drvread(sec, DOSBBSECTOR, 1)) - return -1; + return (-1); dp = (void *)(sec + DOSPARTOFF); sl = dsk.slice; if (sl < BASE_SLICE) { @@ -501,7 +505,7 @@ dskread(void *buf, unsigned lba, unsigned nblk) dsk.start = dp->dp_start; } if (drvread(sec, dsk.start + LABELSECTOR, 1)) - return -1; + return (-1); d = (void *)(sec + LABELOFFSET); if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { if (dsk.part != RAW_PART) { @@ -523,10 +527,10 @@ dskread(void *buf, unsigned lba, unsigned nblk) dsk.start -= d->d_partitions[RAW_PART].p_offset; } } - return drvread(buf, dsk.start + lba, nblk); + return (drvread(buf, dsk.start + lba, nblk)); error: printf("Invalid %s\n", reason); - return -1; + return (-1); } static void @@ -596,9 +600,9 @@ drvread(void *buf, unsigned lba, unsigned nblk) v86.ctl = V86_FLAGS; if (V86_CY(v86.efl)) { printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); - return -1; + return (-1); } - return 0; + return (0); } static int @@ -607,16 +611,16 @@ keyhit(unsigned ticks) uint32_t t0, t1; if (OPT_CHECK(RBX_NOINTR)) - return 0; + return (0); t0 = 0; for (;;) { if (xgetc(1)) - return 1; + return (1); t1 = *(uint32_t *)PTOV(0x46c); if (!t0) t0 = t1; if ((uint32_t)(t1 - t0) >= ticks) - return 0; + return (0); } } @@ -628,7 +632,7 @@ xputc(int c) putc(c); if (DO_SIO) sio_putc(c); - return c; + return (c); } static int @@ -638,7 +642,7 @@ getc(int fn) v86.addr = 0x16; v86.eax = fn << 8; v86int(); - return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); + return (fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl)); } static int @@ -646,13 +650,13 @@ xgetc(int fn) { if (OPT_CHECK(RBX_NOINTR)) - return 0; + return (0); for (;;) { if (DO_KBD && getc(1)) - return fn ? 1 : getc(0); + return (fn ? 1 : getc(0)); if (DO_SIO && sio_ischar()) - return fn ? 1 : sio_getc(); + return (fn ? 1 : sio_getc()); if (fn) - return 0; + return (0); } } From owner-svn-src-all@freebsd.org Wed Feb 21 18:32:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9916F1D0C0; Wed, 21 Feb 2018 18:32:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 706BE6AF13; Wed, 21 Feb 2018 18:32:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5116A1C358; Wed, 21 Feb 2018 18:32:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LIWwRv028206; Wed, 21 Feb 2018 18:32:58 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LIWw10028203; Wed, 21 Feb 2018 18:32:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802211832.w1LIWw10028203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Feb 2018 18:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329741 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 329741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:32:59 -0000 Author: brooks Date: Wed Feb 21 18:32:57 2018 New Revision: 329741 URL: https://svnweb.freebsd.org/changeset/base/329741 Log: MFC r329525: Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). The description of kern.ipc.shmsegs was wrong since 2005. I updated the others (which were more correct) to match. PR: 225933 Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14391 Modified: stable/10/sys/kern/sysv_msg.c stable/10/sys/kern/sysv_sem.c stable/10/sys/kern/sysv_shm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sysv_msg.c ============================================================================== --- stable/10/sys/kern/sysv_msg.c Wed Feb 21 18:32:06 2018 (r329740) +++ stable/10/sys/kern/sysv_msg.c Wed Feb 21 18:32:57 2018 (r329741) @@ -1461,7 +1461,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, "Number of message segments"); SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_msqids, "", "Message queue IDs"); + NULL, 0, sysctl_msqids, "", + "Array of struct msqid_kernel for each potential message queue"); static int msg_prison_check(void *obj, void *data) Modified: stable/10/sys/kern/sysv_sem.c ============================================================================== --- stable/10/sys/kern/sysv_sem.c Wed Feb 21 18:32:06 2018 (r329740) +++ stable/10/sys/kern/sysv_sem.c Wed Feb 21 18:32:57 2018 (r329741) @@ -221,7 +221,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &s "Adjust on exit max value"); SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_sema, "", "Semaphore id pool"); + NULL, 0, sysctl_sema, "", + "Array of struct semid_kernel for each potential semaphore"); static struct syscall_helper_data sem_syscalls[] = { SYSCALL_INIT_HELPER(__semctl), Modified: stable/10/sys/kern/sysv_shm.c ============================================================================== --- stable/10/sys/kern/sysv_shm.c Wed Feb 21 18:32:06 2018 (r329740) +++ stable/10/sys/kern/sysv_shm.c Wed Feb 21 18:32:57 2018 (r329741) @@ -190,7 +190,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, shm_allow_removed, CTL "Enable/Disable attachment to attached segments marked for removal"); SYSCTL_PROC(_kern_ipc, OID_AUTO, shmsegs, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_shmsegs, "", - "Current number of shared memory segments allocated"); + "Array of struct shmid_kernel for each potential shared memory segment"); static struct sx sysvshmsx; #define SYSVSHM_LOCK() sx_xlock(&sysvshmsx) From owner-svn-src-all@freebsd.org Wed Feb 21 18:46:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B25BBF1F0E3 for ; Wed, 21 Feb 2018 18:46:47 +0000 (UTC) (envelope-from 01000161b9b063a1-b169e522-0c8d-4cd4-be71-88aa332f944d-000000@amazonses.com) Received: from a8-13.smtp-out.amazonses.com (a8-13.smtp-out.amazonses.com [54.240.8.13]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 618BE6B6BE for ; Wed, 21 Feb 2018 18:46:47 +0000 (UTC) (envelope-from 01000161b9b063a1-b169e522-0c8d-4cd4-be71-88aa332f944d-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=dqtolf56kk3wpt62c3jnwboqvr7iedax; d=tarsnap.com; t=1519238800; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=s1aRprPWw4ZjcEP/CE1XRJdrlWNjS5LY7lBeK6+AJmM=; b=Q3ddcVAEAOC6E2eMhLHoEsgjCo/Tu4zMKOy7KWw0zeGdojOdkGq7UkT+G9odCBXW /daFKTr2bic7p/KXzrvpLKT+tDOPuLiRaB/4I0p8c8pPboEfHJv1nUG1X6jN/hsizUU 0twawtgilV3WjG7J1vsbRikCnFldezWzTVbp3uKo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1519238800; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=s1aRprPWw4ZjcEP/CE1XRJdrlWNjS5LY7lBeK6+AJmM=; b=ehMTNcUM2nVoH/rpSXV/mxb0InGovRMDDuah8YjmtnvderkeA0crnrFbpq7k6Pf9 B3jwe6GbcAw/GZsYF2iQaL8o5Jel8+vo4Ta+Cj9LFrXf3ZyAfOtKbtyTWIDJTp/JFSE bxRIuCANCy2rG1meL+GeEZGagLbP5DGZ1sNx6knY= Subject: Re: svn commit: r329737 - head/stand/i386/boot2 To: Benno Rice , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802211810.w1LIApvC012656@repo.freebsd.org> From: Colin Percival Message-ID: <01000161b9b063a1-b169e522-0c8d-4cd4-be71-88aa332f944d-000000@email.amazonses.com> Date: Wed, 21 Feb 2018 18:46:40 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201802211810.w1LIApvC012656@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2018.02.21-54.240.8.13 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:46:47 -0000 On 02/21/18 10:10, Benno Rice wrote: > Curiously, changing whitespace seems to cause the md5 of the .o files to differ > these days hence the following testing strategy: > > Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) Is this simply because line numbers are changing? That isn't new; I remember a case where a security advisory touched a .h file and suddenly a huge number of binaries changed because they included header file line numbers. > static inline int > strcmp(const char *s1, const char *s2) > { > - for (; *s1 == *s2 && *s1; s1++, s2++); > - return (unsigned char)*s1 - (unsigned char)*s2; > + > + for (; *s1 == *s2 && *s1; s1++, s2++); > + return (unsigned char)*s1 - (unsigned char)*s2; > } -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Wed Feb 21 18:52:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 360F2F1F8A4; Wed, 21 Feb 2018 18:52:16 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B98006BC36; Wed, 21 Feb 2018 18:52:15 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x234.google.com with SMTP id p78so3180429iod.13; Wed, 21 Feb 2018 10:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FWgx1El6t8W0mz9PLcPoi0oKLBJeuzB0Qv/O5f9/jGI=; b=dso+FT3loBSBqpxF2GKfXcVNWMTSleYhLvbuUPNqmgbIAAfh7HtT+jCMydwYEW9UP0 aRtpijlkqHHly6q1BCTSQBHwkikaE0+S6k6+yxELXNaOcsrRVZ4+aADhZjuefg3g4wu8 WS96oHTeUuxApXj2xjNYZnG/AbDH+aIS6E5NOqFPTU0AeONBUpfb5GfrFUoxhAlHKdhV TRZiTORh++qVYvm8jjKRzBpx5RY3+OnYCsrQ964kLJ1ZvoIoDuDHxMoD2yfFX2N0Ql4L dhcuBXUP0nuDXH9LNtrjRq8ruvagl9BfNH1bms9LynhbF8o07wxbz+4Fp2dYMdbftTOK RULQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FWgx1El6t8W0mz9PLcPoi0oKLBJeuzB0Qv/O5f9/jGI=; b=iLlowYPRZRRKs+dnwTI2XZIfUY/kR7aM/izvKzPQww2gjVEIAF0fkad1S3vK12IoVF veX+HJaXtQ4Fp6kChONIqlw2+nNLEx8ajkijx4Ixqi0sEafL+x0lwkXsNt5IWIvS9FXU Yo/jgiwwzGueWrBgdaAl6A827LYZxF+cz3PKeqFQhJd6Yg2/5hQCPNXjcTQMS5vWAULC mrrUEjnEA6C52KsUMCwm9iBOqsXfVY+CNruF6rtqklricQguRiHr0GtjoBDmK7PtE9Qy oZ+pvZMnXWjpGOFb2DegdbSEkrIbvhc9p1Wa9cGcs3rYJVu3ErRwG7yGskuGBD9BSOlx YJkQ== X-Gm-Message-State: APf1xPA3QP58nNgcfHuEkpm/QTXa8fbQ8dSaszqb7Az8L8NPpR6E4D/x knZZKTwD1RxqAwwDO/sjGs2Rajsw3xedbcOptcU6Cx1E X-Google-Smtp-Source: AG47ELuE51qcLVIku//cYeCRyB/t0ft4haiXAPKybF9valk8vN3kzC91OhTfQJzVrdkY8TXx2RCKII29ctNcox+M3LM= X-Received: by 10.107.31.213 with SMTP id f204mr5531428iof.288.1519239135033; Wed, 21 Feb 2018 10:52:15 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.28.73 with HTTP; Wed, 21 Feb 2018 10:51:54 -0800 (PST) In-Reply-To: <201802211810.w1LIApvC012656@repo.freebsd.org> References: <201802211810.w1LIApvC012656@repo.freebsd.org> From: Ed Maste Date: Wed, 21 Feb 2018 13:51:54 -0500 X-Google-Sender-Auth: BMlhXNk5kUbeu1jY29nIvheOFgQ Message-ID: Subject: Re: svn commit: r329737 - head/stand/i386/boot2 To: Benno Rice Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:52:16 -0000 On 21 February 2018 at 13:10, Benno Rice wrote: > Author: benno > Date: Wed Feb 21 18:10:50 2018 > New Revision: 329737 > URL: https://svnweb.freebsd.org/changeset/base/329737 > > Log: > Purely whitespace changes bringing this file closer to style(9). > > Curiously, changing whitespace seems to cause the md5 of the .o files to differ > these days hence the following testing strategy: sysutils/py-diffoscope can aid in finding the source of the differences. If you still have old and new .o files around you can try it online at https://try.diffoscope.org/ . From owner-svn-src-all@freebsd.org Wed Feb 21 18:52:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 753A8F1F999; Wed, 21 Feb 2018 18:52:48 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E7E36BDB7; Wed, 21 Feb 2018 18:52:48 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5877121003; Wed, 21 Feb 2018 13:52:41 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 21 Feb 2018 13:52:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=cmbjoo zE3mBP/KpCyxtK/m/OsyiB1G07BKmRveFHfp4=; b=AFGvAc+JdIl5R+I45eyB3W O65v6BLq2xwQCDupD69x/typHl58OdbQEarZgqqm8cqQFcG+giorcnwSZCBKqEvk KLnS3T1AwKsBeQDWVHJ9D2KJntzu9eGUe1MTOKwu6GQ397MV/AxR/Ny6j5d7Tkcu 97AzBdLU4mSjgiM6K7HYIuuoSLqdTcP0OcK6ldmIW0gXks3eDYJ+oZAepS1AvxzL jv3TETDCMU61dffuUoKsPYacvRWrEAuztOT4Gdj/ZdlM5x8soD4StbiDGx0cJZZt 0Fhl16/xwcJGppiXXgC+Jaxl9lfvLz39jGC3CvJIliWeCwZjhuAcxTLvSTyc3wMA == X-ME-Sender: Received: from [10.57.107.109] (unknown [209.63.143.172]) by mail.messagingengine.com (Postfix) with ESMTPA id BBAAA7E0DA; Wed, 21 Feb 2018 13:52:40 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329737 - head/stand/i386/boot2 From: Benno Rice In-Reply-To: <01000161b9b067ef-cf38721a-d658-4840-bd63-4e50310f3d52-000000@email.amazonses.com> Date: Wed, 21 Feb 2018 10:52:39 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201802211810.w1LIApvC012656@repo.freebsd.org> <01000161b9b067ef-cf38721a-d658-4840-bd63-4e50310f3d52-000000@email.amazonses.com> To: Colin Percival X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:52:48 -0000 > On Feb 21, 2018, at 10:46 AM, Colin Percival = wrote: >=20 > On 02/21/18 10:10, Benno Rice wrote: >> Curiously, changing whitespace seems to cause the md5 of the .o = files to differ >> these days hence the following testing strategy: >>=20 >> Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) >=20 > Is this simply because line numbers are changing? That isn't new; I = remember > a case where a security advisory touched a .h file and suddenly a huge = number > of binaries changed because they included header file line numbers. No, it happened when I changed the indent of the while statement on line = ~132 in memcpy. I do suspect debug info though.= From owner-svn-src-all@freebsd.org Wed Feb 21 18:57:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3C2DF1FE5B; Wed, 21 Feb 2018 18:57:01 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 571CA6C022; Wed, 21 Feb 2018 18:57:01 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D1B11C6B2; Wed, 21 Feb 2018 18:57:01 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LIv1wh038314; Wed, 21 Feb 2018 18:57:01 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LIv1Qv038313; Wed, 21 Feb 2018 18:57:01 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201802211857.w1LIv1Qv038313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 21 Feb 2018 18:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329742 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 329742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:57:01 -0000 Author: shurd Date: Wed Feb 21 18:57:00 2018 New Revision: 329742 URL: https://svnweb.freebsd.org/changeset/base/329742 Log: IFLIB: Make isc_magic unsigned The IFLIB_MAGIC macro is > INT_MAX, so isc_magic should be able to contain it. Reported by: jeb Sponsored by: Limelight Networks Modified: head/sys/net/iflib.h Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Wed Feb 21 18:32:57 2018 (r329741) +++ head/sys/net/iflib.h Wed Feb 21 18:57:00 2018 (r329742) @@ -229,7 +229,7 @@ typedef struct if_softc_ctx { * Initialization values for device */ struct if_shared_ctx { - int isc_magic; + unsigned isc_magic; driver_t *isc_driver; bus_size_t isc_q_align; bus_size_t isc_tx_maxsize; From owner-svn-src-all@freebsd.org Wed Feb 21 18:57:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD424F1FF5B; Wed, 21 Feb 2018 18:57:26 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CD0B6C1B0; Wed, 21 Feb 2018 18:57:26 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id F37B7211E7; Wed, 21 Feb 2018 13:57:25 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 21 Feb 2018 13:57:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=dM8EDq 8zZSiJNFoswT4fywPwkh/F3tpgTkdJMpnkExQ=; b=MqyiXQyS4GcV98qe/4/7AZ Arc1v2R8QwNSjsUpEeplw1BMwoXE+a7EqVADKVkiwzftrm4Ahs9v+b2GcQZfAIKC lXFg4Gc49LKHfj1PrplEA7AEv74xaWII+fy4RMdZzqsUMMXa+dhFORx6OzT/9cx8 Qu0plQ+5ovqQpZV7RK/d4c0uao+kh+kCCx/SIoxgFrtMxllAOIJ1tNacN7uN3Rp1 WWyNTUl7NqiNtPQZCNpbeWvz92cx7d6aiNAkZgiIzhYSKZNN8l79uSE75fi3Wj4I 465HP0yfqZd5vypziyXSShEpYLjWtyICXanlVidJBCJOQw67et3IyglPiXtOnp0g == X-ME-Sender: Received: from [10.57.107.109] (unknown [209.63.143.172]) by mail.messagingengine.com (Postfix) with ESMTPA id 349CF243C4; Wed, 21 Feb 2018 13:57:23 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329737 - head/stand/i386/boot2 From: Benno Rice In-Reply-To: Date: Wed, 21 Feb 2018 10:57:19 -0800 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201802211810.w1LIApvC012656@repo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 18:57:26 -0000 > On Feb 21, 2018, at 10:51 AM, Ed Maste wrote: >=20 > On 21 February 2018 at 13:10, Benno Rice wrote: >> Author: benno >> Date: Wed Feb 21 18:10:50 2018 >> New Revision: 329737 >> URL: https://svnweb.freebsd.org/changeset/base/329737 >>=20 >> Log: >> Purely whitespace changes bringing this file closer to style(9). >>=20 >> Curiously, changing whitespace seems to cause the md5 of the .o = files to differ >> these days hence the following testing strategy: >=20 > sysutils/py-diffoscope can aid in finding the source of the > differences. If you still have old and new .o files around you can try > it online at https://try.diffoscope.org/ . Suspicion confirmed. Lots of changes through the debug info, primarily = relating to columns. From owner-svn-src-all@freebsd.org Wed Feb 21 19:13:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A8B7F2188E; Wed, 21 Feb 2018 19:13:24 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC28A6D250; Wed, 21 Feb 2018 19:13:23 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B4A41C9D6; Wed, 21 Feb 2018 19:13:23 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJDNK0048119; Wed, 21 Feb 2018 19:13:23 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJDNGh048117; Wed, 21 Feb 2018 19:13:23 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201802211913.w1LJDNGh048117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Wed, 21 Feb 2018 19:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329743 - in head: sbin/route sys/net X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: in head: sbin/route sys/net X-SVN-Commit-Revision: 329743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:13:24 -0000 Author: rstone Date: Wed Feb 21 19:13:23 2018 New Revision: 329743 URL: https://svnweb.freebsd.org/changeset/base/329743 Log: Allow route change requests to not specify the gateway. Only require a gateway to be specified on a route add request. On a route change request that does not specify the gateway, the gateway will remain the same. This allows changing other route parameters without having to re-specifying the gateway, like in "route change 10.0.0.0/8 -mtu 9000". Update the route(8) manpage to explicitly call out this usage as being supported. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Reviewed By: eugen (rtsock.c change), rgrimes Differential Revision: https://reviews.freebsd.org/D14291 Modified: head/sbin/route/route.8 head/sys/net/rtsock.c Modified: head/sbin/route/route.8 ============================================================================== --- head/sbin/route/route.8 Wed Feb 21 18:57:00 2018 (r329742) +++ head/sbin/route/route.8 Wed Feb 21 19:13:23 2018 (r329743) @@ -28,7 +28,7 @@ .\" @(#)route.8 8.3 (Berkeley) 3/19/94 .\" $FreeBSD$ .\" -.Dd November 11, 2014 +.Dd February 16, 2018 .Dt ROUTE 8 .Os .Sh NAME @@ -164,15 +164,27 @@ option is specified, the operation will be applied to the specified FIB .Pq routing table . .Pp -The other commands have the following syntax: +The add command has the following syntax: .Pp .Bd -ragged -offset indent -compact .Nm .Op Fl n -.Ar command +.Cm add .Op Fl net No \&| Fl host .Ar destination gateway .Op Ar netmask +.Op Fl fib Ar number +.Ed +.Pp +and the other commands have the following syntax: +.Pp +.Bd -ragged -offset indent -compact +.Nm +.Op Fl n +.Ar command +.Op Fl net No \&| Fl host +.Ar destination +.Op Ar gateway Op Ar netmask .Op Fl fib Ar number .Ed .Pp Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Wed Feb 21 18:57:00 2018 (r329742) +++ head/sys/net/rtsock.c Wed Feb 21 19:13:23 2018 (r329743) @@ -674,12 +674,15 @@ route_output(struct mbuf *m, struct socket *so, ...) case RTM_ADD: case RTM_CHANGE: - if (info.rti_info[RTAX_GATEWAY] == NULL) - senderr(EINVAL); + if (rtm->rtm_type == RTM_ADD) { + if (info.rti_info[RTAX_GATEWAY] == NULL) + senderr(EINVAL); + } saved_nrt = NULL; /* support for new ARP code */ - if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK && + if (info.rti_info[RTAX_GATEWAY] != NULL && + info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK && (rtm->rtm_flags & RTF_LLDATA) != 0) { error = lla_rt_output(rtm, &info); #ifdef INET6 From owner-svn-src-all@freebsd.org Wed Feb 21 19:13:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BAB4F218E2; Wed, 21 Feb 2018 19:13:31 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC9136D328; Wed, 21 Feb 2018 19:13:29 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DC5B1C9D7; Wed, 21 Feb 2018 19:13:28 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJDReS048167; Wed, 21 Feb 2018 19:13:27 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJDRlT048166; Wed, 21 Feb 2018 19:13:27 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201802211913.w1LJDRlT048166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Wed, 21 Feb 2018 19:13:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329744 - head/sbin/route X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sbin/route X-SVN-Commit-Revision: 329744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:13:31 -0000 Author: rstone Date: Wed Feb 21 19:13:27 2018 New Revision: 329744 URL: https://svnweb.freebsd.org/changeset/base/329744 Log: Fix route manpage to show correct flush syntax The current route(8) manpage shows that "flush" is an argument to the optional -n flag, rather than a separate subcommand. Correct this to properly show flush as a route subcommand. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Reviewed by: rgrimes Differential Revision: https://reviews.freebsd.org/D14401 Modified: head/sbin/route/route.8 Modified: head/sbin/route/route.8 ============================================================================== --- head/sbin/route/route.8 Wed Feb 21 19:13:23 2018 (r329743) +++ head/sbin/route/route.8 Wed Feb 21 19:13:27 2018 (r329744) @@ -133,7 +133,8 @@ The flush command has the syntax: .Pp .Bd -ragged -offset indent -compact .Nm -.Oo Fl n Cm flush Oc Oo Ar family Oc Op Fl fib Ar number +.Op Fl n +.Cm flush Oc Oo Ar family Oc Op Fl fib Ar number .Ed .Pp If the From owner-svn-src-all@freebsd.org Wed Feb 21 19:42:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2DB7F23E42; Wed, 21 Feb 2018 19:42:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 651A06E7CF; Wed, 21 Feb 2018 19:42:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F69A1CEBF; Wed, 21 Feb 2018 19:42:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJgscr062859; Wed, 21 Feb 2018 19:42:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJgsdN062858; Wed, 21 Feb 2018 19:42:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802211942.w1LJgsdN062858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Feb 2018 19:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329745 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 329745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:42:55 -0000 Author: emaste Date: Wed Feb 21 19:42:54 2018 New Revision: 329745 URL: https://svnweb.freebsd.org/changeset/base/329745 Log: load_elf.c: Use consistent indentation As noted in D14267 load_elf.c has a variety of indentation styles. Move to standard 8 column hard tab indents, 4 space second level indents. Also includes some whitespace cleanups found by clang-format. Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Wed Feb 21 19:13:27 2018 (r329744) +++ head/stand/common/load_elf.c Wed Feb 21 19:42:54 2018 (r329745) @@ -52,29 +52,31 @@ __FBSDID("$FreeBSD$"); #endif typedef struct elf_file { - Elf_Phdr *ph; - Elf_Ehdr *ehdr; - Elf_Sym *symtab; - Elf_Hashelt *hashtab; - Elf_Hashelt nbuckets; - Elf_Hashelt nchains; - Elf_Hashelt *buckets; - Elf_Hashelt *chains; - Elf_Rel *rel; - size_t relsz; - Elf_Rela *rela; - size_t relasz; - char *strtab; - size_t strsz; - int fd; - caddr_t firstpage; - size_t firstlen; - int kernel; - u_int64_t off; + Elf_Phdr *ph; + Elf_Ehdr *ehdr; + Elf_Sym *symtab; + Elf_Hashelt *hashtab; + Elf_Hashelt nbuckets; + Elf_Hashelt nchains; + Elf_Hashelt *buckets; + Elf_Hashelt *chains; + Elf_Rel *rel; + size_t relsz; + Elf_Rela *rela; + size_t relasz; + char *strtab; + size_t strsz; + int fd; + caddr_t firstpage; + size_t firstlen; + int kernel; + u_int64_t off; } *elf_file_t; -static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, u_int64_t loadaddr); -static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, const char* name, Elf_Sym* sym); +static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, + u_int64_t loadaddr); +static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, + const char* name, Elf_Sym* sym); static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, Elf_Addr p, void *val, size_t len); static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef, @@ -198,11 +200,11 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) { ssize_t bytes_read; Elf_Ehdr *ehdr; - int err; + int err; /* - * Open the image, read and validate the ELF header - */ + * Open the image, read and validate the ELF header + */ if (filename == NULL) /* can't handle nameless */ return (EFTYPE); if ((ef->fd = open(filename, O_RDONLY)) == -1) @@ -237,7 +239,8 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) if (err) goto error; - if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ + if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { + /* Machine ? */ err = EFTYPE; goto error; } @@ -271,136 +274,144 @@ int __elfN(loadfile_raw)(char *filename, u_int64_t dest, struct preloaded_file **result, int multiboot) { - struct preloaded_file *fp, *kfp; - struct elf_file ef; - Elf_Ehdr *ehdr; - int err; + struct preloaded_file *fp, *kfp; + struct elf_file ef; + Elf_Ehdr *ehdr; + int err; - fp = NULL; - bzero(&ef, sizeof(struct elf_file)); - ef.fd = -1; + fp = NULL; + bzero(&ef, sizeof(struct elf_file)); + ef.fd = -1; - err = __elfN(load_elf_header)(filename, &ef); - if (err != 0) - return (err); + err = __elfN(load_elf_header)(filename, &ef); + if (err != 0) + return (err); - ehdr = ef.ehdr; + ehdr = ef.ehdr; - /* - * Check to see what sort of module we are. - */ - kfp = file_findfile(NULL, __elfN(kerneltype)); + /* + * Check to see what sort of module we are. + */ + kfp = file_findfile(NULL, __elfN(kerneltype)); #ifdef __powerpc__ - /* - * Kernels can be ET_DYN, so just assume the first loaded object is the - * kernel. This assumption will be checked later. - */ - if (kfp == NULL) - ef.kernel = 1; -#endif - if (ef.kernel || ehdr->e_type == ET_EXEC) { - /* Looks like a kernel */ - if (kfp != NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n"); - err = EPERM; - goto oerr; - } - /* - * Calculate destination address based on kernel entrypoint. - * - * For ARM, the destination address is independent of any values in the - * elf header (an ARM kernel can be loaded at any 2MB boundary), so we - * leave dest set to the value calculated by archsw.arch_loadaddr() and - * passed in to this function. + /* + * Kernels can be ET_DYN, so just assume the first loaded object is the + * kernel. This assumption will be checked later. */ + if (kfp == NULL) + ef.kernel = 1; +#endif + if (ef.kernel || ehdr->e_type == ET_EXEC) { + /* Looks like a kernel */ + if (kfp != NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: kernel already loaded\n"); + err = EPERM; + goto oerr; + } + /* + * Calculate destination address based on kernel entrypoint. + * + * For ARM, the destination address is independent of any values + * in the elf header (an ARM kernel can be loaded at any 2MB + * boundary), so we leave dest set to the value calculated by + * archsw.arch_loadaddr() and passed in to this function. + */ #ifndef __arm__ - if (ehdr->e_type == ET_EXEC) - dest = (ehdr->e_entry & ~PAGE_MASK); + if (ehdr->e_type == ET_EXEC) + dest = (ehdr->e_entry & ~PAGE_MASK); #endif - if ((ehdr->e_entry & ~PAGE_MASK) == 0) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n"); - err = EPERM; - goto oerr; - } - ef.kernel = 1; + if ((ehdr->e_entry & ~PAGE_MASK) == 0) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: not a kernel (maybe static binary?)\n"); + err = EPERM; + goto oerr; + } + ef.kernel = 1; - } else if (ehdr->e_type == ET_DYN) { - /* Looks like a kld module */ - if (multiboot != 0) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module as multiboot\n"); - err = EPERM; + } else if (ehdr->e_type == ET_DYN) { + /* Looks like a kld module */ + if (multiboot != 0) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module as multiboot\n"); + err = EPERM; + goto oerr; + } + if (kfp == NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module before kernel\n"); + err = EPERM; + goto oerr; + } + if (strcmp(__elfN(kerneltype), kfp->f_type)) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module with kernel type '%s'\n", + kfp->f_type); + err = EPERM; + goto oerr; + } + /* Looks OK, got ahead */ + ef.kernel = 0; + + } else { + err = EFTYPE; goto oerr; } - if (kfp == NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n"); - err = EPERM; - goto oerr; - } - if (strcmp(__elfN(kerneltype), kfp->f_type)) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module with kernel type '%s'\n", kfp->f_type); - err = EPERM; - goto oerr; - } - /* Looks OK, got ahead */ - ef.kernel = 0; - } else { - err = EFTYPE; - goto oerr; - } + if (archsw.arch_loadaddr != NULL) + dest = archsw.arch_loadaddr(LOAD_ELF, ehdr, dest); + else + dest = roundup(dest, PAGE_SIZE); - if (archsw.arch_loadaddr != NULL) - dest = archsw.arch_loadaddr(LOAD_ELF, ehdr, dest); - else - dest = roundup(dest, PAGE_SIZE); + /* + * Ok, we think we should handle this. + */ + fp = file_alloc(); + if (fp == NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: cannot allocate module info\n"); + err = EPERM; + goto out; + } + if (ef.kernel == 1 && multiboot == 0) + setenv("kernelname", filename, 1); + fp->f_name = strdup(filename); + if (multiboot == 0) + fp->f_type = strdup(ef.kernel ? + __elfN(kerneltype) : __elfN(moduletype)); + else + fp->f_type = strdup("elf multiboot kernel"); - /* - * Ok, we think we should handle this. - */ - fp = file_alloc(); - if (fp == NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: cannot allocate module info\n"); - err = EPERM; - goto out; - } - if (ef.kernel == 1 && multiboot == 0) - setenv("kernelname", filename, 1); - fp->f_name = strdup(filename); - if (multiboot == 0) - fp->f_type = strdup(ef.kernel ? - __elfN(kerneltype) : __elfN(moduletype)); - else - fp->f_type = strdup("elf multiboot kernel"); - #ifdef ELF_VERBOSE - if (ef.kernel) - printf("%s entry at 0x%jx\n", filename, (uintmax_t)ehdr->e_entry); + if (ef.kernel) + printf("%s entry at 0x%jx\n", filename, + (uintmax_t)ehdr->e_entry); #else - printf("%s ", filename); + printf("%s ", filename); #endif - fp->f_size = __elfN(loadimage)(fp, &ef, dest); - if (fp->f_size == 0 || fp->f_addr == 0) - goto ioerr; + fp->f_size = __elfN(loadimage)(fp, &ef, dest); + if (fp->f_size == 0 || fp->f_addr == 0) + goto ioerr; - /* save exec header as metadata */ - file_addmetadata(fp, MODINFOMD_ELFHDR, sizeof(*ehdr), ehdr); + /* save exec header as metadata */ + file_addmetadata(fp, MODINFOMD_ELFHDR, sizeof(*ehdr), ehdr); - /* Load OK, return module pointer */ - *result = (struct preloaded_file *)fp; - err = 0; - goto out; - - ioerr: - err = EIO; - oerr: - file_discard(fp); - out: - if (ef.firstpage) - free(ef.firstpage); - if (ef.fd != -1) - close(ef.fd); - return(err); + /* Load OK, return module pointer */ + *result = (struct preloaded_file *)fp; + err = 0; + goto out; + +ioerr: + err = EIO; +oerr: + file_discard(fp); +out: + if (ef.firstpage) + free(ef.firstpage); + if (ef.fd != -1) + close(ef.fd); + return (err); } /* @@ -410,408 +421,431 @@ __elfN(loadfile_raw)(char *filename, u_int64_t dest, static int __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) { - int i; - u_int j; - Elf_Ehdr *ehdr; - Elf_Phdr *phdr, *php; - Elf_Shdr *shdr; - char *shstr; - int ret; - vm_offset_t firstaddr; - vm_offset_t lastaddr; - size_t chunk; - ssize_t result; - Elf_Addr ssym, esym; - Elf_Dyn *dp; - Elf_Addr adp; - Elf_Addr ctors; - int ndp; - int symstrindex; - int symtabindex; - Elf_Size size; - u_int fpcopy; - Elf_Sym sym; - Elf_Addr p_start, p_end; + int i; + u_int j; + Elf_Ehdr *ehdr; + Elf_Phdr *phdr, *php; + Elf_Shdr *shdr; + char *shstr; + int ret; + vm_offset_t firstaddr; + vm_offset_t lastaddr; + size_t chunk; + ssize_t result; + Elf_Addr ssym, esym; + Elf_Dyn *dp; + Elf_Addr adp; + Elf_Addr ctors; + int ndp; + int symstrindex; + int symtabindex; + Elf_Size size; + u_int fpcopy; + Elf_Sym sym; + Elf_Addr p_start, p_end; - dp = NULL; - shdr = NULL; - ret = 0; - firstaddr = lastaddr = 0; - ehdr = ef->ehdr; - if (ehdr->e_type == ET_EXEC) { + dp = NULL; + shdr = NULL; + ret = 0; + firstaddr = lastaddr = 0; + ehdr = ef->ehdr; + if (ehdr->e_type == ET_EXEC) { #if defined(__i386__) || defined(__amd64__) #if __ELF_WORD_SIZE == 64 - off = - (off & 0xffffffffff000000ull);/* x86_64 relocates after locore */ + /* x86_64 relocates after locore */ + off = - (off & 0xffffffffff000000ull); #else - off = - (off & 0xff000000u); /* i386 relocates after locore */ + /* i386 relocates after locore */ + off = - (off & 0xff000000u); #endif #elif defined(__powerpc__) - /* - * On the purely virtual memory machines like e500, the kernel is - * linked against its final VA range, which is most often not - * available at the loader stage, but only after kernel initializes - * and completes its VM settings. In such cases we cannot use p_vaddr - * field directly to load ELF segments, but put them at some - * 'load-time' locations. - */ - if (off & 0xf0000000u) { - off = -(off & 0xf0000000u); - /* - * XXX the physical load address should not be hardcoded. Note - * that the Book-E kernel assumes that it's loaded at a 16MB - * boundary for now... - */ - off += 0x01000000; - ehdr->e_entry += off; + /* + * On the purely virtual memory machines like e500, the kernel + * is linked against its final VA range, which is most often + * not available at the loader stage, but only after kernel + * initializes and completes its VM settings. In such cases we + * cannot use p_vaddr field directly to load ELF segments, but + * put them at some 'load-time' locations. + */ + if (off & 0xf0000000u) { + off = -(off & 0xf0000000u); + /* + * XXX the physical load address should not be + * hardcoded. Note that the Book-E kernel assumes that + * it's loaded at a 16MB boundary for now... + */ + off += 0x01000000; + ehdr->e_entry += off; #ifdef ELF_VERBOSE - printf("Converted entry 0x%08x\n", ehdr->e_entry); + printf("Converted entry 0x%08x\n", ehdr->e_entry); #endif - } else - off = 0; + } else + off = 0; #elif defined(__arm__) && !defined(EFI) - /* - * The elf headers in arm kernels specify virtual addresses in all - * header fields, even the ones that should be physical addresses. - * We assume the entry point is in the first page, and masking the page - * offset will leave us with the virtual address the kernel was linked - * at. We subtract that from the load offset, making 'off' into the - * value which, when added to a virtual address in an elf header, - * translates it to a physical address. We do the va->pa conversion on - * the entry point address in the header now, so that later we can - * launch the kernel by just jumping to that address. - * - * When booting from UEFI the copyin and copyout functions handle - * adjusting the location relative to the first virtual address. - * Because of this there is no need to adjust the offset or entry - * point address as these will both be handled by the efi code. - */ - off -= ehdr->e_entry & ~PAGE_MASK; - ehdr->e_entry += off; + /* + * The elf headers in arm kernels specify virtual addresses in + * all header fields, even the ones that should be physical + * addresses. We assume the entry point is in the first page, + * and masking the page offset will leave us with the virtual + * address the kernel was linked at. We subtract that from the + * load offset, making 'off' into the value which, when added + * to a virtual address in an elf header, translates it to a + * physical address. We do the va->pa conversion on the entry + * point address in the header now, so that later we can launch + * the kernel by just jumping to that address. + * + * When booting from UEFI the copyin and copyout functions + * handle adjusting the location relative to the first virtual + * address. Because of this there is no need to adjust the + * offset or entry point address as these will both be handled + * by the efi code. + */ + off -= ehdr->e_entry & ~PAGE_MASK; + ehdr->e_entry += off; #ifdef ELF_VERBOSE - printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off); + printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", + ehdr->e_entry, off); #endif #else - off = 0; /* other archs use direct mapped kernels */ + off = 0; /* other archs use direct mapped kernels */ #endif - } - ef->off = off; + } + ef->off = off; - if (ef->kernel) - __elfN(relocation_offset) = off; + if (ef->kernel) + __elfN(relocation_offset) = off; - if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n"); - goto out; - } - phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); + if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: program header not within first page\n"); + goto out; + } + phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); - for (i = 0; i < ehdr->e_phnum; i++) { - if (elf_program_header_convert(ehdr, phdr)) - continue; + for (i = 0; i < ehdr->e_phnum; i++) { + if (elf_program_header_convert(ehdr, phdr)) + continue; - /* We want to load PT_LOAD segments only.. */ - if (phdr[i].p_type != PT_LOAD) - continue; + /* We want to load PT_LOAD segments only.. */ + if (phdr[i].p_type != PT_LOAD) + continue; #ifdef ELF_VERBOSE - printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", - (long)phdr[i].p_filesz, (long)phdr[i].p_offset, - (long)(phdr[i].p_vaddr + off), - (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); + printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", + (long)phdr[i].p_filesz, (long)phdr[i].p_offset, + (long)(phdr[i].p_vaddr + off), + (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); #else - if ((phdr[i].p_flags & PF_W) == 0) { - printf("text=0x%lx ", (long)phdr[i].p_filesz); - } else { - printf("data=0x%lx", (long)phdr[i].p_filesz); - if (phdr[i].p_filesz < phdr[i].p_memsz) - printf("+0x%lx", (long)(phdr[i].p_memsz -phdr[i].p_filesz)); - printf(" "); - } + if ((phdr[i].p_flags & PF_W) == 0) { + printf("text=0x%lx ", (long)phdr[i].p_filesz); + } else { + printf("data=0x%lx", (long)phdr[i].p_filesz); + if (phdr[i].p_filesz < phdr[i].p_memsz) + printf("+0x%lx", (long)(phdr[i].p_memsz - + phdr[i].p_filesz)); + printf(" "); + } #endif - fpcopy = 0; - if (ef->firstlen > phdr[i].p_offset) { - fpcopy = ef->firstlen - phdr[i].p_offset; - archsw.arch_copyin(ef->firstpage + phdr[i].p_offset, - phdr[i].p_vaddr + off, fpcopy); - } - if (phdr[i].p_filesz > fpcopy) { - if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy, - phdr[i].p_filesz - fpcopy, phdr[i].p_offset + fpcopy) != 0) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) - "_loadimage: read failed\n"); - goto out; - } - } - /* clear space from oversized segments; eg: bss */ - if (phdr[i].p_filesz < phdr[i].p_memsz) { + fpcopy = 0; + if (ef->firstlen > phdr[i].p_offset) { + fpcopy = ef->firstlen - phdr[i].p_offset; + archsw.arch_copyin(ef->firstpage + phdr[i].p_offset, + phdr[i].p_vaddr + off, fpcopy); + } + if (phdr[i].p_filesz > fpcopy) { + if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy, + phdr[i].p_filesz - fpcopy, + phdr[i].p_offset + fpcopy) != 0) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: read failed\n"); + goto out; + } + } + /* clear space from oversized segments; eg: bss */ + if (phdr[i].p_filesz < phdr[i].p_memsz) { #ifdef ELF_VERBOSE - printf(" (bss: 0x%lx-0x%lx)", - (long)(phdr[i].p_vaddr + off + phdr[i].p_filesz), - (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); + printf(" (bss: 0x%lx-0x%lx)", + (long)(phdr[i].p_vaddr + off + phdr[i].p_filesz), + (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz -1)); #endif - kern_bzero(phdr[i].p_vaddr + off + phdr[i].p_filesz, - phdr[i].p_memsz - phdr[i].p_filesz); - } + kern_bzero(phdr[i].p_vaddr + off + phdr[i].p_filesz, + phdr[i].p_memsz - phdr[i].p_filesz); + } #ifdef ELF_VERBOSE - printf("\n"); + printf("\n"); #endif - if (archsw.arch_loadseg != NULL) - archsw.arch_loadseg(ehdr, phdr + i, off); + if (archsw.arch_loadseg != NULL) + archsw.arch_loadseg(ehdr, phdr + i, off); - if (firstaddr == 0 || firstaddr > (phdr[i].p_vaddr + off)) - firstaddr = phdr[i].p_vaddr + off; - if (lastaddr == 0 || lastaddr < (phdr[i].p_vaddr + off + phdr[i].p_memsz)) - lastaddr = phdr[i].p_vaddr + off + phdr[i].p_memsz; - } - lastaddr = roundup(lastaddr, sizeof(long)); + if (firstaddr == 0 || firstaddr > (phdr[i].p_vaddr + off)) + firstaddr = phdr[i].p_vaddr + off; + if (lastaddr == 0 || lastaddr < + (phdr[i].p_vaddr + off + phdr[i].p_memsz)) + lastaddr = phdr[i].p_vaddr + off + phdr[i].p_memsz; + } + lastaddr = roundup(lastaddr, sizeof(long)); - /* - * Get the section headers. We need this for finding the .ctors - * section as well as for loading any symbols. Both may be hard - * to do if reading from a .gz file as it involves seeking. I - * think the rule is going to have to be that you must strip a - * file to remove symbols before gzipping it. - */ - chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; - if (chunk == 0 || ehdr->e_shoff == 0) - goto nosyms; - shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); - if (shdr == NULL) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) - "_loadimage: failed to read section headers"); - goto nosyms; - } + /* + * Get the section headers. We need this for finding the .ctors + * section as well as for loading any symbols. Both may be hard + * to do if reading from a .gz file as it involves seeking. I + * think the rule is going to have to be that you must strip a + * file to remove symbols before gzipping it. + */ + chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; + if (chunk == 0 || ehdr->e_shoff == 0) + goto nosyms; + shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); + if (shdr == NULL) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: failed to read section headers"); + goto nosyms; + } - for (i = 0; i < ehdr->e_shnum; i++) - elf_section_header_convert(ehdr, &shdr[i]); + for (i = 0; i < ehdr->e_shnum; i++) + elf_section_header_convert(ehdr, &shdr[i]); - file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); - /* - * Read the section string table and look for the .ctors section. - * We need to tell the kernel where it is so that it can call the - * ctors. - */ - chunk = shdr[ehdr->e_shstrndx].sh_size; - if (chunk) { - shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, chunk); - if (shstr) { - for (i = 0; i < ehdr->e_shnum; i++) { - if (strcmp(shstr + shdr[i].sh_name, ".ctors") != 0) - continue; - ctors = shdr[i].sh_addr; - file_addmetadata(fp, MODINFOMD_CTORS_ADDR, sizeof(ctors), - &ctors); - size = shdr[i].sh_size; - file_addmetadata(fp, MODINFOMD_CTORS_SIZE, sizeof(size), - &size); - break; - } - free(shstr); + /* + * Read the section string table and look for the .ctors section. + * We need to tell the kernel where it is so that it can call the + * ctors. + */ + chunk = shdr[ehdr->e_shstrndx].sh_size; + if (chunk) { + shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, + chunk); + if (shstr) { + for (i = 0; i < ehdr->e_shnum; i++) { + if (strcmp(shstr + shdr[i].sh_name, + ".ctors") != 0) + continue; + ctors = shdr[i].sh_addr; + file_addmetadata(fp, MODINFOMD_CTORS_ADDR, + sizeof(ctors), &ctors); + size = shdr[i].sh_size; + file_addmetadata(fp, MODINFOMD_CTORS_SIZE, + sizeof(size), &size); + break; + } + free(shstr); + } } - } - /* - * Now load any symbols. - */ - symtabindex = -1; - symstrindex = -1; - for (i = 0; i < ehdr->e_shnum; i++) { - if (shdr[i].sh_type != SHT_SYMTAB) - continue; - for (j = 0; j < ehdr->e_phnum; j++) { - if (phdr[j].p_type != PT_LOAD) - continue; - if (shdr[i].sh_offset >= phdr[j].p_offset && - (shdr[i].sh_offset + shdr[i].sh_size <= - phdr[j].p_offset + phdr[j].p_filesz)) { - shdr[i].sh_offset = 0; - shdr[i].sh_size = 0; - break; - } + /* + * Now load any symbols. + */ + symtabindex = -1; + symstrindex = -1; + for (i = 0; i < ehdr->e_shnum; i++) { + if (shdr[i].sh_type != SHT_SYMTAB) + continue; + for (j = 0; j < ehdr->e_phnum; j++) { + if (phdr[j].p_type != PT_LOAD) + continue; + if (shdr[i].sh_offset >= phdr[j].p_offset && + (shdr[i].sh_offset + shdr[i].sh_size <= + phdr[j].p_offset + phdr[j].p_filesz)) { + shdr[i].sh_offset = 0; + shdr[i].sh_size = 0; + break; + } + } + if (shdr[i].sh_offset == 0 || shdr[i].sh_size == 0) + continue; /* alread loaded in a PT_LOAD above */ + /* Save it for loading below */ + symtabindex = i; + symstrindex = shdr[i].sh_link; } - if (shdr[i].sh_offset == 0 || shdr[i].sh_size == 0) - continue; /* alread loaded in a PT_LOAD above */ - /* Save it for loading below */ - symtabindex = i; - symstrindex = shdr[i].sh_link; - } - if (symtabindex < 0 || symstrindex < 0) - goto nosyms; + if (symtabindex < 0 || symstrindex < 0) + goto nosyms; - /* Ok, committed to a load. */ + /* Ok, committed to a load. */ #ifndef ELF_VERBOSE - printf("syms=["); + printf("syms=["); #endif - ssym = lastaddr; - for (i = symtabindex; i >= 0; i = symstrindex) { + ssym = lastaddr; + for (i = symtabindex; i >= 0; i = symstrindex) { #ifdef ELF_VERBOSE - char *secname; + char *secname; - switch(shdr[i].sh_type) { - case SHT_SYMTAB: /* Symbol table */ - secname = "symtab"; - break; - case SHT_STRTAB: /* String table */ - secname = "strtab"; - break; - default: - secname = "WHOA!!"; - break; - } + switch(shdr[i].sh_type) { + case SHT_SYMTAB: /* Symbol table */ + secname = "symtab"; + break; + case SHT_STRTAB: /* String table */ + secname = "strtab"; + break; + default: + secname = "WHOA!!"; + break; + } #endif - size = shdr[i].sh_size; + size = shdr[i].sh_size; #if defined(__powerpc__) #if __ELF_WORD_SIZE == 64 - size = htobe64(size); + size = htobe64(size); #else - size = htobe32(size); + size = htobe32(size); #endif #endif - archsw.arch_copyin(&size, lastaddr, sizeof(size)); - lastaddr += sizeof(size); + archsw.arch_copyin(&size, lastaddr, sizeof(size)); + lastaddr += sizeof(size); #ifdef ELF_VERBOSE - printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, - (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, - (uintmax_t)lastaddr, (uintmax_t)(lastaddr + shdr[i].sh_size)); + printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, + (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, + (uintmax_t)lastaddr, + (uintmax_t)(lastaddr + shdr[i].sh_size)); #else - if (i == symstrindex) - printf("+"); - printf("0x%lx+0x%lx", (long)sizeof(size), (long)size); + if (i == symstrindex) + printf("+"); + printf("0x%lx+0x%lx", (long)sizeof(size), (long)size); #endif - if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not seek for symbols - skipped!"); - lastaddr = ssym; - ssym = 0; - goto nosyms; + if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: could not seek for symbols - skipped!"); + lastaddr = ssym; + ssym = 0; + goto nosyms; + } + result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); + if (result < 0 || (size_t)result != shdr[i].sh_size) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: could not read symbols - skipped! " + "(%ju != %ju)", (uintmax_t)result, + (uintmax_t)shdr[i].sh_size); + lastaddr = ssym; + ssym = 0; + goto nosyms; + } + /* Reset offsets relative to ssym */ + lastaddr += shdr[i].sh_size; + lastaddr = roundup(lastaddr, sizeof(size)); + if (i == symtabindex) + symtabindex = -1; + else if (i == symstrindex) + symstrindex = -1; } - result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); - if (result < 0 || (size_t)result != shdr[i].sh_size) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju != %ju)", (uintmax_t)result, - (uintmax_t)shdr[i].sh_size); - lastaddr = ssym; - ssym = 0; - goto nosyms; - } - /* Reset offsets relative to ssym */ - lastaddr += shdr[i].sh_size; - lastaddr = roundup(lastaddr, sizeof(size)); - if (i == symtabindex) - symtabindex = -1; - else if (i == symstrindex) - symstrindex = -1; - } - esym = lastaddr; + esym = lastaddr; #ifndef ELF_VERBOSE - printf("]"); + printf("]"); #endif #if defined(__powerpc__) /* On PowerPC we always need to provide BE data to the kernel */ #if __ELF_WORD_SIZE == 64 - ssym = htobe64((uint64_t)ssym); - esym = htobe64((uint64_t)esym); + ssym = htobe64((uint64_t)ssym); + esym = htobe64((uint64_t)esym); #else - ssym = htobe32((uint32_t)ssym); - esym = htobe32((uint32_t)esym); + ssym = htobe32((uint32_t)ssym); + esym = htobe32((uint32_t)esym); #endif #endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); - file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); + file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); + file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); nosyms: - printf("\n"); + printf("\n"); - ret = lastaddr - firstaddr; - fp->f_addr = firstaddr; + ret = lastaddr - firstaddr; + fp->f_addr = firstaddr; - php = NULL; - for (i = 0; i < ehdr->e_phnum; i++) { - if (phdr[i].p_type == PT_DYNAMIC) { - php = phdr + i; - adp = php->p_vaddr; - file_addmetadata(fp, MODINFOMD_DYNAMIC, sizeof(adp), &adp); - break; + php = NULL; + for (i = 0; i < ehdr->e_phnum; i++) { + if (phdr[i].p_type == PT_DYNAMIC) { + php = phdr + i; + adp = php->p_vaddr; + file_addmetadata(fp, MODINFOMD_DYNAMIC, sizeof(adp), + &adp); + break; + } } - } - if (php == NULL) /* this is bad, we cannot get to symbols or _DYNAMIC */ - goto out; + if (php == NULL) /* this is bad, we cannot get to symbols or _DYNAMIC */ + goto out; - ndp = php->p_filesz / sizeof(Elf_Dyn); - if (ndp == 0) - goto out; - dp = malloc(php->p_filesz); - if (dp == NULL) - goto out; - archsw.arch_copyout(php->p_vaddr + off, dp, php->p_filesz); + ndp = php->p_filesz / sizeof(Elf_Dyn); + if (ndp == 0) + goto out; + dp = malloc(php->p_filesz); + if (dp == NULL) + goto out; + archsw.arch_copyout(php->p_vaddr + off, dp, php->p_filesz); - ef->strsz = 0; - for (i = 0; i < ndp; i++) { - if (dp[i].d_tag == 0) - break; - switch (dp[i].d_tag) { - case DT_HASH: - ef->hashtab = (Elf_Hashelt*)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_STRTAB: - ef->strtab = (char *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_STRSZ: - ef->strsz = dp[i].d_un.d_val; - break; - case DT_SYMTAB: - ef->symtab = (Elf_Sym*)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_REL: - ef->rel = (Elf_Rel *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_RELSZ: - ef->relsz = dp[i].d_un.d_val; - break; - case DT_RELA: - ef->rela = (Elf_Rela *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_RELASZ: - ef->relasz = dp[i].d_un.d_val; - break; - default: - break; + ef->strsz = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 19:56:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E679F24F94; Wed, 21 Feb 2018 19:56:20 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5A946F367; Wed, 21 Feb 2018 19:56:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC3831D08B; Wed, 21 Feb 2018 19:56:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJuJfd067852; Wed, 21 Feb 2018 19:56:19 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJuJQ2067851; Wed, 21 Feb 2018 19:56:19 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802211956.w1LJuJQ2067851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 21 Feb 2018 19:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329746 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 329746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:56:20 -0000 Author: mckusick Date: Wed Feb 21 19:56:19 2018 New Revision: 329746 URL: https://svnweb.freebsd.org/changeset/base/329746 Log: Refactor fix in r329600 to do its check once in readsuper() rather than in the two places that call readsuper(). No semantic change intended. Reviewed by: kib Modified: head/sys/ufs/ffs/ffs_subr.c Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Wed Feb 21 19:42:54 2018 (r329745) +++ head/sys/ufs/ffs/ffs_subr.c Wed Feb 21 19:56:19 2018 (r329746) @@ -174,17 +174,12 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper *fsp = NULL; if (altsuperblock != -1) { - ret = readsuper(devfd, fsp, altsuperblock, readfunc); - if (*fsp != NULL) - (*fsp)->fs_csp = NULL; - if (ret != 0) + if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0) return (ret); } else { for (i = 0; sblock_try[i] != -1; i++) { - ret = readsuper(devfd, fsp, sblock_try[i], readfunc); - if (*fsp != NULL) - (*fsp)->fs_csp = NULL; - if (ret == 0) + if ((ret = readsuper(devfd, fsp, sblock_try[i], + readfunc)) == 0) break; if (ret == ENOENT) continue; @@ -193,13 +188,11 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper if (sblock_try[i] == -1) return (ENOENT); } - /* - * Not filling in summary information, return. + * If not filling in summary information, return. */ if (filltype == NULL) return (0); - /* * Read in the superblock summary information. */ @@ -252,6 +245,8 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo int error; error = (*readfunc)(devfd, sblockloc, (void **)fsp, SBLOCKSIZE); + if (*fsp != NULL) + (*fsp)->fs_csp = NULL; /* Not yet any summary information */ if (error != 0) return (error); fs = *fsp; From owner-svn-src-all@freebsd.org Wed Feb 21 19:56:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3DC0F24FFF; Wed, 21 Feb 2018 19:56:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9C696F467; Wed, 21 Feb 2018 19:56:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4B781D08C; Wed, 21 Feb 2018 19:56:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJuYwJ067910; Wed, 21 Feb 2018 19:56:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJuYrX067909; Wed, 21 Feb 2018 19:56:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802211956.w1LJuYrX067909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 19:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329747 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:56:35 -0000 Author: kevans Date: Wed Feb 21 19:56:34 2018 New Revision: 329747 URL: https://svnweb.freebsd.org/changeset/base/329747 Log: lualoader: Replace 8-space indentation with a single tab Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Wed Feb 21 19:56:19 2018 (r329746) +++ head/stand/lua/drawer.lua Wed Feb 21 19:56:34 2018 (r329747) @@ -257,8 +257,8 @@ function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements drawer.drawlogo() - drawer.drawbrand() - drawer.drawbox() + drawer.drawbrand() + drawer.drawbox() return drawer.drawmenu(menu_opts) end From owner-svn-src-all@freebsd.org Wed Feb 21 20:17:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDA4EF2699E; Wed, 21 Feb 2018 20:17:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A72B8708A4; Wed, 21 Feb 2018 20:17:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A19B71D3CB; Wed, 21 Feb 2018 20:17:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LKH8FK078328; Wed, 21 Feb 2018 20:17:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LKH8k8078327; Wed, 21 Feb 2018 20:17:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802212017.w1LKH8k8078327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 20:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329748 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 20:17:10 -0000 Author: kevans Date: Wed Feb 21 20:17:08 2018 New Revision: 329748 URL: https://svnweb.freebsd.org/changeset/base/329748 Log: lualoader: Drop password length restrictions This seems to have been arbitrary; bootlock_password and password don't seem to have any documented length restrictions, and loader(8) probably shouldn't care about whatever GELI passphrase length restrictions might exist. Reported by: Kalle Carlbark Modified: head/stand/lua/password.lua Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Wed Feb 21 19:56:34 2018 (r329747) +++ head/stand/lua/password.lua Wed Feb 21 20:17:08 2018 (r329748) @@ -37,7 +37,7 @@ function password.read() local str = "" local n = 0 - repeat + while true do ch = io.getchar() if ch == core.KEY_ENTER then break @@ -55,7 +55,7 @@ function password.read() str = str .. string.char(ch) n = n + 1 end - until n == 16 + end return str end From owner-svn-src-all@freebsd.org Wed Feb 21 20:32:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F831F27C13; Wed, 21 Feb 2018 20:32:23 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51A6E71534; Wed, 21 Feb 2018 20:32:23 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C8B91D6D7; Wed, 21 Feb 2018 20:32:23 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LKWNrk087001; Wed, 21 Feb 2018 20:32:23 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LKWNon087000; Wed, 21 Feb 2018 20:32:23 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802212032.w1LKWNon087000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 21 Feb 2018 20:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329749 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 329749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 20:32:23 -0000 Author: mckusick Date: Wed Feb 21 20:32:23 2018 New Revision: 329749 URL: https://svnweb.freebsd.org/changeset/base/329749 Log: Fix a read past the end of a buffer in fsck. To minimize the time spent scanning all of the directories in pass 2 (Check Pathnames), fsck uses a search order based on the location of their first block. Zero length directories have no first block, so the array being used to hold the block numbers of directory inodes was of zero length. Thus a lookup was done past the end of the array getting at best a random value and at worst a segment fault. For zero length directories, this change allocates a one element block array and initializes it to zero. The effect is that all zero length directories are handled first in pass 2. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D14163 Modified: head/sbin/fsck_ffs/inode.c Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Wed Feb 21 20:17:08 2018 (r329748) +++ head/sbin/fsck_ffs/inode.c Wed Feb 21 20:32:23 2018 (r329749) @@ -453,8 +453,10 @@ cacheino(union dinode *dp, ino_t inumber) if (howmany(DIP(dp, di_size), sblock.fs_bsize) > UFS_NDADDR) blks = UFS_NDADDR + UFS_NIADDR; - else + else if (DIP(dp, di_size) > 0) blks = howmany(DIP(dp, di_size), sblock.fs_bsize); + else + blks = 1; inp = (struct inoinfo *) Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) From owner-svn-src-all@freebsd.org Wed Feb 21 20:45:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94F48F28D9B; Wed, 21 Feb 2018 20:45:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47B2871EE8; Wed, 21 Feb 2018 20:45:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E50E1D8A0; Wed, 21 Feb 2018 20:45:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LKjijx092560; Wed, 21 Feb 2018 20:45:44 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LKjiZt092559; Wed, 21 Feb 2018 20:45:44 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802212045.w1LKjiZt092559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Feb 2018 20:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329750 - head/lib/libifconfig X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libifconfig X-SVN-Commit-Revision: 329750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 20:45:44 -0000 Author: asomers Date: Wed Feb 21 20:45:43 2018 New Revision: 329750 URL: https://svnweb.freebsd.org/changeset/base/329750 Log: libifconfig: fix ifconfig_set_metric Due to a copy/paste error, ifconfig_set_metric actually set the mtu, not the metric. See Also: https://github.com/Savagedlight/libifconfig/issues/48 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/lib/libifconfig/libifconfig.c Modified: head/lib/libifconfig/libifconfig.c ============================================================================== --- head/lib/libifconfig/libifconfig.c Wed Feb 21 20:32:23 2018 (r329749) +++ head/lib/libifconfig/libifconfig.c Wed Feb 21 20:45:43 2018 (r329750) @@ -377,13 +377,13 @@ ifconfig_get_mtu(ifconfig_handle_t *h, const char *nam } int -ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) +ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric) { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_mtu = mtu; + ifr.ifr_metric = metric; if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { From owner-svn-src-all@freebsd.org Wed Feb 21 21:04:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B800F001A0; Wed, 21 Feb 2018 21:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF09F7305E; Wed, 21 Feb 2018 21:04:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5A561DBE1; Wed, 21 Feb 2018 21:04:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LL4lJY006678; Wed, 21 Feb 2018 21:04:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LL4k9F006671; Wed, 21 Feb 2018 21:04:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212104.w1LL4k9F006671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 21:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329753 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fm vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/... X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fm vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/ztest vendor/illumos/dist... X-SVN-Commit-Revision: 329753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:04:48 -0000 Author: mav Date: Wed Feb 21 21:04:46 2018 New Revision: 329753 URL: https://svnweb.freebsd.org/changeset/base/329753 Log: 8809 libzpool should leverage work done in libfakekernel illumos/illumos-gate@f06dce2c1f0f3af78581e7574f65bfba843ddb6e Reviewed by: Sebastien Roy Reviewed by: Prakash Surya Reviewed by: Gordon Ross Approved by: Richard Lowe Author: Andrew Stormont Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/sys/acl.h vendor-sys/illumos/dist/uts/common/sys/bitmap.h vendor-sys/illumos/dist/uts/common/sys/cpupart.h vendor-sys/illumos/dist/uts/common/sys/cpuvar.h vendor-sys/illumos/dist/uts/common/sys/fm/util.h vendor-sys/illumos/dist/uts/common/sys/vnode.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/lib/libzpool/common/taskq.c vendor/illumos/dist/lib/libzpool/common/util.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Wed Feb 21 21:04:46 2018 (r329753) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ #include @@ -59,7 +60,9 @@ static dnode_phys_t dnode_phys_zero; int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT; +#ifdef _KERNEL static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); +#endif /* _KERNEL */ static int dbuf_compare(const void *x1, const void *x2) @@ -213,7 +216,9 @@ dnode_init(void) dnode_cache = kmem_cache_create("dnode_t", sizeof (dnode_t), 0, dnode_cons, dnode_dest, NULL, NULL, NULL, 0); +#ifdef _KERNEL kmem_cache_set_move(dnode_cache, dnode_move); +#endif /* _KERNEL */ } void @@ -405,7 +410,9 @@ dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_ dnode_t *dn; dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); +#ifdef _KERNEL ASSERT(!POINTER_IS_VALID(dn->dn_objset)); +#endif /* _KERNEL */ dn->dn_moved = 0; /* @@ -697,6 +704,7 @@ static struct { } dnode_move_stats; #endif /* DNODE_STATS */ +#ifdef _KERNEL static void dnode_move_impl(dnode_t *odn, dnode_t *ndn) { @@ -833,7 +841,6 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) odn->dn_moved = (uint8_t)-1; } -#ifdef _KERNEL /*ARGSUSED*/ static kmem_cbrc_t dnode_move(void *buf, void *newbuf, size_t size, void *arg) Modified: vendor-sys/illumos/dist/uts/common/sys/acl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/acl.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/acl.h Wed Feb 21 21:04:46 2018 (r329753) @@ -25,6 +25,7 @@ * Use is subject to license terms. * * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_ACL_H @@ -138,7 +139,7 @@ typedef struct acl_info acl_t; #define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED| \ ACL_DEFAULTED) -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) /* * These are only applicable in a CIFS context. Modified: vendor-sys/illumos/dist/uts/common/sys/bitmap.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/bitmap.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/bitmap.h Wed Feb 21 21:04:46 2018 (r329753) @@ -26,6 +26,7 @@ /* * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright 2017 RackTop Systems. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -134,7 +135,7 @@ extern "C" { #define BIT_ONLYONESET(u) \ ((((u) == 0) ? 0 : ((u) & ((u) - 1)) == 0)) -#if defined(_KERNEL) && !defined(_ASM) +#if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && !defined(_ASM) #include /* @@ -188,7 +189,7 @@ extern int odd_parity(ulong_t); */ #define BITX(u, h, l) (((u) >> (l)) & ((1LU << ((h) - (l) + 1LU)) - 1LU)) -#endif /* _KERNEL && !_ASM */ +#endif /* (_KERNEL || _FAKE_KERNEL) && !_ASM */ #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/uts/common/sys/cpupart.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/cpupart.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/cpupart.h Wed Feb 21 21:04:46 2018 (r329753) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_CPUPART_H @@ -40,7 +41,7 @@ extern "C" { #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) typedef int cpupartid_t; @@ -148,7 +149,7 @@ extern uint_t cpupart_list(psetid_t *, uint_t, int); extern int cpupart_setattr(psetid_t, uint_t); extern int cpupart_getattr(psetid_t, uint_t *); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/uts/common/sys/cpuvar.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/cpuvar.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/cpuvar.h Wed Feb 21 21:04:46 2018 (r329753) @@ -23,6 +23,7 @@ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2014 Igor Kozhukhov . + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_CPUVAR_H @@ -32,6 +33,7 @@ #include /* has cpu_stat_t definition */ #include #include +#include /* has kcpc_ctx_t definition */ #include #if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP) @@ -614,9 +616,9 @@ extern struct cpu *curcpup(void); #endif /* _KERNEL || _KMEMUSER */ /* - * CPU support routines. + * CPU support routines (not for genassym.c) */ -#if defined(_KERNEL) && defined(__STDC__) /* not for genassym.c */ +#if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && defined(__STDC__) struct zone; @@ -823,7 +825,7 @@ extern void populate_idstr(struct cpu *); extern void cpu_vm_data_init(struct cpu *); extern void cpu_vm_data_destroy(struct cpu *); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/uts/common/sys/fm/util.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fm/util.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/fm/util.h Wed Feb 21 21:04:46 2018 (r329753) @@ -21,6 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_FM_UTIL_H @@ -70,7 +71,7 @@ typedef struct erpt_dump { } ed_tod_base; } erpt_dump_t; -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) #include #define FM_STK_DEPTH 20 /* maximum stack depth */ @@ -94,7 +95,7 @@ extern void fm_ereport_post(nvlist_t *, int); extern void fm_payload_stack_add(nvlist_t *, const pc_t *, int); extern int is_fm_panic(); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/uts/common/sys/vnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Feb 21 20:56:28 2018 (r329752) +++ vendor-sys/illumos/dist/uts/common/sys/vnode.h Wed Feb 21 21:04:46 2018 (r329753) @@ -23,6 +23,7 @@ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Joyent, Inc. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright 2017 RackTop Systems. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -340,6 +341,7 @@ typedef struct vnode { #define IS_SWAPVP(vp) (((vp)->v_flag & (VISSWAP | VSWAPLIKE)) != 0) +#ifdef _KERNEL typedef struct vn_vfslocks_entry { rwstlock_t ve_lock; void *ve_vpvfs; @@ -348,6 +350,7 @@ typedef struct vn_vfslocks_entry { char pad[64 - sizeof (rwstlock_t) - 2 * sizeof (void *) - \ sizeof (uint32_t)]; } vn_vfslocks_entry_t; +#endif /* * The following two flags are used to lock the v_vfsmountedhere field From owner-svn-src-all@freebsd.org Wed Feb 21 21:04:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85727F001AC; Wed, 21 Feb 2018 21:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F2157305F; Wed, 21 Feb 2018 21:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FD3A1DBE2; Wed, 21 Feb 2018 21:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LL4mEq006687; Wed, 21 Feb 2018 21:04:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LL4lQO006683; Wed, 21 Feb 2018 21:04:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212104.w1LL4lQO006683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 21:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329753 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fm vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/... X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fm vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/ztest vendor/illumos/dist... X-SVN-Commit-Revision: 329753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:04:48 -0000 Author: mav Date: Wed Feb 21 21:04:46 2018 New Revision: 329753 URL: https://svnweb.freebsd.org/changeset/base/329753 Log: 8809 libzpool should leverage work done in libfakekernel illumos/illumos-gate@f06dce2c1f0f3af78581e7574f65bfba843ddb6e Reviewed by: Sebastien Roy Reviewed by: Prakash Surya Reviewed by: Gordon Ross Approved by: Richard Lowe Author: Andrew Stormont Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/lib/libzpool/common/taskq.c vendor/illumos/dist/lib/libzpool/common/util.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/sys/acl.h vendor-sys/illumos/dist/uts/common/sys/bitmap.h vendor-sys/illumos/dist/uts/common/sys/cpupart.h vendor-sys/illumos/dist/uts/common/sys/cpuvar.h vendor-sys/illumos/dist/uts/common/sys/fm/util.h vendor-sys/illumos/dist/uts/common/sys/vnode.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Feb 21 20:56:28 2018 (r329752) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Feb 21 21:04:46 2018 (r329753) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. + * Copyright 2017 RackTop Systems. */ #include @@ -87,11 +88,13 @@ extern int reference_tracking_enable; extern boolean_t zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; extern int zfs_vdev_async_read_max_active; +extern int aok; #else int reference_tracking_enable; boolean_t zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; +int aok; #endif static const char cmdname[] = "zdb"; Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Wed Feb 21 20:56:28 2018 (r329752) +++ vendor/illumos/dist/cmd/ztest/ztest.c Wed Feb 21 21:04:46 2018 (r329753) @@ -25,6 +25,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Joyent, Inc. + * Copyright 2017 RackTop Systems. */ /* @@ -245,8 +246,8 @@ typedef enum { typedef struct rll { void *rll_writer; int rll_readers; - mutex_t rll_lock; - cond_t rll_cv; + kmutex_t rll_lock; + kcondvar_t rll_cv; } rll_t; typedef struct rl { @@ -280,11 +281,11 @@ typedef struct ztest_od { typedef struct ztest_ds { ztest_shared_ds_t *zd_shared; objset_t *zd_os; - rwlock_t zd_zilog_lock; + krwlock_t zd_zilog_lock; zilog_t *zd_zilog; ztest_od_t *zd_od; /* debugging aid */ char zd_name[ZFS_MAX_DATASET_NAME_LEN]; - mutex_t zd_dirobj_lock; + kmutex_t zd_dirobj_lock; rll_t zd_object_lock[ZTEST_OBJECT_LOCKS]; rll_t zd_range_lock[ZTEST_RANGE_LOCKS]; } ztest_ds_t; @@ -395,7 +396,7 @@ ztest_info_t ztest_info[] = { * The callbacks are ordered by txg number. */ typedef struct ztest_cb_list { - mutex_t zcl_callbacks_lock; + kmutex_t zcl_callbacks_lock; list_t zcl_callbacks; } ztest_cb_list_t; @@ -430,7 +431,7 @@ ztest_shared_t *ztest_shared; static spa_t *ztest_spa = NULL; static ztest_ds_t *ztest_ds; -static mutex_t ztest_vdev_lock; +static kmutex_t ztest_vdev_lock; /* * The ztest_name_lock protects the pool and dataset namespace used by @@ -438,7 +439,7 @@ static mutex_t ztest_vdev_lock; * this lock as writer. Grabbing the lock as reader will ensure that the * namespace does not change while the lock is held. */ -static rwlock_t ztest_name_lock; +static krwlock_t ztest_name_lock; static boolean_t ztest_dump_core = B_TRUE; static boolean_t ztest_exiting; @@ -1094,8 +1095,8 @@ ztest_rll_init(rll_t *rll) { rll->rll_writer = NULL; rll->rll_readers = 0; - VERIFY(_mutex_init(&rll->rll_lock, USYNC_THREAD, NULL) == 0); - VERIFY(cond_init(&rll->rll_cv, USYNC_THREAD, NULL) == 0); + mutex_init(&rll->rll_lock, NULL, USYNC_THREAD, NULL); + cv_init(&rll->rll_cv, NULL, USYNC_THREAD, NULL); } static void @@ -1103,32 +1104,32 @@ ztest_rll_destroy(rll_t *rll) { ASSERT(rll->rll_writer == NULL); ASSERT(rll->rll_readers == 0); - VERIFY(_mutex_destroy(&rll->rll_lock) == 0); - VERIFY(cond_destroy(&rll->rll_cv) == 0); + mutex_destroy(&rll->rll_lock); + cv_destroy(&rll->rll_cv); } static void ztest_rll_lock(rll_t *rll, rl_type_t type) { - VERIFY(mutex_lock(&rll->rll_lock) == 0); + mutex_enter(&rll->rll_lock); if (type == RL_READER) { while (rll->rll_writer != NULL) - (void) cond_wait(&rll->rll_cv, &rll->rll_lock); + cv_wait(&rll->rll_cv, &rll->rll_lock); rll->rll_readers++; } else { while (rll->rll_writer != NULL || rll->rll_readers) - (void) cond_wait(&rll->rll_cv, &rll->rll_lock); + cv_wait(&rll->rll_cv, &rll->rll_lock); rll->rll_writer = curthread; } - VERIFY(mutex_unlock(&rll->rll_lock) == 0); + mutex_exit(&rll->rll_lock); } static void ztest_rll_unlock(rll_t *rll) { - VERIFY(mutex_lock(&rll->rll_lock) == 0); + mutex_enter(&rll->rll_lock); if (rll->rll_writer) { ASSERT(rll->rll_readers == 0); @@ -1140,9 +1141,9 @@ ztest_rll_unlock(rll_t *rll) } if (rll->rll_writer == NULL && rll->rll_readers == 0) - VERIFY(cond_broadcast(&rll->rll_cv) == 0); + cv_broadcast(&rll->rll_cv); - VERIFY(mutex_unlock(&rll->rll_lock) == 0); + mutex_exit(&rll->rll_lock); } static void @@ -1201,8 +1202,8 @@ ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, if (zd->zd_shared != NULL) zd->zd_shared->zd_seq = 0; - VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); - VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); + rw_init(&zd->zd_zilog_lock, NULL, USYNC_THREAD, NULL); + mutex_init(&zd->zd_dirobj_lock, NULL, USYNC_THREAD, NULL); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) ztest_rll_init(&zd->zd_object_lock[l]); @@ -1214,7 +1215,7 @@ ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, static void ztest_zd_fini(ztest_ds_t *zd) { - VERIFY(_mutex_destroy(&zd->zd_dirobj_lock) == 0); + mutex_destroy(&zd->zd_dirobj_lock); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) ztest_rll_destroy(&zd->zd_object_lock[l]); @@ -1969,7 +1970,7 @@ ztest_lookup(ztest_ds_t *zd, ztest_od_t *od, int count int missing = 0; int error; - ASSERT(_mutex_held(&zd->zd_dirobj_lock)); + ASSERT(MUTEX_HELD(&zd->zd_dirobj_lock)); for (int i = 0; i < count; i++, od++) { od->od_object = 0; @@ -2009,7 +2010,7 @@ ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count { int missing = 0; - ASSERT(_mutex_held(&zd->zd_dirobj_lock)); + ASSERT(MUTEX_HELD(&zd->zd_dirobj_lock)); for (int i = 0; i < count; i++, od++) { if (missing) { @@ -2054,7 +2055,7 @@ ztest_remove(ztest_ds_t *zd, ztest_od_t *od, int count int missing = 0; int error; - ASSERT(_mutex_held(&zd->zd_dirobj_lock)); + ASSERT(MUTEX_HELD(&zd->zd_dirobj_lock)); od += count - 1; @@ -2200,7 +2201,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t off if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; - (void) rw_rdlock(&zd->zd_zilog_lock); + rw_enter(&zd->zd_zilog_lock, RW_READER); switch (io_type) { @@ -2237,7 +2238,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t off break; case ZTEST_IO_REWRITE: - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); err = ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_CHECKSUM, spa_dedup_checksum(ztest_spa), B_FALSE); @@ -2247,7 +2248,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t off ztest_random_dsl_prop(ZFS_PROP_COMPRESSION), B_FALSE); VERIFY(err == 0 || err == ENOSPC); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); VERIFY0(dmu_read(zd->zd_os, object, offset, blocksize, data, DMU_READ_NO_PREFETCH)); @@ -2256,7 +2257,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t off break; } - (void) rw_unlock(&zd->zd_zilog_lock); + rw_exit(&zd->zd_zilog_lock); umem_free(data, blocksize); } @@ -2295,13 +2296,13 @@ ztest_object_init(ztest_ds_t *zd, ztest_od_t *od, size int count = size / sizeof (*od); int rv = 0; - VERIFY(mutex_lock(&zd->zd_dirobj_lock) == 0); + mutex_enter(&zd->zd_dirobj_lock); if ((ztest_lookup(zd, od, count) != 0 || remove) && (ztest_remove(zd, od, count) != 0 || ztest_create(zd, od, count) != 0)) rv = -1; zd->zd_od = od; - VERIFY(mutex_unlock(&zd->zd_dirobj_lock) == 0); + mutex_exit(&zd->zd_dirobj_lock); return (rv); } @@ -2312,7 +2313,7 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_t id) { zilog_t *zilog = zd->zd_zilog; - (void) rw_rdlock(&zd->zd_zilog_lock); + rw_enter(&zd->zd_zilog_lock, RW_READER); zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); @@ -2327,7 +2328,7 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_t id) zd->zd_shared->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); - (void) rw_unlock(&zd->zd_zilog_lock); + rw_exit(&zd->zd_zilog_lock); } /* @@ -2346,8 +2347,8 @@ ztest_zil_remount(ztest_ds_t *zd, uint64_t id) * updating the zil (i.e. adding in-memory log records) and the * zd_zilog_lock to block any I/O. */ - VERIFY0(mutex_lock(&zd->zd_dirobj_lock)); - (void) rw_wrlock(&zd->zd_zilog_lock); + mutex_enter(&zd->zd_dirobj_lock); + rw_enter(&zd->zd_zilog_lock, RW_WRITER); /* zfsvfs_teardown() */ zil_close(zd->zd_zilog); @@ -2356,8 +2357,8 @@ ztest_zil_remount(ztest_ds_t *zd, uint64_t id) VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); zil_replay(os, zd, ztest_replay_vector); - (void) rw_unlock(&zd->zd_zilog_lock); - VERIFY(mutex_unlock(&zd->zd_dirobj_lock) == 0); + rw_exit(&zd->zd_zilog_lock); + mutex_exit(&zd->zd_dirobj_lock); } /* @@ -2392,7 +2393,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) * Attempt to create an existing pool. It shouldn't matter * what's in the nvroot; we should fail with EEXIST. */ - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1); VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL)); nvlist_free(nvroot); @@ -2400,7 +2401,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); spa_close(spa, FTAG); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* ARGSUSED */ @@ -2413,7 +2414,7 @@ ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot, *props; char *name; - VERIFY0(mutex_lock(&ztest_vdev_lock)); + mutex_enter(&ztest_vdev_lock); name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool); /* @@ -2472,7 +2473,7 @@ ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) spa_close(spa, FTAG); strfree(name); - VERIFY0(mutex_unlock(&ztest_vdev_lock)); + mutex_exit(&ztest_vdev_lock); } static vdev_t * @@ -2525,7 +2526,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot; int error; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2551,9 +2552,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) * dmu_objset_destroy() to fail with EBUSY thus * leaving the dataset in an inconsistent state. */ - VERIFY(rw_wrlock(&ztest_name_lock) == 0); + rw_enter(&ztest_name_lock, RW_WRITER); error = spa_vdev_remove(spa, guid, B_FALSE); - VERIFY(rw_unlock(&ztest_name_lock) == 0); + rw_exit(&ztest_name_lock); if (error && error != EEXIST) fatal(0, "spa_vdev_remove() = %d", error); @@ -2577,7 +2578,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) fatal(0, "spa_vdev_add() = %d", error); } - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } /* @@ -2603,7 +2604,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) aux = ZPOOL_CONFIG_L2CACHE; } - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2660,7 +2661,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) fatal(0, "spa_vdev_remove(%llu) = %d", guid, error); } - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } /* @@ -2677,11 +2678,11 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id) uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); /* ensure we have a useable config; mirrors of raidz aren't supported */ if (zs->zs_mirrors < 3 || ztest_opts.zo_raidz > 1) { - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -2740,9 +2741,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id) spa_config_exit(spa, SCL_VDEV, FTAG); - (void) rw_wrlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_WRITER); error = spa_vdev_split_mirror(spa, "splitp", config, NULL, B_FALSE); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); nvlist_free(config); @@ -2755,7 +2756,7 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id) ++zs->zs_splits; --zs->zs_mirrors; } - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } @@ -2784,7 +2785,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) int oldvd_is_log; int error, expected_error; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); @@ -2797,7 +2798,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) */ if (spa->spa_vdev_removal != NULL) { spa_config_exit(spa, SCL_ALL, FTAG); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -2857,7 +2858,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) if (error != 0 && error != ENODEV && error != EBUSY && error != ENOTSUP) fatal(0, "detach (%s) returned %d", oldpath, error); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -2955,7 +2956,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) newsize, replacing, error, expected_error); } - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } /* ARGSUSED */ @@ -2966,7 +2967,7 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id) vdev_t *vd; uint64_t guid; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); vd = vdev_lookup_top(spa, ztest_random_vdev_top(spa, B_FALSE)); @@ -2975,7 +2976,7 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id) (void) spa_vdev_remove(spa, guid, B_FALSE); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } /* @@ -3103,7 +3104,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) uint64_t top; uint64_t old_class_space, new_class_space, old_ms_count, new_ms_count; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); spa_config_enter(spa, SCL_STATE, spa, RW_READER); /* @@ -3114,7 +3115,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) */ if (spa->spa_vdev_removal != NULL) { spa_config_exit(spa, SCL_STATE, FTAG); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -3143,7 +3144,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) if (tvd->vdev_state != VDEV_STATE_HEALTHY || psize == 0 || psize >= 4 * ztest_opts.zo_vdev_size) { spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } ASSERT(psize > 0); @@ -3168,7 +3169,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) "the vdev configuration changed.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -3202,7 +3203,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) "intervening vdev offline or remove.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); return; } @@ -3232,7 +3233,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } /* @@ -3343,7 +3344,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64 char name[ZFS_MAX_DATASET_NAME_LEN]; zilog_t *zilog; - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); (void) snprintf(name, sizeof (name), "%s/temp_%llu", ztest_opts.zo_pool, (u_longlong_t)id); @@ -3382,7 +3383,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64 if (error) { if (error == ENOSPC) { ztest_record_enospc(FTAG); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); return; } fatal(0, "dmu_objset_create(%s) = %d", name, error); @@ -3430,7 +3431,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64 dmu_objset_disown(os, FTAG); ztest_zd_fini(&zdtmp); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -3439,10 +3440,10 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64 void ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id) { - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); (void) ztest_snapshot_destroy(zd->zd_name, id); (void) ztest_snapshot_create(zd->zd_name, id); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -3501,7 +3502,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_ char *osname = zd->zd_name; int error; - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); ztest_dsl_dataset_cleanup(osname, id); @@ -3578,7 +3579,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_ out: ztest_dsl_dataset_cleanup(osname, id); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -4512,9 +4513,9 @@ ztest_commit_callback(void *arg, int error) ASSERT3U(data->zcd_txg, !=, 0); /* Remove our callback from the list */ - (void) mutex_lock(&zcl.zcl_callbacks_lock); + mutex_enter(&zcl.zcl_callbacks_lock); list_remove(&zcl.zcl_callbacks, data); - (void) mutex_unlock(&zcl.zcl_callbacks_lock); + mutex_exit(&zcl.zcl_callbacks_lock); out: umem_free(data, sizeof (ztest_cb_data_t)); @@ -4616,7 +4617,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id dmu_write(os, od[0].od_object, 0, sizeof (uint64_t), &txg, tx); - (void) mutex_lock(&zcl.zcl_callbacks_lock); + mutex_enter(&zcl.zcl_callbacks_lock); /* * Since commit callbacks don't have any ordering requirement and since @@ -4663,7 +4664,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id tmp_cb = cb_data[i]; } - (void) mutex_unlock(&zcl.zcl_callbacks_lock); + mutex_exit(&zcl.zcl_callbacks_lock); dmu_tx_commit(tx); } @@ -4679,27 +4680,27 @@ ztest_dsl_prop_get_set(ztest_ds_t *zd, uint64_t id) ZFS_PROP_DEDUP }; - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); for (int p = 0; p < sizeof (proplist) / sizeof (proplist[0]); p++) (void) ztest_dsl_prop_set_uint64(zd->zd_name, proplist[p], ztest_random_dsl_prop(proplist[p]), (int)ztest_random(2)); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* ARGSUSED */ void ztest_remap_blocks(ztest_ds_t *zd, uint64_t id) { - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); int error = dmu_objset_remap_indirects(zd->zd_name); if (error == ENOSPC) error = 0; ASSERT0(error); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* ARGSUSED */ @@ -4708,7 +4709,7 @@ ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id) { nvlist_t *props = NULL; - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO, ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN)); @@ -4720,7 +4721,7 @@ ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id) nvlist_free(props); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } static int @@ -4755,7 +4756,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id) char osname[ZFS_MAX_DATASET_NAME_LEN]; nvlist_t *holds; - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); dmu_objset_name(os, osname); @@ -4860,7 +4861,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id) VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT); out: - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -4888,11 +4889,11 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) uint64_t guid0 = 0; boolean_t islog = B_FALSE; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); maxfaults = MAXFAULTS(); leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; mirror_save = zs->zs_mirrors; - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); ASSERT(leaves >= 1); @@ -4902,7 +4903,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) * they are in progress (i.e. spa_change_guid). Those * operations will have grabbed the name lock as writer. */ - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); /* * We need SCL_STATE here because we're going to look at vd0->vdev_tsd. @@ -4974,7 +4975,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) if (sav->sav_count == 0) { spa_config_exit(spa, SCL_STATE, FTAG); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); return; } vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)]; @@ -4988,7 +4989,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) } spa_config_exit(spa, SCL_STATE, FTAG); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); /* * If we can tolerate two or more faults, or we're dealing @@ -5008,12 +5009,12 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) * leaving the dataset in an inconsistent state. */ if (islog) - (void) rw_wrlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_WRITER); VERIFY(vdev_offline(spa, guid0, flags) != EBUSY); if (islog) - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } else { /* * Ideally we would like to be able to randomly @@ -5024,9 +5025,9 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) * prevent a race between injection testing and * aux_vdev removal. */ - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); (void) vdev_online(spa, guid0, 0, NULL); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); } } @@ -5098,9 +5099,9 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) offset + sizeof (bad) > psize - VDEV_LABEL_END_SIZE) continue; - VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + mutex_enter(&ztest_vdev_lock); if (mirror_save != zs->zs_mirrors) { - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); (void) close(fd); return; } @@ -5109,7 +5110,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) fatal(1, "can't inject bad word at 0x%llx in %s", offset, pathrand); - VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); + mutex_exit(&ztest_vdev_lock); if (ztest_opts.zo_verbose >= 7) (void) printf("injected bad word into %s," @@ -5149,13 +5150,13 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id) * Take the name lock as writer to prevent anyone else from changing * the pool and dataset properies we need to maintain during this test. */ - (void) rw_wrlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_WRITER); if (ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_DEDUP, checksum, B_FALSE) != 0 || ztest_dsl_prop_set_uint64(zd->zd_name, ZFS_PROP_COPIES, 1, B_FALSE) != 0) { - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); return; } @@ -5174,7 +5175,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id) dmu_tx_hold_write(tx, object, 0, copies * blocksize); txg = ztest_tx_assign(tx, TXG_WAIT, FTAG); if (txg == 0) { - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); return; } @@ -5222,7 +5223,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id) abd_free(abd); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -5253,9 +5254,9 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id) orig = spa_guid(spa); load = spa_load_guid(spa); - (void) rw_wrlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_WRITER); error = spa_change_guid(spa); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); if (error != 0) return; @@ -5279,7 +5280,7 @@ ztest_spa_rename(ztest_ds_t *zd, uint64_t id) char *oldname, *newname; spa_t *spa; - (void) rw_wrlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_WRITER); oldname = ztest_opts.zo_pool; newname = umem_alloc(strlen(oldname) + 5, UMEM_NOFAIL); @@ -5319,7 +5320,7 @@ ztest_spa_rename(ztest_ds_t *zd, uint64_t id) umem_free(newname, strlen(newname) + 1); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); } /* @@ -5674,18 +5675,18 @@ ztest_dataset_open(int d) ztest_dataset_name(name, ztest_opts.zo_pool, d); - (void) rw_rdlock(&ztest_name_lock); + rw_enter(&ztest_name_lock, RW_READER); error = ztest_dataset_create(name); if (error == ENOSPC) { - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); ztest_record_enospc(FTAG); return (error); } ASSERT(error == 0 || error == EEXIST); VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, zd, &os)); - (void) rw_unlock(&ztest_name_lock); + rw_exit(&ztest_name_lock); ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os); @@ -5747,8 +5748,8 @@ ztest_run(ztest_shared_t *zs) /* * Initialize parent/child shared state. */ - VERIFY(_mutex_init(&ztest_vdev_lock, USYNC_THREAD, NULL) == 0); - VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) == 0); + mutex_init(&ztest_vdev_lock, NULL, USYNC_THREAD, NULL); + rw_init(&ztest_name_lock, NULL, USYNC_THREAD, NULL); zs->zs_thread_start = gethrtime(); zs->zs_thread_stop = @@ -5760,7 +5761,7 @@ ztest_run(ztest_shared_t *zs) ztest_random(ztest_opts.zo_passtime * NANOSEC); } - (void) _mutex_init(&zcl.zcl_callbacks_lock, USYNC_THREAD, NULL); + mutex_init(&zcl.zcl_callbacks_lock, NULL, USYNC_THREAD, NULL); list_create(&zcl.zcl_callbacks, sizeof (ztest_cb_data_t), offsetof(ztest_cb_data_t, zcd_node)); @@ -5907,10 +5908,10 @@ ztest_run(ztest_shared_t *zs) list_destroy(&zcl.zcl_callbacks); - (void) _mutex_destroy(&zcl.zcl_callbacks_lock); + mutex_destroy(&zcl.zcl_callbacks_lock); - (void) rwlock_destroy(&ztest_name_lock); - (void) _mutex_destroy(&ztest_vdev_lock); + rw_destroy(&ztest_name_lock); + mutex_destroy(&ztest_vdev_lock); } static void @@ -6054,8 +6055,8 @@ ztest_init(ztest_shared_t *zs) spa_t *spa; nvlist_t *nvroot, *props; - VERIFY(_mutex_init(&ztest_vdev_lock, USYNC_THREAD, NULL) == 0); - VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) == 0); + mutex_init(&ztest_vdev_lock, NULL, USYNC_THREAD, NULL); + rw_init(&ztest_name_lock, NULL, USYNC_THREAD, NULL); kernel_init(FREAD | FWRITE); @@ -6092,8 +6093,8 @@ ztest_init(ztest_shared_t *zs) ztest_run_zdb(ztest_opts.zo_pool); - (void) rwlock_destroy(&ztest_name_lock); - (void) _mutex_destroy(&ztest_vdev_lock); + rw_destroy(&ztest_name_lock); + mutex_destroy(&ztest_vdev_lock); } static void Modified: vendor/illumos/dist/lib/libzpool/common/kernel.c ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Feb 21 20:56:28 2018 (r329752) +++ vendor/illumos/dist/lib/libzpool/common/kernel.c Wed Feb 21 21:04:46 2018 (r329753) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2017 RackTop Systems. */ #include @@ -41,12 +42,14 @@ #include #include +extern void system_taskq_init(void); +extern void system_taskq_fini(void); + /* * Emulation of kernel services in userland. */ -int aok; -uint64_t physmem; +pgcnt_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; char hw_serial[HW_HOSTID_LEN]; kmutex_t cpu_lock; @@ -59,338 +62,8 @@ struct utsname utsname = { "userland", "libzpool", "1", "1", "na" }; -/* this only exists to have its address taken */ -struct proc p0; - /* * ========================================================================= - * threads - * ========================================================================= - */ -/*ARGSUSED*/ -kthread_t * -zk_thread_create(void (*func)(), void *arg) -{ - thread_t tid; - - VERIFY(thr_create(0, 0, (void *(*)(void *))func, arg, THR_DETACHED, - &tid) == 0); - - return ((void *)(uintptr_t)tid); -} - -/* - * ========================================================================= - * kstats - * ========================================================================= - */ -/*ARGSUSED*/ -kstat_t * -kstat_create(const char *module, int instance, const char *name, - const char *class, uchar_t type, ulong_t ndata, uchar_t ks_flag) -{ - return (NULL); -} - -/*ARGSUSED*/ -void -kstat_named_init(kstat_named_t *knp, const char *name, uchar_t type) -{} - -/*ARGSUSED*/ -void -kstat_install(kstat_t *ksp) -{} - -/*ARGSUSED*/ -void -kstat_delete(kstat_t *ksp) -{} - -/*ARGSUSED*/ -void -kstat_waitq_enter(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_waitq_exit(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_runq_enter(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_runq_exit(kstat_io_t *kiop) -{} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 21:13:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57A19F00B9E; Wed, 21 Feb 2018 21:13:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0254C737BE; Wed, 21 Feb 2018 21:13:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F13301DD74; Wed, 21 Feb 2018 21:13:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LLD9KR011424; Wed, 21 Feb 2018 21:13:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LLD8pF011410; Wed, 21 Feb 2018 21:13:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802212113.w1LLD8pF011410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Feb 2018 21:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329754 - in head/sbin/dhclient: . tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/sbin/dhclient: . tests X-SVN-Commit-Revision: 329754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:13:10 -0000 Author: asomers Date: Wed Feb 21 21:13:08 2018 New Revision: 329754 URL: https://svnweb.freebsd.org/changeset/base/329754 Log: dhclient: raise WARNS to 4 Mostly const-correctness fixes. There were also some variable-shadowing, unused variable, and a couple of sockaddr type-correctness changes. I also had trouble with cast-align warnings. I was able to prove that one of them was a false positive. But ultimately I had to disable the warning program-wide to deal with the others. Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14460 Modified: head/sbin/dhclient/Makefile head/sbin/dhclient/clparse.c head/sbin/dhclient/conflex.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h head/sbin/dhclient/dispatch.c head/sbin/dhclient/errwarn.c head/sbin/dhclient/hash.c head/sbin/dhclient/options.c head/sbin/dhclient/privsep.c head/sbin/dhclient/privsep.h head/sbin/dhclient/tables.c head/sbin/dhclient/tests/fake.c head/sbin/dhclient/tree.h Modified: head/sbin/dhclient/Makefile ============================================================================== --- head/sbin/dhclient/Makefile Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/Makefile Wed Feb 21 21:13:08 2018 (r329754) @@ -50,7 +50,8 @@ LIBADD+= cap_syslog CFLAGS+=-DWITH_CASPER .endif -WARNS?= 3 +WARNS?= 4 +NO_WCAST_ALIGN= yes HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/clparse.c Wed Feb 21 21:13:08 2018 (r329754) @@ -687,7 +687,7 @@ parse_option_decl(FILE *cfile, struct option_data *opt u_int8_t hunkbuf[1024]; unsigned hunkix = 0; char *vendor; - char *fmt; + const char *fmt; struct universe *universe; struct option *option; struct iaddr ip_addr; Modified: head/sbin/dhclient/conflex.c ============================================================================== --- head/sbin/dhclient/conflex.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/conflex.c Wed Feb 21 21:13:08 2018 (r329754) @@ -55,7 +55,7 @@ int lexchar; char *token_line; char *prev_line; char *cur_line; -char *tlname; +const char *tlname; int eol_token; static char line1[81]; @@ -78,7 +78,7 @@ static int read_num_or_name(int, FILE *); static int intern(char *, int); void -new_parse(char *name) +new_parse(const char *name) { tlname = name; lpos = line = 1; @@ -264,7 +264,7 @@ read_string(FILE *cfile) static int read_number(int c, FILE *cfile) { - int seenx = 0, token = NUMBER; + int seenx = 0, _token = NUMBER; unsigned i = 0; tokbuf[i++] = c; @@ -286,7 +286,7 @@ read_number(int c, FILE *cfile) tokbuf[i] = 0; tval = tokbuf; - return (token); + return (_token); } static int Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dhclient.c Wed Feb 21 21:13:08 2018 (r329754) @@ -91,7 +91,7 @@ cap_channel_t *capsyslog; time_t cur_time; time_t default_lease_time = 43200; /* 12 hours... */ -char *path_dhclient_conf = _PATH_DHCLIENT_CONF; +const char *path_dhclient_conf = _PATH_DHCLIENT_CONF; char *path_dhclient_db = NULL; int log_perror = 1; @@ -131,10 +131,10 @@ void routehandler(struct protocol *); void usage(void); int check_option(struct client_lease *l, int option); int check_classless_option(unsigned char *data, int len); -int ipv4addrs(char * buf); +int ipv4addrs(const char * buf); int res_hnok(const char *dn); int check_search(const char *srch); -char *option_as_string(unsigned int code, unsigned char *data, int len); +const char *option_as_string(unsigned int code, unsigned char *data, int len); int fork_privchld(int, int); #define ROUNDUP(a) \ @@ -201,26 +201,25 @@ uint8_t curbssid[6]; static void disassoc(void *arg) { - struct interface_info *ifi = arg; + struct interface_info *_ifi = arg; /* * Clear existing state. */ - if (ifi->client->active != NULL) { + if (_ifi->client->active != NULL) { script_init("EXPIRE", NULL); script_write_params("old_", - ifi->client->active); - if (ifi->client->alias) + _ifi->client->active); + if (_ifi->client->alias) script_write_params("alias_", - ifi->client->alias); + _ifi->client->alias); script_go(); } - ifi->client->state = S_INIT; + _ifi->client->state = S_INIT; } -/* ARGSUSED */ void -routehandler(struct protocol *p) +routehandler(struct protocol *p __unused) { char msg[2048], *addr; struct rt_msghdr *rtm; @@ -230,7 +229,7 @@ routehandler(struct protocol *p) struct ieee80211_join_event *jev; struct client_lease *l; time_t t = time(NULL); - struct sockaddr *sa; + struct sockaddr_in *sa; struct iaddr a; ssize_t n; int linkstat; @@ -254,13 +253,13 @@ routehandler(struct protocol *p) if (scripttime == 0 || t < scripttime + 10) break; - sa = get_ifa((char *)(ifam + 1), ifam->ifam_addrs); + sa = (struct sockaddr_in*)get_ifa((char *)(ifam + 1), ifam->ifam_addrs); if (sa == NULL) break; if ((a.len = sizeof(struct in_addr)) > sizeof(a.iabuf)) error("king bula sez: len mismatch"); - memcpy(a.iabuf, &((struct sockaddr_in *)sa)->sin_addr, a.len); + memcpy(a.iabuf, &sa->sin_addr, a.len); if (addr_eq(a, defaddr)) break; @@ -271,7 +270,7 @@ routehandler(struct protocol *p) if (l == NULL) /* added/deleted addr is not the one we set */ break; - addr = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr); + addr = inet_ntoa(sa->sin_addr); if (rtm->rtm_type == RTM_NEWADDR) { /* * XXX: If someone other than us adds our address, @@ -946,7 +945,7 @@ dhcp(struct packet *packet) { struct iaddrlist *ap; void (*handler)(struct packet *); - char *type; + const char *type; switch (packet->packet_type) { case DHCPOFFER: @@ -984,7 +983,7 @@ dhcpoffer(struct packet *packet) struct client_lease *lease, *lp; int i; int arp_timeout_needed, stop_selecting; - char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? + const char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? "DHCPOFFER" : "BOOTREPLY"; /* If we're not receptive to an offer right now, or if the offer @@ -1993,7 +1992,7 @@ write_client_lease(struct interface_info *ip, struct c } void -script_init(char *reason, struct string_list *medium) +script_init(const char *reason, struct string_list *medium) { size_t len, mediumlen = 0; struct imsg_hdr hdr; @@ -2028,7 +2027,7 @@ script_init(char *reason, struct string_list *medium) } void -priv_script_init(char *reason, char *medium) +priv_script_init(const char *reason, char *medium) { struct interface_info *ip = ifi; @@ -2056,7 +2055,7 @@ priv_script_init(char *reason, char *medium) } void -priv_script_write_params(char *prefix, struct client_lease *lease) +priv_script_write_params(const char *prefix, struct client_lease *lease) { struct interface_info *ip = ifi; u_int8_t dbuf[1500], *dp = NULL; @@ -2196,7 +2195,7 @@ supersede: } void -script_write_params(char *prefix, struct client_lease *lease) +script_write_params(const char *prefix, struct client_lease *lease) { size_t fn_len = 0, sn_len = 0, pr_len = 0; struct imsg_hdr hdr; @@ -2460,8 +2459,8 @@ go_daemon(void) int check_option(struct client_lease *l, int option) { - char *opbuf; - char *sbuf; + const char *opbuf; + const char *sbuf; /* we use this, since this is what gets passed to dhclient-script */ @@ -2721,7 +2720,7 @@ check_search(const char *srch) * otherwise, return 0 */ int -ipv4addrs(char * buf) +ipv4addrs(const char * buf) { struct in_addr jnk; int count = 0; @@ -2739,7 +2738,7 @@ ipv4addrs(char * buf) } -char * +const char * option_as_string(unsigned int code, unsigned char *data, int len) { static char optbuf[32768]; /* XXX */ Modified: head/sbin/dhclient/dhcpd.h ============================================================================== --- head/sbin/dhclient/dhcpd.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dhcpd.h Wed Feb 21 21:13:08 2018 (r329754) @@ -235,7 +235,7 @@ struct protocol { struct hash_bucket { struct hash_bucket *next; - unsigned char *name; + const unsigned char *name; int len; unsigned char *value; }; @@ -258,26 +258,27 @@ struct hash_table { /* options.c */ int cons_options(struct packet *, struct dhcp_packet *, int, struct tree_cache **, int, int, int, u_int8_t *, int); -char *pretty_print_option(unsigned int, +const char *pretty_print_option(unsigned int, unsigned char *, int, int, int); void do_packet(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); /* errwarn.c */ extern int warnings_occurred; -void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +void error(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int warning(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int note(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int debug(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int parse_warn(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); /* conflex.c */ extern int lexline, lexchar; -extern char *token_line, *tlname; +extern char *token_line; +extern const char *tlname; extern char comments[4096]; extern int comment_index; extern int eol_token; -void new_parse(char *); +void new_parse(const char *); int next_token(char **, FILE *); int peek_token(char **, FILE *); @@ -321,7 +322,7 @@ void dispatch(void); void got_one(struct protocol *); void add_timeout(time_t, void (*)(void *), void *); void cancel_timeout(void (*)(void *), void *); -void add_protocol(char *, int, void (*)(struct protocol *), void *); +void add_protocol(const char *, int, void (*)(struct protocol *), void *); void remove_protocol(struct protocol *); int interface_link_status(char *); void interface_set_mtu_unpriv(int, u_int16_t); @@ -329,8 +330,8 @@ void interface_set_mtu_priv(char *, u_int16_t); /* hash.c */ struct hash_table *new_hash(void); -void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); -unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); +void add_hash(struct hash_table *, const unsigned char *, int, unsigned char *); +void *hash_lookup(struct hash_table *, unsigned char *, int); /* tables.c */ extern struct option dhcp_options[256]; @@ -358,7 +359,7 @@ char *piaddr(struct iaddr); /* dhclient.c */ extern cap_channel_t *capsyslog; -extern char *path_dhclient_conf; +extern const char *path_dhclient_conf; extern char *path_dhclient_db; extern time_t cur_time; extern int log_priority; @@ -393,12 +394,12 @@ void free_client_lease(struct client_lease *); void rewrite_client_leases(void); void write_client_lease(struct interface_info *, struct client_lease *, int); -void priv_script_init(char *, char *); -void priv_script_write_params(char *, struct client_lease *); +void priv_script_init(const char *, char *); +void priv_script_write_params(const char *, struct client_lease *); int priv_script_go(void); -void script_init(char *, struct string_list *); -void script_write_params(char *, struct client_lease *); +void script_init(const char *, struct string_list *); +void script_write_params(const char *, struct client_lease *); int script_go(void); void client_envadd(struct client_state *, const char *, const char *, const char *, ...); @@ -442,7 +443,7 @@ void parse_reject_statement(FILE *, struct client_conf /* privsep.c */ struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); +int buf_add(struct buf *, const void *, size_t); int buf_close(int, struct buf *); ssize_t buf_read(int, void *, size_t); void dispatch_imsg(struct interface_info *, int); Modified: head/sbin/dhclient/dispatch.c ============================================================================== --- head/sbin/dhclient/dispatch.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dispatch.c Wed Feb 21 21:13:08 2018 (r329754) @@ -49,10 +49,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include +/* Assert that pointer p is aligned to at least align bytes */ +#define assert_aligned(p, align) assert((((uintptr_t)p) & ((align) - 1)) == 0) + struct protocol *protocols; struct timeout *timeouts; static struct timeout *free_timeouts; @@ -73,7 +77,6 @@ void discover_interfaces(struct interface_info *iface) { struct ifaddrs *ifap, *ifa; - struct sockaddr_in foo; struct ifreq *tif; if (getifaddrs(&ifap) != 0) @@ -93,15 +96,30 @@ discover_interfaces(struct interface_info *iface) * and record it in a linked list. */ if (ifa->ifa_addr->sa_family == AF_LINK) { - struct sockaddr_dl *foo = - (struct sockaddr_dl *)ifa->ifa_addr; + struct sockaddr_dl *foo; + /* + * The implementation of getifaddrs should guarantee + * this alignment + */ + assert_aligned(ifa->ifa_addr, + _Alignof(struct sockaddr_dl)); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-align" +#endif + foo = (struct sockaddr_dl *)ifa->ifa_addr; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + iface->index = foo->sdl_index; iface->hw_address.hlen = foo->sdl_alen; iface->hw_address.htype = HTYPE_ETHER; /* XXX */ memcpy(iface->hw_address.haddr, LLADDR(foo), foo->sdl_alen); } else if (ifa->ifa_addr->sa_family == AF_INET) { + struct sockaddr_in foo; struct iaddr addr; memcpy(&foo, ifa->ifa_addr, sizeof(foo)); @@ -437,7 +455,7 @@ cancel_timeout(void (*where)(void *), void *what) /* Add a protocol to the list of protocols... */ void -add_protocol(char *name, int fd, void (*handler)(struct protocol *), +add_protocol(const char *name, int fd, void (*handler)(struct protocol *), void *local) { struct protocol *p; Modified: head/sbin/dhclient/errwarn.c ============================================================================== --- head/sbin/dhclient/errwarn.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/errwarn.c Wed Feb 21 21:13:08 2018 (r329754) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" -static void do_percentm(char *obuf, size_t size, char *ibuf); +static void do_percentm(char *obuf, size_t size, const char *ibuf); static char mbuf[1024]; static char fbuf[1024]; @@ -60,7 +60,7 @@ int warnings_occurred; * Log an error message, then exit. */ void -error(char *fmt, ...) +error(const char *fmt, ...) { va_list list; @@ -94,7 +94,7 @@ error(char *fmt, ...) * Log a warning message... */ int -warning(char *fmt, ...) +warning(const char *fmt, ...) { va_list list; @@ -120,7 +120,7 @@ warning(char *fmt, ...) * Log a note... */ int -note(char *fmt, ...) +note(const char *fmt, ...) { va_list list; @@ -146,7 +146,7 @@ note(char *fmt, ...) * Log a debug message... */ int -debug(char *fmt, ...) +debug(const char *fmt, ...) { va_list list; @@ -172,10 +172,10 @@ debug(char *fmt, ...) * Find %m in the input string and substitute an error message string. */ static void -do_percentm(char *obuf, size_t size, char *ibuf) +do_percentm(char *obuf, size_t size, const char *ibuf) { char ch; - char *s = ibuf; + const char *s = ibuf; char *t = obuf; size_t prlen; size_t fmt_left; @@ -205,7 +205,7 @@ do_percentm(char *obuf, size_t size, char *ibuf) } int -parse_warn(char *fmt, ...) +parse_warn(const char *fmt, ...) { va_list list; static char spaces[] = Modified: head/sbin/dhclient/hash.c ============================================================================== --- head/sbin/dhclient/hash.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/hash.c Wed Feb 21 21:13:08 2018 (r329754) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" -static int do_hash(unsigned char *, int, int); +static int do_hash(const unsigned char *, int, int); struct hash_table * new_hash(void) @@ -62,9 +62,9 @@ new_hash(void) } static int -do_hash(unsigned char *name, int len, int size) +do_hash(const unsigned char *name, int len, int size) { - unsigned char *s = name; + const unsigned char *s = name; int accum = 0, i = len; while (i--) { @@ -77,7 +77,7 @@ do_hash(unsigned char *name, int len, int size) return (accum % size); } -void add_hash(struct hash_table *table, unsigned char *name, int len, +void add_hash(struct hash_table *table, const unsigned char *name, int len, unsigned char *pointer) { struct hash_bucket *bp; @@ -86,7 +86,7 @@ void add_hash(struct hash_table *table, unsigned char if (!table) return; if (!len) - len = strlen((char *)name); + len = strlen((const char *)name); hashno = do_hash(name, len, table->hash_count); bp = new_hash_bucket(); @@ -102,7 +102,7 @@ void add_hash(struct hash_table *table, unsigned char table->buckets[hashno] = bp; } -unsigned char * +void * hash_lookup(struct hash_table *table, unsigned char *name, int len) { struct hash_bucket *bp; Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/options.c Wed Feb 21 21:13:08 2018 (r329754) @@ -628,7 +628,7 @@ store_options(unsigned char *buffer, int buflen, struc /* * Format the specified option so that a human can easily read it. */ -char * +const char * pretty_print_option(unsigned int code, unsigned char *data, int len, int emit_commas, int emit_quotes) { Modified: head/sbin/dhclient/privsep.c ============================================================================== --- head/sbin/dhclient/privsep.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/privsep.c Wed Feb 21 21:13:08 2018 (r329754) @@ -39,7 +39,7 @@ buf_open(size_t len) } int -buf_add(struct buf *buf, void *data, size_t len) +buf_add(struct buf *buf, const void *data, size_t len) { if (buf->wpos + len > buf->size) return (-1); Modified: head/sbin/dhclient/privsep.h ============================================================================== --- head/sbin/dhclient/privsep.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/privsep.h Wed Feb 21 21:13:08 2018 (r329754) @@ -46,6 +46,6 @@ struct imsg_hdr { }; struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); +int buf_add(struct buf *, const void *, size_t); int buf_close(int, struct buf *); ssize_t buf_read(int sock, void *, size_t); Modified: head/sbin/dhclient/tables.c ============================================================================== --- head/sbin/dhclient/tables.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tables.c Wed Feb 21 21:13:08 2018 (r329754) @@ -440,11 +440,11 @@ initialize_universes(void) for (i = 0; i < 256; i++) { dhcp_universe.options[i] = &dhcp_options[i]; add_hash(dhcp_universe.hash, - (unsigned char *)dhcp_options[i].name, 0, + (const unsigned char *)dhcp_options[i].name, 0, (unsigned char *)&dhcp_options[i]); } universe_hash.hash_count = DEFAULT_HASH_SIZE; add_hash(&universe_hash, - (unsigned char *)dhcp_universe.name, 0, + (const unsigned char *)dhcp_universe.name, 0, (unsigned char *)&dhcp_universe); } Modified: head/sbin/dhclient/tests/fake.c ============================================================================== --- head/sbin/dhclient/tests/fake.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tests/fake.c Wed Feb 21 21:13:08 2018 (r329754) @@ -9,7 +9,7 @@ extern jmp_buf env; void -error(char *fmt, ...) +error(const char *fmt, ...) { va_list ap; @@ -22,7 +22,7 @@ error(char *fmt, ...) } int -warning(char *fmt, ...) +warning(const char *fmt, ...) { va_list ap; @@ -39,7 +39,7 @@ warning(char *fmt, ...) } int -note(char *fmt, ...) +note(const char *fmt, ...) { int ret; va_list ap; Modified: head/sbin/dhclient/tree.h ============================================================================== --- head/sbin/dhclient/tree.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tree.h Wed Feb 21 21:13:08 2018 (r329754) @@ -57,14 +57,14 @@ struct tree_cache { }; struct universe { - char *name; + const char *name; struct hash_table *hash; struct option *options[256]; }; struct option { - char *name; - char *format; + const char *name; + const char *format; struct universe *universe; unsigned char code; }; From owner-svn-src-all@freebsd.org Wed Feb 21 21:18:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70BE2F010F4; Wed, 21 Feb 2018 21:18:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2573173AF3; Wed, 21 Feb 2018 21:18:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 205631DD7E; Wed, 21 Feb 2018 21:18:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LLI5AS011637; Wed, 21 Feb 2018 21:18:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LLI4wY011630; Wed, 21 Feb 2018 21:18:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212118.w1LLI4wY011630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 21:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329755 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys sys/fm X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys sys/fm X-SVN-Commit-Revision: 329755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:18:05 -0000 Author: mav Date: Wed Feb 21 21:18:04 2018 New Revision: 329755 URL: https://svnweb.freebsd.org/changeset/base/329755 Log: MFV r329753: 8809 libzpool should leverage work done in libfakekernel illumos/illumos-gate@f06dce2c1f0f3af78581e7574f65bfba843ddb6e Reviewed by: Sebastien Roy Reviewed by: Prakash Surya Reviewed by: Gordon Ross Approved by: Richard Lowe Author: Andrew Stormont Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Wed Feb 21 21:18:04 2018 (r329755) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ #include @@ -66,7 +67,9 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RW &zfs_default_ibs, 0, "Default dnode indirect block shift"); #ifdef illumos +#ifdef _KERNEL static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); +#endif /* _KERNEL */ #endif static int @@ -222,7 +225,9 @@ dnode_init(void) dnode_cache = kmem_cache_create("dnode_t", sizeof (dnode_t), 0, dnode_cons, dnode_dest, NULL, NULL, NULL, 0); +#ifdef _KERNEL kmem_cache_set_move(dnode_cache, dnode_move); +#endif /* _KERNEL */ } void @@ -414,7 +419,9 @@ dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_ dnode_t *dn; dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); +#ifdef _KERNEL ASSERT(!POINTER_IS_VALID(dn->dn_objset)); +#endif /* _KERNEL */ dn->dn_moved = 0; /* @@ -706,6 +713,7 @@ static struct { } dnode_move_stats; #endif /* DNODE_STATS */ +#ifdef _KERNEL static void dnode_move_impl(dnode_t *odn, dnode_t *ndn) { @@ -843,7 +851,6 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) } #ifdef illumos -#ifdef _KERNEL /*ARGSUSED*/ static kmem_cbrc_t dnode_move(void *buf, void *newbuf, size_t size, void *arg) @@ -984,8 +991,8 @@ dnode_move(void *buf, void *newbuf, size_t size, void return (KMEM_CBRC_YES); } -#endif /* _KERNEL */ #endif /* illumos */ +#endif /* _KERNEL */ void dnode_special_close(dnode_handle_t *dnh) Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Wed Feb 21 21:18:04 2018 (r329755) @@ -23,6 +23,7 @@ * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_ACL_H @@ -130,7 +131,7 @@ typedef struct acl_info acl_t; #define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED| \ ACL_DEFAULTED) -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) /* * These are only applicable in a CIFS context. Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h Wed Feb 21 21:18:04 2018 (r329755) @@ -26,6 +26,7 @@ /* * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright 2017 RackTop Systems. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -134,7 +135,7 @@ extern "C" { #define BIT_ONLYONESET(u) \ ((((u) == 0) ? 0 : ((u) & ((u) - 1)) == 0)) -#if defined(_KERNEL) && !defined(_ASM) +#if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && !defined(_ASM) #include /* @@ -188,7 +189,7 @@ extern int odd_parity(ulong_t); */ #define BITX(u, h, l) (((u) >> (l)) & ((1LU << ((h) - (l) + 1LU)) - 1LU)) -#endif /* _KERNEL && !_ASM */ +#endif /* (_KERNEL || _FAKE_KERNEL) && !_ASM */ #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h Wed Feb 21 21:18:04 2018 (r329755) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_CPUPART_H @@ -40,7 +41,7 @@ extern "C" { #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) typedef int cpupartid_t; @@ -148,7 +149,7 @@ extern uint_t cpupart_list(psetid_t *, uint_t, int); extern int cpupart_setattr(psetid_t, uint_t); extern int cpupart_getattr(psetid_t, uint_t *); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h Wed Feb 21 21:18:04 2018 (r329755) @@ -22,6 +22,7 @@ /* * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2014 Igor Kozhukhov . + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_CPUVAR_H @@ -31,6 +32,7 @@ #include /* has cpu_stat_t definition */ #include #include +#include /* has kcpc_ctx_t definition */ #include #if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP) @@ -610,9 +612,9 @@ extern struct cpu *curcpup(void); #endif /* _KERNEL || _KMEMUSER */ /* - * CPU support routines. + * CPU support routines (not for genassym.c) */ -#if defined(_KERNEL) && defined(__STDC__) /* not for genassym.c */ +#if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && defined(__STDC__) struct zone; @@ -819,7 +821,7 @@ extern void populate_idstr(struct cpu *); extern void cpu_vm_data_init(struct cpu *); extern void cpu_vm_data_destroy(struct cpu *); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h Wed Feb 21 21:18:04 2018 (r329755) @@ -21,6 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 RackTop Systems. */ #ifndef _SYS_FM_UTIL_H @@ -70,7 +71,7 @@ typedef struct erpt_dump { } ed_tod_base; } erpt_dump_t; -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_FAKE_KERNEL) #include #define FM_STK_DEPTH 20 /* maximum stack depth */ @@ -92,7 +93,7 @@ extern void fm_ereport_dump(void); extern void fm_ereport_post(nvlist_t *, int); extern int is_fm_panic(); -#endif /* _KERNEL */ +#endif /* _KERNEL || _FAKE_KERNEL */ #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Wed Feb 21 21:13:08 2018 (r329754) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Wed Feb 21 21:18:04 2018 (r329755) @@ -21,6 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 RackTop Systems. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ From owner-svn-src-all@freebsd.org Wed Feb 21 21:39:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C681F02B87; Wed, 21 Feb 2018 21:39:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC84A748E0; Wed, 21 Feb 2018 21:39:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A73CC1E0C3; Wed, 21 Feb 2018 21:39:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LLdldk021933; Wed, 21 Feb 2018 21:39:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LLdlLF021931; Wed, 21 Feb 2018 21:39:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802212139.w1LLdlLF021931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Feb 2018 21:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329756 - in head/stand: liblua lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: liblua lua X-SVN-Commit-Revision: 329756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:39:48 -0000 Author: kevans Date: Wed Feb 21 21:39:47 2018 New Revision: 329756 URL: https://svnweb.freebsd.org/changeset/base/329756 Log: lualoader: Remove nasty hack for not printing out ".0" luaconf.h has a LUA_COMPAT_FLOATSTRING option that may be defined to do this instead of needing intstring. Reported by: Dan Nelson Modified: head/stand/liblua/luaconf.h head/stand/lua/screen.lua Modified: head/stand/liblua/luaconf.h ============================================================================== --- head/stand/liblua/luaconf.h Wed Feb 21 21:18:04 2018 (r329755) +++ head/stand/liblua/luaconf.h Wed Feb 21 21:39:47 2018 (r329756) @@ -405,6 +405,7 @@ ** because this is not really an incompatibility. */ /* #define LUA_COMPAT_FLOATSTRING */ +#define LUA_COMPAT_FLOATSTRING /* }================================================================== */ Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Wed Feb 21 21:18:04 2018 (r329755) +++ head/stand/lua/screen.lua Wed Feb 21 21:39:47 2018 (r329756) @@ -31,17 +31,6 @@ local core = require("core") local screen = {} --- XXX TODO: This should be fixed in the interpreter to not print decimals -local intstring = function(num) - local str = tostring(num) - local decimal = str:find("%.") - - if decimal then - return str:sub(1, decimal - 1) - end - return str -end - -- Module exports function screen.clear() if core.isSerialBoot() then @@ -55,7 +44,7 @@ function screen.setcursor(x, y) return end - loader.printc("\027[" .. intstring(y) .. ";" .. intstring(x) .. "H") + loader.printc("\027[" .. y .. ";" .. x .. "H") end function screen.setforeground(c) From owner-svn-src-all@freebsd.org Wed Feb 21 22:14:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95878F0599F; Wed, 21 Feb 2018 22:14:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44C9E76201; Wed, 21 Feb 2018 22:14:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B9901E72E; Wed, 21 Feb 2018 22:14:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LMEKRf041702; Wed, 21 Feb 2018 22:14:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LMEK5u041701; Wed, 21 Feb 2018 22:14:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212214.w1LMEK5u041701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 22:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329757 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 22:14:20 -0000 Author: mav Date: Wed Feb 21 22:14:19 2018 New Revision: 329757 URL: https://svnweb.freebsd.org/changeset/base/329757 Log: 9018 Replace kmem_cache_reap_now() with kmem_cache_reap_soon() illumos/illumos-gate@36a64e62848b51ac5a9a5216e894ec723cfef14e To prevent kmem_cache reaping from blocking other system resources, turn kmem_cache_reap_now() (which blocks) into kmem_cache_reap_soon(). Callers to kmem_cache_reap_soon() should use kmem_cache_reap_active(), which exploits #9017's new taskq_empty(). Reviewed by: Bryan Cantrill Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed by: Yuri Pankov Author: Tim Kordas Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Feb 21 21:39:47 2018 (r329756) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Feb 21 22:14:19 2018 (r329757) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. All rights reserved. @@ -301,6 +301,9 @@ int zfs_arc_evict_batch_limit = 10; /* number of seconds before growing cache again */ static int arc_grow_retry = 60; +/* number of milliseconds before attempting a kmem-cache-reap */ +static int arc_kmem_cache_reap_retry_ms = 1000; + /* shift of arc_c for calculating overflow limit in arc_get_data_impl */ int zfs_arc_overflow_shift = 8; @@ -4047,21 +4050,31 @@ arc_kmem_reap_now(void) #endif #endif + /* + * If a kmem reap is already active, don't schedule more. We must + * check for this because kmem_cache_reap_soon() won't actually + * block on the cache being reaped (this is to prevent callers from + * becoming implicitly blocked by a system-wide kmem reap -- which, + * on a system with many, many full magazines, can take minutes). + */ + if (kmem_cache_reap_active()) + return; + for (i = 0; i < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; i++) { if (zio_buf_cache[i] != prev_cache) { prev_cache = zio_buf_cache[i]; - kmem_cache_reap_now(zio_buf_cache[i]); + kmem_cache_reap_soon(zio_buf_cache[i]); } if (zio_data_buf_cache[i] != prev_data_cache) { prev_data_cache = zio_data_buf_cache[i]; - kmem_cache_reap_now(zio_data_buf_cache[i]); + kmem_cache_reap_soon(zio_data_buf_cache[i]); } } - kmem_cache_reap_now(abd_chunk_cache); - kmem_cache_reap_now(buf_cache); - kmem_cache_reap_now(hdr_full_cache); - kmem_cache_reap_now(hdr_l2only_cache); - kmem_cache_reap_now(range_seg_cache); + kmem_cache_reap_soon(abd_chunk_cache); + kmem_cache_reap_soon(buf_cache); + kmem_cache_reap_soon(hdr_full_cache); + kmem_cache_reap_soon(hdr_l2only_cache); + kmem_cache_reap_soon(range_seg_cache); if (zio_arena != NULL) { /* @@ -4093,6 +4106,7 @@ static void arc_reclaim_thread(void *unused) { hrtime_t growtime = 0; + hrtime_t kmem_reap_time = 0; callb_cpr_t cpr; CALLB_CPR_INIT(&cpr, &arc_reclaim_lock, callb_generic_cpr, FTAG); @@ -4126,7 +4140,7 @@ arc_reclaim_thread(void *unused) int64_t free_memory = arc_available_memory(); if (free_memory < 0) { - + hrtime_t curtime = gethrtime(); arc_no_grow = B_TRUE; arc_warm = B_TRUE; @@ -4134,9 +4148,20 @@ arc_reclaim_thread(void *unused) * Wait at least zfs_grow_retry (default 60) seconds * before considering growing. */ - growtime = gethrtime() + SEC2NSEC(arc_grow_retry); + growtime = curtime + SEC2NSEC(arc_grow_retry); - arc_kmem_reap_now(); + /* + * Wait at least arc_kmem_cache_reap_retry_ms + * between arc_kmem_reap_now() calls. Without + * this check it is possible to end up in a + * situation where we spend lots of time + * reaping caches, while we're near arc_c_min. + */ + if (curtime >= kmem_reap_time) { + arc_kmem_reap_now(); + kmem_reap_time = gethrtime() + + MSEC2NSEC(arc_kmem_cache_reap_retry_ms); + } /* * If we are still low on memory, shrink the ARC From owner-svn-src-all@freebsd.org Wed Feb 21 22:24:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B96F06683; Wed, 21 Feb 2018 22:24:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B33DF768A5; Wed, 21 Feb 2018 22:24:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA0001E8BD; Wed, 21 Feb 2018 22:24:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LMOnqp046693; Wed, 21 Feb 2018 22:24:49 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LMOnSU046692; Wed, 21 Feb 2018 22:24:49 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201802212224.w1LMOnSU046692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 21 Feb 2018 22:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329758 - head/stand/sparc64/loader X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/stand/sparc64/loader X-SVN-Commit-Revision: 329758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 22:24:50 -0000 Author: marius Date: Wed Feb 21 22:24:49 2018 New Revision: 329758 URL: https://svnweb.freebsd.org/changeset/base/329758 Log: Fix compilation with LOADER_DEBUG defined after r329725. Modified: head/stand/sparc64/loader/main.c Modified: head/stand/sparc64/loader/main.c ============================================================================== --- head/stand/sparc64/loader/main.c Wed Feb 21 22:14:19 2018 (r329757) +++ head/stand/sparc64/loader/main.c Wed Feb 21 22:24:49 2018 (r329758) @@ -938,7 +938,7 @@ static const char *const page_sizes[] = { static void pmap_print_tte_sun4u(tte_t tag, tte_t tte) - +{ printf("%s %s ", page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], From owner-svn-src-all@freebsd.org Wed Feb 21 22:33:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 872CCF06FD3 for ; Wed, 21 Feb 2018 22:33:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C9DD76E28 for ; Wed, 21 Feb 2018 22:33:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id n7so3891645iob.0 for ; Wed, 21 Feb 2018 14:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6SpMTogt2hCTMNNYNQB4d73IzcEv6MeTA2RDzk7oI4c=; b=FvjBU1cpGLDk990F0s/PPxx7KHbOqn9N51rMJ5XfE9fjaHxEEOrAuuB6LbXxF07roQ y44pvDc9VKAM24yG3tFAwbKmsdCt+lMgxlPIctc03xESbGARQCQJJ+AcVx/EB7Y8eJay ChSTWIfmZuf7srQSqsvXavfrxAlOUlZ+1KpaTgi1Qx9cYxv0FzdbmLtGCZOQiT3c3YCc uaXNnX66iqm1tY0+xzLrNijMAYp5XD6FWC5cFpRcXh4Z/VQ4oUz0a0H+do7f+KxHmAh3 ohEaMYHL3kNka4K1t2NulYvvQK/J/dKfDdnhLX1fKERnBg7Wv0AsEai69wlyF5Ytrm1w nUwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6SpMTogt2hCTMNNYNQB4d73IzcEv6MeTA2RDzk7oI4c=; b=N3b2j9Y2ZKBCB/07Wyuf4UMj2hFWqfp3J6oTNVGRZlHx9QgZoUa8Hs61SNAS5M3n0z aMRzLX14jdzmaibgK7WgsUETO0dWWLiuFE+HLpC5MFPjrJchVRo2+ifea7uHwU+2YlCg R5fr6Gyp2dZMcKX79BH4I2BSwpnTWTOi3Jdq4Ke3peJvj+fmOlLY66Q67Qhl5Wqfc3l+ Zt5FOhV0QpYnk/T/Nv9l9Zw/c+ziZJWaELj1bsB3B8ngP05mSphPOXOXZUZ2xPMjJ/9Z LP6E0Dcl1ctf7ldc3HxuYt5NPmYu+zwZ6kSp91e1XgcoE2V5pRBsyJIs7rk/NRq9UDks FpOg== X-Gm-Message-State: APf1xPCRXIS+Gpip+TBCBk7fCRZx1wHyrApy4BQOC5iX9W3R8W/gMvaN qsDduec1Pv8JmdfiLNfxeVO8pQMwGoj8cqovToAlvw== X-Google-Smtp-Source: AG47ELsu6yXMJr+RsoD6kpyB2zpvey/5oDGie5/FHio4nON8hbyukjEmb7KiQOM1bfFEnKLLF0fhlyBJLD2kR+6M1X0= X-Received: by 10.107.175.77 with SMTP id y74mr6308030ioe.37.1519252431395; Wed, 21 Feb 2018 14:33:51 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Wed, 21 Feb 2018 14:33:50 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:b10f:802c:cf9a:71e3] Received: by 10.79.201.67 with HTTP; Wed, 21 Feb 2018 14:33:50 -0800 (PST) In-Reply-To: <201802212224.w1LMOnSU046692@repo.freebsd.org> References: <201802212224.w1LMOnSU046692@repo.freebsd.org> From: Warner Losh Date: Wed, 21 Feb 2018 15:33:50 -0700 X-Google-Sender-Auth: wnc_2wfeupIRt65bJMfC8BOjiD4 Message-ID: Subject: Re: svn commit: r329758 - head/stand/sparc64/loader To: Marius Strobl Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 22:33:52 -0000 On Feb 21, 2018 3:25 PM, "Marius Strobl" wrote: Author: marius Date: Wed Feb 21 22:24:49 2018 New Revision: 329758 URL: https://svnweb.freebsd.org/changeset/base/329758 Log: Fix compilation with LOADER_DEBUG defined after r329725. Ill add tbat to my regression suit. Sorry for the breakage. Warner Modified: head/stand/sparc64/loader/main.c Modified: head/stand/sparc64/loader/main.c ============================================================ ================== --- head/stand/sparc64/loader/main.c Wed Feb 21 22:14:19 2018 (r329757) +++ head/stand/sparc64/loader/main.c Wed Feb 21 22:24:49 2018 (r329758) @@ -938,7 +938,7 @@ static const char *const page_sizes[] = { static void pmap_print_tte_sun4u(tte_t tag, tte_t tte) - +{ printf("%s %s ", page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], From owner-svn-src-all@freebsd.org Wed Feb 21 23:15:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA675F09DDE; Wed, 21 Feb 2018 23:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59B8B783CE; Wed, 21 Feb 2018 23:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E8FE1F0B5; Wed, 21 Feb 2018 23:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNF78R071175; Wed, 21 Feb 2018 23:15:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNF6xx071171; Wed, 21 Feb 2018 23:15:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212315.w1LNF6xx071171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 23:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329759 - in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:15:08 -0000 Author: mav Date: Wed Feb 21 23:15:06 2018 New Revision: 329759 URL: https://svnweb.freebsd.org/changeset/base/329759 Log: 9018 Replace kmem_cache_reap_now() with kmem_cache_reap_soon() illumos/illumos-gate@36a64e62848b51ac5a9a5216e894ec723cfef14e To prevent kmem_cache reaping from blocking other system resources, turn kmem_cache_reap_now() (which blocks) into kmem_cache_reap_soon(). Callers to kmem_cache_reap_soon() should use kmem_cache_reap_active(), which exploits #9017's new taskq_empty(). Reviewed by: Bryan Cantrill Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed by: Yuri Pankov Author: Tim Kordas FreeBSD does not use taskqueue for kmem caches reaping, so this change is less dramatic then it is on Illumos, just limiting reaping to 1 time per second. It may possibly be improved later, if needed. Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/sys/kmem.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Feb 21 22:24:49 2018 (r329758) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Feb 21 23:15:06 2018 (r329759) @@ -364,7 +364,8 @@ extern void cv_broadcast(kcondvar_t *cv); #define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f) #define kmem_cache_free(_c, _b) umem_cache_free(_c, _b) #define kmem_debugging() 0 -#define kmem_cache_reap_now(_c) /* nothing */ +#define kmem_cache_reap_active() (B_FALSE) +#define kmem_cache_reap_soon(_c) /* nothing */ #define kmem_cache_set_move(_c, _cb) /* nothing */ #define POINTER_INVALIDATE(_pp) /* nothing */ #define POINTER_IS_VALID(_p) 0 Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Feb 21 22:24:49 2018 (r329758) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Wed Feb 21 23:15:06 2018 (r329759) @@ -212,9 +212,30 @@ kmem_cache_free(kmem_cache_t *cache, void *buf) #endif } +/* + * Allow our caller to determine if there are running reaps. + * + * This call is very conservative and may return B_TRUE even when + * reaping activity isn't active. If it returns B_FALSE, then reaping + * activity is definitely inactive. + */ +boolean_t +kmem_cache_reap_active(void) +{ + + return (B_FALSE); +} + +/* + * Reap (almost) everything soon. + * + * Note: this does not wait for the reap-tasks to complete. Caller + * should use kmem_cache_reap_active() (above) and/or moderation to + * avoid scheduling too many reap-tasks. + */ #ifdef _KERNEL void -kmem_cache_reap_now(kmem_cache_t *cache) +kmem_cache_reap_soon(kmem_cache_t *cache) { #ifndef KMEM_DEBUG zone_drain(cache->kc_zone); @@ -228,7 +249,7 @@ kmem_reap(void) } #else void -kmem_cache_reap_now(kmem_cache_t *cache __unused) +kmem_cache_reap_soon(kmem_cache_t *cache __unused) { } Modified: head/sys/cddl/compat/opensolaris/sys/kmem.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/kmem.h Wed Feb 21 22:24:49 2018 (r329758) +++ head/sys/cddl/compat/opensolaris/sys/kmem.h Wed Feb 21 23:15:06 2018 (r329759) @@ -73,7 +73,8 @@ kmem_cache_t *kmem_cache_create(char *name, size_t buf void kmem_cache_destroy(kmem_cache_t *cache); void *kmem_cache_alloc(kmem_cache_t *cache, int flags); void kmem_cache_free(kmem_cache_t *cache, void *buf); -void kmem_cache_reap_now(kmem_cache_t *cache); +boolean_t kmem_cache_reap_active(void); +void kmem_cache_reap_soon(kmem_cache_t *); void kmem_reap(void); int kmem_debugging(void); void *calloc(size_t n, size_t s); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Feb 21 22:24:49 2018 (r329758) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Feb 21 23:15:06 2018 (r329759) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. All rights reserved. @@ -309,6 +309,9 @@ int zfs_arc_evict_batch_limit = 10; /* number of seconds before growing cache again */ static int arc_grow_retry = 60; +/* number of milliseconds before attempting a kmem-cache-reap */ +static int arc_kmem_cache_reap_retry_ms = 1000; + /* shift of arc_c for calculating overflow limit in arc_get_data_impl */ int zfs_arc_overflow_shift = 8; @@ -4395,21 +4398,31 @@ arc_kmem_reap_now(void) #endif #endif + /* + * If a kmem reap is already active, don't schedule more. We must + * check for this because kmem_cache_reap_soon() won't actually + * block on the cache being reaped (this is to prevent callers from + * becoming implicitly blocked by a system-wide kmem reap -- which, + * on a system with many, many full magazines, can take minutes). + */ + if (kmem_cache_reap_active()) + return; + for (i = 0; i < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; i++) { if (zio_buf_cache[i] != prev_cache) { prev_cache = zio_buf_cache[i]; - kmem_cache_reap_now(zio_buf_cache[i]); + kmem_cache_reap_soon(zio_buf_cache[i]); } if (zio_data_buf_cache[i] != prev_data_cache) { prev_data_cache = zio_data_buf_cache[i]; - kmem_cache_reap_now(zio_data_buf_cache[i]); + kmem_cache_reap_soon(zio_data_buf_cache[i]); } } - kmem_cache_reap_now(abd_chunk_cache); - kmem_cache_reap_now(buf_cache); - kmem_cache_reap_now(hdr_full_cache); - kmem_cache_reap_now(hdr_l2only_cache); - kmem_cache_reap_now(range_seg_cache); + kmem_cache_reap_soon(abd_chunk_cache); + kmem_cache_reap_soon(buf_cache); + kmem_cache_reap_soon(hdr_full_cache); + kmem_cache_reap_soon(hdr_l2only_cache); + kmem_cache_reap_soon(range_seg_cache); #ifdef illumos if (zio_arena != NULL) { @@ -4444,6 +4457,7 @@ static void arc_reclaim_thread(void *unused __unused) { hrtime_t growtime = 0; + hrtime_t kmem_reap_time = 0; callb_cpr_t cpr; CALLB_CPR_INIT(&cpr, &arc_reclaim_lock, callb_generic_cpr, FTAG); @@ -4477,7 +4491,7 @@ arc_reclaim_thread(void *unused __unused) int64_t free_memory = arc_available_memory(); if (free_memory < 0) { - + hrtime_t curtime = gethrtime(); arc_no_grow = B_TRUE; arc_warm = B_TRUE; @@ -4485,9 +4499,20 @@ arc_reclaim_thread(void *unused __unused) * Wait at least zfs_grow_retry (default 60) seconds * before considering growing. */ - growtime = gethrtime() + SEC2NSEC(arc_grow_retry); + growtime = curtime + SEC2NSEC(arc_grow_retry); - arc_kmem_reap_now(); + /* + * Wait at least arc_kmem_cache_reap_retry_ms + * between arc_kmem_reap_now() calls. Without + * this check it is possible to end up in a + * situation where we spend lots of time + * reaping caches, while we're near arc_c_min. + */ + if (curtime >= kmem_reap_time) { + arc_kmem_reap_now(); + kmem_reap_time = gethrtime() + + MSEC2NSEC(arc_kmem_cache_reap_retry_ms); + } /* * If we are still low on memory, shrink the ARC From owner-svn-src-all@freebsd.org Wed Feb 21 23:25:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94978F0A9FE; Wed, 21 Feb 2018 23:25:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4764D78B28; Wed, 21 Feb 2018 23:25:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E1E71F26F; Wed, 21 Feb 2018 23:25:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNPCNs076083; Wed, 21 Feb 2018 23:25:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNPC8f076082; Wed, 21 Feb 2018 23:25:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212325.w1LNPC8f076082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 23:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329760 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:25:12 -0000 Author: mav Date: Wed Feb 21 23:25:11 2018 New Revision: 329760 URL: https://svnweb.freebsd.org/changeset/base/329760 Log: 7638 Refactor spa_load_impl into several functions illumos/illumos-gate@1fd3785ff6601d3e391378c2dcbf4c5f27e1fe32 spa_load_impl has grown out of proportions. It is currently over 700 lines long and makes it very hard to follow or debug the import process even for experienced ZFS developers. The objective is to split it up in a series of well commented functions. Reviewed by: Paul Dagnelie Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 23:15:06 2018 (r329759) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 23:25:11 2018 (r329760) @@ -2144,7 +2144,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config) static int spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type, - boolean_t mosconfig) + boolean_t trust_config) { nvlist_t *config = spa->spa_config; char *ereport = FM_EREPORT_ZFS_POOL; @@ -2188,7 +2188,7 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_impor gethrestime(&spa->spa_loaded_ts); error = spa_load_impl(spa, pool_guid, config, state, type, - mosconfig, &ereport); + trust_config, &ereport); } /* @@ -2240,38 +2240,20 @@ vdev_count_verify_zaps(vdev_t *vd) return (total); } -/* - * Load an existing storage pool, using the pool's builtin spa_config as a - * source of configuration information. - */ static int -spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, - char **ereport) +spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, + spa_load_state_t state, spa_import_type_t type) { int error = 0; - nvlist_t *nvroot = NULL; - nvlist_t *label; - vdev_t *rvd; - uberblock_t *ub = &spa->spa_uberblock; - uint64_t children, config_cache_txg = spa->spa_config_txg; - int orig_mode = spa->spa_mode; + nvlist_t *nvtree = NULL; int parse; - uint64_t obj; - boolean_t missing_feat_write = B_FALSE; + vdev_t *rvd; - /* - * If this is an untrusted config, access the pool in read-only mode. - * This prevents things like resilvering recently removed devices. - */ - if (!trust_config) - spa->spa_mode = FREAD; - ASSERT(MUTEX_HELD(&spa_namespace_lock)); spa->spa_load_state = state; - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot)) + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) return (SET_ERROR(EINVAL)); parse = (type == SPA_IMPORT_EXISTING ? @@ -2294,7 +2276,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * configuration requires knowing the version number. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = spa_config_parse(spa, &rvd, nvroot, NULL, 0, parse); + error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); if (error != 0) @@ -2308,22 +2290,35 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t ASSERT(spa_guid(spa) == pool_guid); } - /* - * Try to open all vdevs, loading each label in the process. - */ + return (0); +} + +static int +spa_ld_open_vdevs(spa_t *spa) +{ + int error = 0; + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = vdev_open(rvd); + error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) - return (error); + return (error); +} + +static int +spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type, + boolean_t trust_config) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * We need to validate the vdev labels against the configuration that - * we have in hand, which is dependent on the setting of mosconfig. If - * mosconfig is true then we're validating the vdev labels based on - * that config. Otherwise, we're validating against the cached config - * (zpool.cache) that was read when we loaded the zfs module, and then - * later we will recursively call spa_load() and validate against + * we have in hand, which is dependent on the setting of trust_config. + * If trust_config is true then we're validating the vdev labels based + * on that config. Otherwise, we're validating against the cached + * config (zpool.cache) that was read when we loaded the zfs module, and + * then later we will recursively call spa_load() and validate against * the vdev config. * * If we're assembling a new pool that's been split off from an @@ -2342,6 +2337,18 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (SET_ERROR(ENXIO)); } + return (0); +} + +static int +spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, spa_import_type_t type, + boolean_t trust_config) +{ + vdev_t *rvd = spa->spa_root_vdev; + nvlist_t *label; + uberblock_t *ub = &spa->spa_uberblock; + uint64_t children; + /* * Find the best uberblock. */ @@ -2450,18 +2457,28 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa->spa_claim_max_txg = spa->spa_first_txg; spa->spa_prev_software_version = ub->ub_software_version; - /* - * Everything that we read before we do spa_remove_init() must - * have been rewritten after the last device removal was initiated. - * Otherwise we could be reading from indirect vdevs before - * we have loaded their mappings. - */ + return (0); +} +static int +spa_ld_open_rootbp(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + error = dsl_pool_init(spa, spa->spa_first_txg, &spa->spa_dsl_pool); if (error) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset; + return (0); +} + +static int +spa_ld_validate_config(spa_t *spa, spa_import_type_t type) +{ + vdev_t *rvd = spa->spa_root_vdev; + if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2493,6 +2510,15 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (SET_ERROR(ENXIO)); } + return (0); +} + +static int +spa_ld_open_indirect_vdev_metadata(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * Everything that we read before spa_remove_init() must be stored * on concreted vdevs. Therefore we do this as early as possible. @@ -2500,6 +2526,24 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t if (spa_remove_init(spa) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + /* + * Retrieve information needed to condense indirect vdev mappings. + */ + error = spa_condense_init(spa); + if (error != 0) { + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); + } + + return (0); +} + +static int +spa_ld_check_features(spa_t *spa, spa_load_state_t state, + boolean_t *missing_feat_writep) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + if (spa_version(spa) >= SPA_VERSION_FEATURES) { boolean_t missing_feat_read = B_FALSE; nvlist_t *unsup_feat, *enabled_feat; @@ -2529,7 +2573,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { if (!spa_features_check(spa, B_TRUE, unsup_feat, enabled_feat)) { - missing_feat_write = B_TRUE; + *missing_feat_writep = B_TRUE; } } @@ -2568,7 +2612,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * userland in order to know whether to display the * abovementioned note. */ - if (missing_feat_read || (missing_feat_write && + if (missing_feat_read || (*missing_feat_writep && spa_writeable(spa))) { return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); @@ -2601,62 +2645,85 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } + return (0); +} + +static int +spa_ld_load_special_directories(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + spa->spa_is_initializing = B_TRUE; error = dsl_pool_open(spa->spa_dsl_pool); spa->spa_is_initializing = B_FALSE; if (error != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - if (!trust_config) { - uint64_t hostid; - nvlist_t *policy = NULL; - nvlist_t *mos_config; + return (0); +} - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); +static int +spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) +{ + vdev_t *rvd = spa->spa_root_vdev; - if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, - ZPOOL_CONFIG_HOSTID, &hostid) == 0) { - char *hostname; - unsigned long myhostid = 0; + uint64_t hostid; + nvlist_t *policy = NULL; + nvlist_t *mos_config; - VERIFY(nvlist_lookup_string(mos_config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_HOSTID, &hostid) == 0) { + char *hostname; + unsigned long myhostid = 0; + + VERIFY(nvlist_lookup_string(mos_config, + ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); + #ifdef _KERNEL - myhostid = zone_get_hostid(NULL); + myhostid = zone_get_hostid(NULL); #else /* _KERNEL */ - /* - * We're emulating the system's hostid in userland, so - * we can't use zone_get_hostid(). - */ - (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); + /* + * We're emulating the system's hostid in userland, so + * we can't use zone_get_hostid(). + */ + (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); #endif /* _KERNEL */ - if (hostid != 0 && myhostid != 0 && - hostid != myhostid) { - nvlist_free(mos_config); - cmn_err(CE_WARN, "pool '%s' could not be " - "loaded as it was last accessed by " - "another system (host: %s hostid: 0x%lx). " - "See: http://illumos.org/msg/ZFS-8000-EY", - spa_name(spa), hostname, - (unsigned long)hostid); - return (SET_ERROR(EBADF)); - } + if (hostid != 0 && myhostid != 0 && + hostid != myhostid) { + nvlist_free(mos_config); + cmn_err(CE_WARN, "pool '%s' could not be " + "loaded as it was last accessed by " + "another system (host: %s hostid: 0x%lx). " + "See: http://illumos.org/msg/ZFS-8000-EY", + spa_name(spa), hostname, + (unsigned long)hostid); + return (SET_ERROR(EBADF)); } - if (nvlist_lookup_nvlist(spa->spa_config, - ZPOOL_REWIND_POLICY, &policy) == 0) - VERIFY(nvlist_add_nvlist(mos_config, - ZPOOL_REWIND_POLICY, policy) == 0); + } + if (nvlist_lookup_nvlist(spa->spa_config, + ZPOOL_REWIND_POLICY, &policy) == 0) + VERIFY(nvlist_add_nvlist(mos_config, + ZPOOL_REWIND_POLICY, policy) == 0); - spa_config_set(spa, mos_config); - spa_unload(spa); - spa_deactivate(spa); - spa_activate(spa, orig_mode); + spa_config_set(spa, mos_config); + spa_unload(spa); + spa_deactivate(spa); + spa_activate(spa, orig_mode); - return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); - } + return (0); +} +static int +spa_ld_get_props(spa_t *spa) +{ + int error = 0; + uint64_t obj; + vdev_t *rvd = spa->spa_root_vdev; + /* Grab the secret checksum salt from the MOS. */ error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_CHECKSUM_SALT, 1, @@ -2748,6 +2815,35 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } nvlist_free(mos_config); + spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); + + error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); + if (error && error != ENOENT) + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + + if (error == 0) { + uint64_t autoreplace; + + spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs); + spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace); + spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); + spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); + spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, + &spa->spa_dedup_ditto); + + spa->spa_autoreplace = (autoreplace != 0); + } + + return (0); +} + +static int +spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t type) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * If we're assembling the pool from the split-off vdevs of * an existing pool, we don't want to attach the spares & cache @@ -2793,27 +2889,15 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa->spa_l2cache.sav_sync = B_TRUE; } - spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); + return (0); +} - error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); - if (error && error != ENOENT) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); +static int +spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t state) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; - if (error == 0) { - uint64_t autoreplace; - - spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs); - spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace); - spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); - spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); - spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); - spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize); - spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, - &spa->spa_dedup_ditto); - - spa->spa_autoreplace = (autoreplace != 0); - } - /* * If the 'autoreplace' property is set, then post a resource notifying * the ZFS DE that it should not issue any faults for unopenable @@ -2835,40 +2919,281 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } /* - * Load the vdev state for all toplevel vdevs. + * Load the vdev metadata such as metaslabs, DTLs, spacemap object, etc. */ error = vdev_load(rvd); if (error != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } - error = spa_condense_init(spa); - if (error != 0) { - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); - } - /* - * Propagate the leaf DTLs we just loaded all the way up the tree. + * Propagate the leaf DTLs we just loaded all the way up the vdev tree. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); vdev_dtl_reassess(rvd, 0, 0, B_FALSE); spa_config_exit(spa, SCL_ALL, FTAG); - /* - * Load the DDTs (dedup tables). - */ + return (0); +} + +static int +spa_ld_load_dedup_tables(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + error = ddt_load(spa); if (error != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - spa_update_dspace(spa); + return (0); +} +static int +spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, char **ereport) +{ + vdev_t *rvd = spa->spa_root_vdev; + if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa) && spa_check_logs(spa)) { *ereport = FM_EREPORT_ZFS_LOG_REPLAY; return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); } + return (0); +} + +static int +spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t state) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + + /* + * We've successfully opened the pool, verify that we're ready + * to start pushing transactions. + */ + if (state != SPA_LOAD_TRYIMPORT) { + error = spa_load_verify(spa); + if (error != 0) { + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, + error)); + } + } + + return (0); +} + +static void +spa_ld_claim_log_blocks(spa_t *spa) +{ + dmu_tx_t *tx; + dsl_pool_t *dp = spa_get_dsl(spa); + + /* + * Claim log blocks that haven't been committed yet. + * This must all happen in a single txg. + * Note: spa_claim_max_txg is updated by spa_claim_notify(), + * invoked from zil_claim_log_block()'s i/o done callback. + * Price of rollback is that we abandon the log. + */ + spa->spa_claiming = B_TRUE; + + tx = dmu_tx_create_assigned(dp, spa_first_txg(spa)); + (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj, + zil_claim, tx, DS_FIND_CHILDREN); + dmu_tx_commit(tx); + + spa->spa_claiming = B_FALSE; + + spa_set_log_state(spa, SPA_LOG_GOOD); +} + +static void +spa_ld_check_for_config_update(spa_t *spa, spa_load_state_t state, + int64_t config_cache_txg) +{ + vdev_t *rvd = spa->spa_root_vdev; + int need_update = B_FALSE; + + /* + * If the config cache is stale, or we have uninitialized + * metaslabs (see spa_vdev_add()), then update the config. + * + * If this is a verbatim import, trust the current + * in-core spa_config and update the disk labels. + */ + if (config_cache_txg != spa->spa_config_txg || + state == SPA_LOAD_IMPORT || + state == SPA_LOAD_RECOVER || + (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) + need_update = B_TRUE; + + for (int c = 0; c < rvd->vdev_children; c++) + if (rvd->vdev_child[c]->vdev_ms_array == 0) + need_update = B_TRUE; + + /* + * Update the config cache asychronously in case we're the + * root pool, in which case the config cache isn't writable yet. + */ + if (need_update) + spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); +} + +/* + * Load an existing storage pool, using the config provided. This config + * describes which vdevs are part of the pool and is later validated against + * partial configs present in each vdev's label and an entire copy of the + * config stored in the MOS. + */ +static int +spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, + spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, + char **ereport) +{ + int error = 0; + uint64_t config_cache_txg = spa->spa_config_txg; + int orig_mode = spa->spa_mode; + boolean_t missing_feat_write = B_FALSE; + + /* + * If this is an untrusted config, first access the pool in read-only + * mode. We will then retrieve a trusted copy of the config from the MOS + * and use it to reopen the pool in read-write mode. + */ + if (!trust_config) + spa->spa_mode = FREAD; + + /* + * Parse the config provided to create a vdev tree. + */ + error = spa_ld_parse_config(spa, pool_guid, config, state, type); + if (error != 0) + return (error); + + /* + * Now that we have the vdev tree, try to open each vdev. This involves + * opening the underlying physical device, retrieving its geometry and + * probing the vdev with a dummy I/O. The state of each vdev will be set + * based on the success of those operations. After this we'll be ready + * to read from the vdevs. + */ + error = spa_ld_open_vdevs(spa); + if (error != 0) + return (error); + + /* + * Read the label of each vdev and make sure that the GUIDs stored + * there match the GUIDs in the config provided. + */ + error = spa_ld_validate_vdevs(spa, type, trust_config); + if (error != 0) + return (error); + + /* + * Read vdev labels to find the best uberblock (i.e. latest, unless + * spa_load_max_txg is set) and store it in spa_uberblock. We get the + * list of features required to read blkptrs in the MOS from the vdev + * label with the best uberblock and verify that our version of zfs + * supports them all. + */ + error = spa_ld_select_uberblock(spa, config, type, trust_config); + if (error != 0) + return (error); + + /* + * Pass that uberblock to the dsl_pool layer which will open the root + * blkptr. This blkptr points to the latest version of the MOS and will + * allow us to read its contents. + */ + error = spa_ld_open_rootbp(spa); + if (error != 0) + return (error); + + /* + * Retrieve the config stored in the MOS and use it to validate the + * config provided. Also extract some information from the MOS config + * to update our vdev tree. + */ + error = spa_ld_validate_config(spa, type); + if (error != 0) + return (error); + + /* + * Retrieve the mapping of indirect vdevs. Those vdevs were removed + * from the pool and their contents were re-mapped to other vdevs. Note + * that everything that we read before this step must have been + * rewritten on concrete vdevs after the last device removal was + * initiated. Otherwise we could be reading from indirect vdevs before + * we have loaded their mappings. + */ + error = spa_ld_open_indirect_vdev_metadata(spa); + if (error != 0) + return (error); + + /* + * Retrieve the full list of active features from the MOS and check if + * they are all supported. + */ + error = spa_ld_check_features(spa, state, &missing_feat_write); + if (error != 0) + return (error); + + /* + * Load several special directories from the MOS needed by the dsl_pool + * layer. + */ + error = spa_ld_load_special_directories(spa); + if (error != 0) + return (error); + + /* + * If the config provided is not trusted, discard it and use the config + * from the MOS to reload the pool. + */ + if (!trust_config) { + error = spa_ld_prepare_for_reload(spa, orig_mode); + if (error != 0) + return (error); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); + } + + /* + * Retrieve pool properties from the MOS. + */ + error = spa_ld_get_props(spa); + if (error != 0) + return (error); + + /* + * Retrieve the list of auxiliary devices - cache devices and spares - + * and open them. + */ + error = spa_ld_open_aux_vdevs(spa, type); + if (error != 0) + return (error); + + /* + * Load the metadata for all vdevs. Also check if unopenable devices + * should be autoreplaced. + */ + error = spa_ld_load_vdev_metadata(spa, state); + if (error != 0) + return (error); + + error = spa_ld_load_dedup_tables(spa); + if (error != 0) + return (error); + + /* + * Verify the logs now to make sure we don't have any unexpected errors + * when we claim log blocks later. + */ + error = spa_ld_verify_logs(spa, type, ereport); + if (error != 0) + return (error); + if (missing_feat_write) { ASSERT(state == SPA_LOAD_TRYIMPORT); @@ -2877,24 +3202,34 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * read-only mode but not read-write mode. We now have enough * information and can return to userland. */ - return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); + return (spa_vdev_err(spa->spa_root_vdev, VDEV_AUX_UNSUP_FEAT, + ENOTSUP)); } /* - * We've successfully opened the pool, verify that we're ready - * to start pushing transactions. + * Traverse the last txgs to make sure the pool was left off in a safe + * state. When performing an extreme rewind, we verify the whole pool, + * which can take a very long time. */ - if (state != SPA_LOAD_TRYIMPORT) { - if (error = spa_load_verify(spa)) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, - error)); - } + error = spa_ld_verify_pool_data(spa, state); + if (error != 0) + return (error); + /* + * Calculate the deflated space for the pool. This must be done before + * we write anything to the pool because we'd need to update the space + * accounting using the deflated sizes. + */ + spa_update_dspace(spa); + + /* + * We have now retrieved all the information we needed to open the + * pool. If we are importing the pool in read-write mode, a few + * additional steps must be performed to finish the import. + */ if (spa_writeable(spa) && (state == SPA_LOAD_RECOVER || spa->spa_load_max_txg == UINT64_MAX)) { - dmu_tx_t *tx; - int need_update = B_FALSE; - dsl_pool_t *dp = spa_get_dsl(spa); + ASSERT(state != SPA_LOAD_TRYIMPORT); /* * We must check this before we start the sync thread, because @@ -2908,25 +3243,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t boolean_t condense_in_progress = (spa->spa_condensing_indirect != NULL); - ASSERT(state != SPA_LOAD_TRYIMPORT); - /* - * Claim log blocks that haven't been committed yet. - * This must all happen in a single txg. - * Note: spa_claim_max_txg is updated by spa_claim_notify(), - * invoked from zil_claim_log_block()'s i/o done callback. - * Price of rollback is that we abandon the log. + * Traverse the ZIL and claim all blocks. */ - spa->spa_claiming = B_TRUE; + spa_ld_claim_log_blocks(spa); - tx = dmu_tx_create_assigned(dp, spa_first_txg(spa)); - (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj, - zil_claim, tx, DS_FIND_CHILDREN); - dmu_tx_commit(tx); - - spa->spa_claiming = B_FALSE; - - spa_set_log_state(spa, SPA_LOG_GOOD); + /* + * Kick-off the syncing thread. + */ spa->spa_sync_on = B_TRUE; txg_sync_start(spa->spa_dsl_pool); @@ -2934,40 +3258,23 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Wait for all claims to sync. We sync up to the highest * claimed log block birth time so that claimed log blocks * don't appear to be from the future. spa_claim_max_txg - * will have been set for us by either zil_check_log_chain() - * (invoked from spa_check_logs()) or zil_claim() above. + * will have been set for us by ZIL traversal operations + * performed above. */ txg_wait_synced(spa->spa_dsl_pool, spa->spa_claim_max_txg); /* - * If the config cache is stale, or we have uninitialized - * metaslabs (see spa_vdev_add()), then update the config. - * - * If this is a verbatim import, trust the current - * in-core spa_config and update the disk labels. + * Check if we need to request an update of the config. On the + * next sync, we would update the config stored in vdev labels + * and the cachefile (by default /etc/zfs/zpool.cache). */ - if (config_cache_txg != spa->spa_config_txg || - state == SPA_LOAD_IMPORT || - state == SPA_LOAD_RECOVER || - (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) - need_update = B_TRUE; + spa_ld_check_for_config_update(spa, state, config_cache_txg); - for (int c = 0; c < rvd->vdev_children; c++) - if (rvd->vdev_child[c]->vdev_ms_array == 0) - need_update = B_TRUE; - /* - * Update the config cache asychronously in case we're the - * root pool, in which case the config cache isn't writable yet. - */ - if (need_update) - spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); - - /* * Check all DTLs to see if anything needs resilvering. */ if (!dsl_scan_resilvering(spa->spa_dsl_pool) && - vdev_resilver_needed(rvd, NULL, NULL)) + vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) spa_async_request(spa, SPA_ASYNC_RESILVER); /* @@ -3002,7 +3309,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } static int -spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig) +spa_load_retry(spa_t *spa, spa_load_state_t state, int trust_config) { int mode = spa->spa_mode; @@ -3014,7 +3321,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int spa_activate(spa, mode); spa_async_suspend(spa); - return (spa_load(spa, state, SPA_IMPORT_EXISTING, mosconfig)); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, trust_config)); } /* @@ -3025,7 +3332,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int * spa_load(). */ static int -spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig, +spa_load_best(spa_t *spa, spa_load_state_t state, int trust_config, uint64_t max_request, int rewind_flags) { nvlist_t *loadinfo = NULL; @@ -3044,7 +3351,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int } load_error = rewind_error = spa_load(spa, state, SPA_IMPORT_EXISTING, - mosconfig); + trust_config); if (load_error == 0) return (0); @@ -3085,7 +3392,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int spa->spa_uberblock.ub_txg <= spa->spa_load_max_txg) { if (spa->spa_load_max_txg < safe_rewind_txg) spa->spa_extreme_rewind = B_TRUE; - rewind_error = spa_load_retry(spa, state, mosconfig); + rewind_error = spa_load_retry(spa, state, trust_config); } spa->spa_extreme_rewind = B_FALSE; @@ -4187,7 +4494,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ state = SPA_LOAD_RECOVER; /* - * Pass off the heavy lifting to spa_load(). Pass TRUE for mosconfig + * Pass off the heavy lifting to spa_load(). Pass TRUE for trust_config * because the user-supplied config is actually the one to trust when * doing an import. */ @@ -4333,7 +4640,7 @@ spa_tryimport(nvlist_t *tryconfig) /* * Pass off the heavy lifting to spa_load(). - * Pass TRUE for mosconfig because the user-supplied config + * Pass TRUE for trust_config because the user-supplied config * is actually the one to trust when doing an import. */ error = spa_load(spa, SPA_LOAD_TRYIMPORT, SPA_IMPORT_EXISTING, B_TRUE); From owner-svn-src-all@freebsd.org Wed Feb 21 23:38:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76E9FF0B7EF; Wed, 21 Feb 2018 23:38:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A9A579203; Wed, 21 Feb 2018 23:38:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20A1C1F403; Wed, 21 Feb 2018 23:38:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNcUTL081457; Wed, 21 Feb 2018 23:38:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNcURV081456; Wed, 21 Feb 2018 23:38:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212338.w1LNcURV081456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 23:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329761 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:38:31 -0000 Author: mav Date: Wed Feb 21 23:38:30 2018 New Revision: 329761 URL: https://svnweb.freebsd.org/changeset/base/329761 Log: MFV r329760: 7638 Refactor spa_load_impl into several functions illumos/illumos-gate@1fd3785ff6601d3e391378c2dcbf4c5f27e1fe32 spa_load_impl has grown out of proportions. It is currently over 700 lines long and makes it very hard to follow or debug the import process even for experienced ZFS developers. The objective is to split it up in a series of well commented functions. Reviewed by: Paul Dagnelie Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 23:25:11 2018 (r329760) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 23:38:30 2018 (r329761) @@ -2218,7 +2218,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config) static int spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type, - boolean_t mosconfig) + boolean_t trust_config) { nvlist_t *config = spa->spa_config; char *ereport = FM_EREPORT_ZFS_POOL; @@ -2262,7 +2262,7 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_impor gethrestime(&spa->spa_loaded_ts); error = spa_load_impl(spa, pool_guid, config, state, type, - mosconfig, &ereport); + trust_config, &ereport); } /* @@ -2314,38 +2314,20 @@ vdev_count_verify_zaps(vdev_t *vd) return (total); } -/* - * Load an existing storage pool, using the pool's builtin spa_config as a - * source of configuration information. - */ static int -spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, - char **ereport) +spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, + spa_load_state_t state, spa_import_type_t type) { int error = 0; - nvlist_t *nvroot = NULL; - nvlist_t *label; - vdev_t *rvd; - uberblock_t *ub = &spa->spa_uberblock; - uint64_t children, config_cache_txg = spa->spa_config_txg; - int orig_mode = spa->spa_mode; + nvlist_t *nvtree = NULL; int parse; - uint64_t obj; - boolean_t missing_feat_write = B_FALSE; + vdev_t *rvd; - /* - * If this is an untrusted config, access the pool in read-only mode. - * This prevents things like resilvering recently removed devices. - */ - if (!trust_config) - spa->spa_mode = FREAD; - ASSERT(MUTEX_HELD(&spa_namespace_lock)); spa->spa_load_state = state; - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot)) + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) return (SET_ERROR(EINVAL)); parse = (type == SPA_IMPORT_EXISTING ? @@ -2368,7 +2350,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * configuration requires knowing the version number. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = spa_config_parse(spa, &rvd, nvroot, NULL, 0, parse); + error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); if (error != 0) @@ -2382,22 +2364,35 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t ASSERT(spa_guid(spa) == pool_guid); } - /* - * Try to open all vdevs, loading each label in the process. - */ + return (0); +} + +static int +spa_ld_open_vdevs(spa_t *spa) +{ + int error = 0; + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = vdev_open(rvd); + error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) - return (error); + return (error); +} + +static int +spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type, + boolean_t trust_config) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * We need to validate the vdev labels against the configuration that - * we have in hand, which is dependent on the setting of mosconfig. If - * mosconfig is true then we're validating the vdev labels based on - * that config. Otherwise, we're validating against the cached config - * (zpool.cache) that was read when we loaded the zfs module, and then - * later we will recursively call spa_load() and validate against + * we have in hand, which is dependent on the setting of trust_config. + * If trust_config is true then we're validating the vdev labels based + * on that config. Otherwise, we're validating against the cached + * config (zpool.cache) that was read when we loaded the zfs module, and + * then later we will recursively call spa_load() and validate against * the vdev config. * * If we're assembling a new pool that's been split off from an @@ -2416,6 +2411,18 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (SET_ERROR(ENXIO)); } + return (0); +} + +static int +spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, spa_import_type_t type, + boolean_t trust_config) +{ + vdev_t *rvd = spa->spa_root_vdev; + nvlist_t *label; + uberblock_t *ub = &spa->spa_uberblock; + uint64_t children; + /* * Find the best uberblock. */ @@ -2524,18 +2531,28 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa->spa_claim_max_txg = spa->spa_first_txg; spa->spa_prev_software_version = ub->ub_software_version; - /* - * Everything that we read before we do spa_remove_init() must - * have been rewritten after the last device removal was initiated. - * Otherwise we could be reading from indirect vdevs before - * we have loaded their mappings. - */ + return (0); +} +static int +spa_ld_open_rootbp(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + error = dsl_pool_init(spa, spa->spa_first_txg, &spa->spa_dsl_pool); if (error) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset; + return (0); +} + +static int +spa_ld_validate_config(spa_t *spa, spa_import_type_t type) +{ + vdev_t *rvd = spa->spa_root_vdev; + if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2567,6 +2584,15 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (SET_ERROR(ENXIO)); } + return (0); +} + +static int +spa_ld_open_indirect_vdev_metadata(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * Everything that we read before spa_remove_init() must be stored * on concreted vdevs. Therefore we do this as early as possible. @@ -2574,6 +2600,24 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t if (spa_remove_init(spa) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + /* + * Retrieve information needed to condense indirect vdev mappings. + */ + error = spa_condense_init(spa); + if (error != 0) { + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); + } + + return (0); +} + +static int +spa_ld_check_features(spa_t *spa, spa_load_state_t state, + boolean_t *missing_feat_writep) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + if (spa_version(spa) >= SPA_VERSION_FEATURES) { boolean_t missing_feat_read = B_FALSE; nvlist_t *unsup_feat, *enabled_feat; @@ -2603,7 +2647,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { if (!spa_features_check(spa, B_TRUE, unsup_feat, enabled_feat)) { - missing_feat_write = B_TRUE; + *missing_feat_writep = B_TRUE; } } @@ -2642,7 +2686,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * userland in order to know whether to display the * abovementioned note. */ - if (missing_feat_read || (missing_feat_write && + if (missing_feat_read || (*missing_feat_writep && spa_writeable(spa))) { return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); @@ -2675,62 +2719,85 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } + return (0); +} + +static int +spa_ld_load_special_directories(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + spa->spa_is_initializing = B_TRUE; error = dsl_pool_open(spa->spa_dsl_pool); spa->spa_is_initializing = B_FALSE; if (error != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - if (!trust_config) { - uint64_t hostid; - nvlist_t *policy = NULL; - nvlist_t *mos_config; + return (0); +} - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); +static int +spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) +{ + vdev_t *rvd = spa->spa_root_vdev; - if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, - ZPOOL_CONFIG_HOSTID, &hostid) == 0) { - char *hostname; - unsigned long myhostid = 0; + uint64_t hostid; + nvlist_t *policy = NULL; + nvlist_t *mos_config; - VERIFY(nvlist_lookup_string(mos_config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_HOSTID, &hostid) == 0) { + char *hostname; + unsigned long myhostid = 0; + + VERIFY(nvlist_lookup_string(mos_config, + ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); + #ifdef _KERNEL - myhostid = zone_get_hostid(NULL); + myhostid = zone_get_hostid(NULL); #else /* _KERNEL */ - /* - * We're emulating the system's hostid in userland, so - * we can't use zone_get_hostid(). - */ - (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); + /* + * We're emulating the system's hostid in userland, so + * we can't use zone_get_hostid(). + */ + (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); #endif /* _KERNEL */ - if (check_hostid && hostid != 0 && myhostid != 0 && - hostid != myhostid) { - nvlist_free(mos_config); - cmn_err(CE_WARN, "pool '%s' could not be " - "loaded as it was last accessed by " - "another system (host: %s hostid: 0x%lx). " - "See: http://illumos.org/msg/ZFS-8000-EY", - spa_name(spa), hostname, - (unsigned long)hostid); - return (SET_ERROR(EBADF)); - } + if (check_hostid && hostid != 0 && myhostid != 0 && + hostid != myhostid) { + nvlist_free(mos_config); + cmn_err(CE_WARN, "pool '%s' could not be " + "loaded as it was last accessed by " + "another system (host: %s hostid: 0x%lx). " + "See: http://illumos.org/msg/ZFS-8000-EY", + spa_name(spa), hostname, + (unsigned long)hostid); + return (SET_ERROR(EBADF)); } - if (nvlist_lookup_nvlist(spa->spa_config, - ZPOOL_REWIND_POLICY, &policy) == 0) - VERIFY(nvlist_add_nvlist(mos_config, - ZPOOL_REWIND_POLICY, policy) == 0); + } + if (nvlist_lookup_nvlist(spa->spa_config, + ZPOOL_REWIND_POLICY, &policy) == 0) + VERIFY(nvlist_add_nvlist(mos_config, + ZPOOL_REWIND_POLICY, policy) == 0); - spa_config_set(spa, mos_config); - spa_unload(spa); - spa_deactivate(spa); - spa_activate(spa, orig_mode); + spa_config_set(spa, mos_config); + spa_unload(spa); + spa_deactivate(spa); + spa_activate(spa, orig_mode); - return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); - } + return (0); +} +static int +spa_ld_get_props(spa_t *spa) +{ + int error = 0; + uint64_t obj; + vdev_t *rvd = spa->spa_root_vdev; + /* Grab the secret checksum salt from the MOS. */ error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_CHECKSUM_SALT, 1, @@ -2822,6 +2889,35 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } nvlist_free(mos_config); + spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); + + error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); + if (error && error != ENOENT) + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + + if (error == 0) { + uint64_t autoreplace; + + spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs); + spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace); + spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); + spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); + spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, + &spa->spa_dedup_ditto); + + spa->spa_autoreplace = (autoreplace != 0); + } + + return (0); +} + +static int +spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t type) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + /* * If we're assembling the pool from the split-off vdevs of * an existing pool, we don't want to attach the spares & cache @@ -2867,27 +2963,15 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa->spa_l2cache.sav_sync = B_TRUE; } - spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); + return (0); +} - error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); - if (error && error != ENOENT) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); +static int +spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t state) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; - if (error == 0) { - uint64_t autoreplace; - - spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs); - spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace); - spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); - spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); - spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); - spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize); - spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, - &spa->spa_dedup_ditto); - - spa->spa_autoreplace = (autoreplace != 0); - } - /* * If the 'autoreplace' property is set, then post a resource notifying * the ZFS DE that it should not issue any faults for unopenable @@ -2909,40 +2993,281 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } /* - * Load the vdev state for all toplevel vdevs. + * Load the vdev metadata such as metaslabs, DTLs, spacemap object, etc. */ error = vdev_load(rvd); if (error != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } - error = spa_condense_init(spa); - if (error != 0) { - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); - } - /* - * Propagate the leaf DTLs we just loaded all the way up the tree. + * Propagate the leaf DTLs we just loaded all the way up the vdev tree. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); vdev_dtl_reassess(rvd, 0, 0, B_FALSE); spa_config_exit(spa, SCL_ALL, FTAG); - /* - * Load the DDTs (dedup tables). - */ + return (0); +} + +static int +spa_ld_load_dedup_tables(spa_t *spa) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + error = ddt_load(spa); if (error != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - spa_update_dspace(spa); + return (0); +} +static int +spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, char **ereport) +{ + vdev_t *rvd = spa->spa_root_vdev; + if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa) && spa_check_logs(spa)) { *ereport = FM_EREPORT_ZFS_LOG_REPLAY; return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); } + return (0); +} + +static int +spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t state) +{ + int error = 0; + vdev_t *rvd = spa->spa_root_vdev; + + /* + * We've successfully opened the pool, verify that we're ready + * to start pushing transactions. + */ + if (state != SPA_LOAD_TRYIMPORT) { + error = spa_load_verify(spa); + if (error != 0) { + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, + error)); + } + } + + return (0); +} + +static void +spa_ld_claim_log_blocks(spa_t *spa) +{ + dmu_tx_t *tx; + dsl_pool_t *dp = spa_get_dsl(spa); + + /* + * Claim log blocks that haven't been committed yet. + * This must all happen in a single txg. + * Note: spa_claim_max_txg is updated by spa_claim_notify(), + * invoked from zil_claim_log_block()'s i/o done callback. + * Price of rollback is that we abandon the log. + */ + spa->spa_claiming = B_TRUE; + + tx = dmu_tx_create_assigned(dp, spa_first_txg(spa)); + (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj, + zil_claim, tx, DS_FIND_CHILDREN); + dmu_tx_commit(tx); + + spa->spa_claiming = B_FALSE; + + spa_set_log_state(spa, SPA_LOG_GOOD); +} + +static void +spa_ld_check_for_config_update(spa_t *spa, spa_load_state_t state, + int64_t config_cache_txg) +{ + vdev_t *rvd = spa->spa_root_vdev; + int need_update = B_FALSE; + + /* + * If the config cache is stale, or we have uninitialized + * metaslabs (see spa_vdev_add()), then update the config. + * + * If this is a verbatim import, trust the current + * in-core spa_config and update the disk labels. + */ + if (config_cache_txg != spa->spa_config_txg || + state == SPA_LOAD_IMPORT || + state == SPA_LOAD_RECOVER || + (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) + need_update = B_TRUE; + + for (int c = 0; c < rvd->vdev_children; c++) + if (rvd->vdev_child[c]->vdev_ms_array == 0) + need_update = B_TRUE; + + /* + * Update the config cache asychronously in case we're the + * root pool, in which case the config cache isn't writable yet. + */ + if (need_update) + spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); +} + +/* + * Load an existing storage pool, using the config provided. This config + * describes which vdevs are part of the pool and is later validated against + * partial configs present in each vdev's label and an entire copy of the + * config stored in the MOS. + */ +static int +spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, + spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, + char **ereport) +{ + int error = 0; + uint64_t config_cache_txg = spa->spa_config_txg; + int orig_mode = spa->spa_mode; + boolean_t missing_feat_write = B_FALSE; + + /* + * If this is an untrusted config, first access the pool in read-only + * mode. We will then retrieve a trusted copy of the config from the MOS + * and use it to reopen the pool in read-write mode. + */ + if (!trust_config) + spa->spa_mode = FREAD; + + /* + * Parse the config provided to create a vdev tree. + */ + error = spa_ld_parse_config(spa, pool_guid, config, state, type); + if (error != 0) + return (error); + + /* + * Now that we have the vdev tree, try to open each vdev. This involves + * opening the underlying physical device, retrieving its geometry and + * probing the vdev with a dummy I/O. The state of each vdev will be set + * based on the success of those operations. After this we'll be ready + * to read from the vdevs. + */ + error = spa_ld_open_vdevs(spa); + if (error != 0) + return (error); + + /* + * Read the label of each vdev and make sure that the GUIDs stored + * there match the GUIDs in the config provided. + */ + error = spa_ld_validate_vdevs(spa, type, trust_config); + if (error != 0) + return (error); + + /* + * Read vdev labels to find the best uberblock (i.e. latest, unless + * spa_load_max_txg is set) and store it in spa_uberblock. We get the + * list of features required to read blkptrs in the MOS from the vdev + * label with the best uberblock and verify that our version of zfs + * supports them all. + */ + error = spa_ld_select_uberblock(spa, config, type, trust_config); + if (error != 0) + return (error); + + /* + * Pass that uberblock to the dsl_pool layer which will open the root + * blkptr. This blkptr points to the latest version of the MOS and will + * allow us to read its contents. + */ + error = spa_ld_open_rootbp(spa); + if (error != 0) + return (error); + + /* + * Retrieve the config stored in the MOS and use it to validate the + * config provided. Also extract some information from the MOS config + * to update our vdev tree. + */ + error = spa_ld_validate_config(spa, type); + if (error != 0) + return (error); + + /* + * Retrieve the mapping of indirect vdevs. Those vdevs were removed + * from the pool and their contents were re-mapped to other vdevs. Note + * that everything that we read before this step must have been + * rewritten on concrete vdevs after the last device removal was + * initiated. Otherwise we could be reading from indirect vdevs before + * we have loaded their mappings. + */ + error = spa_ld_open_indirect_vdev_metadata(spa); + if (error != 0) + return (error); + + /* + * Retrieve the full list of active features from the MOS and check if + * they are all supported. + */ + error = spa_ld_check_features(spa, state, &missing_feat_write); + if (error != 0) + return (error); + + /* + * Load several special directories from the MOS needed by the dsl_pool + * layer. + */ + error = spa_ld_load_special_directories(spa); + if (error != 0) + return (error); + + /* + * If the config provided is not trusted, discard it and use the config + * from the MOS to reload the pool. + */ + if (!trust_config) { + error = spa_ld_prepare_for_reload(spa, orig_mode); + if (error != 0) + return (error); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); + } + + /* + * Retrieve pool properties from the MOS. + */ + error = spa_ld_get_props(spa); + if (error != 0) + return (error); + + /* + * Retrieve the list of auxiliary devices - cache devices and spares - + * and open them. + */ + error = spa_ld_open_aux_vdevs(spa, type); + if (error != 0) + return (error); + + /* + * Load the metadata for all vdevs. Also check if unopenable devices + * should be autoreplaced. + */ + error = spa_ld_load_vdev_metadata(spa, state); + if (error != 0) + return (error); + + error = spa_ld_load_dedup_tables(spa); + if (error != 0) + return (error); + + /* + * Verify the logs now to make sure we don't have any unexpected errors + * when we claim log blocks later. + */ + error = spa_ld_verify_logs(spa, type, ereport); + if (error != 0) + return (error); + if (missing_feat_write) { ASSERT(state == SPA_LOAD_TRYIMPORT); @@ -2951,24 +3276,34 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * read-only mode but not read-write mode. We now have enough * information and can return to userland. */ - return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); + return (spa_vdev_err(spa->spa_root_vdev, VDEV_AUX_UNSUP_FEAT, + ENOTSUP)); } /* - * We've successfully opened the pool, verify that we're ready - * to start pushing transactions. + * Traverse the last txgs to make sure the pool was left off in a safe + * state. When performing an extreme rewind, we verify the whole pool, + * which can take a very long time. */ - if (state != SPA_LOAD_TRYIMPORT) { - if (error = spa_load_verify(spa)) - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, - error)); - } + error = spa_ld_verify_pool_data(spa, state); + if (error != 0) + return (error); + /* + * Calculate the deflated space for the pool. This must be done before + * we write anything to the pool because we'd need to update the space + * accounting using the deflated sizes. + */ + spa_update_dspace(spa); + + /* + * We have now retrieved all the information we needed to open the + * pool. If we are importing the pool in read-write mode, a few + * additional steps must be performed to finish the import. + */ if (spa_writeable(spa) && (state == SPA_LOAD_RECOVER || spa->spa_load_max_txg == UINT64_MAX)) { - dmu_tx_t *tx; - int need_update = B_FALSE; - dsl_pool_t *dp = spa_get_dsl(spa); + ASSERT(state != SPA_LOAD_TRYIMPORT); /* * We must check this before we start the sync thread, because @@ -2982,25 +3317,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t boolean_t condense_in_progress = (spa->spa_condensing_indirect != NULL); - ASSERT(state != SPA_LOAD_TRYIMPORT); - /* - * Claim log blocks that haven't been committed yet. - * This must all happen in a single txg. - * Note: spa_claim_max_txg is updated by spa_claim_notify(), - * invoked from zil_claim_log_block()'s i/o done callback. - * Price of rollback is that we abandon the log. + * Traverse the ZIL and claim all blocks. */ - spa->spa_claiming = B_TRUE; + spa_ld_claim_log_blocks(spa); - tx = dmu_tx_create_assigned(dp, spa_first_txg(spa)); - (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj, - zil_claim, tx, DS_FIND_CHILDREN); - dmu_tx_commit(tx); - - spa->spa_claiming = B_FALSE; - - spa_set_log_state(spa, SPA_LOG_GOOD); + /* + * Kick-off the syncing thread. + */ spa->spa_sync_on = B_TRUE; txg_sync_start(spa->spa_dsl_pool); @@ -3008,40 +3332,23 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Wait for all claims to sync. We sync up to the highest * claimed log block birth time so that claimed log blocks * don't appear to be from the future. spa_claim_max_txg - * will have been set for us by either zil_check_log_chain() - * (invoked from spa_check_logs()) or zil_claim() above. + * will have been set for us by ZIL traversal operations + * performed above. */ txg_wait_synced(spa->spa_dsl_pool, spa->spa_claim_max_txg); /* - * If the config cache is stale, or we have uninitialized - * metaslabs (see spa_vdev_add()), then update the config. - * - * If this is a verbatim import, trust the current - * in-core spa_config and update the disk labels. + * Check if we need to request an update of the config. On the + * next sync, we would update the config stored in vdev labels + * and the cachefile (by default /etc/zfs/zpool.cache). */ - if (config_cache_txg != spa->spa_config_txg || - state == SPA_LOAD_IMPORT || - state == SPA_LOAD_RECOVER || - (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) - need_update = B_TRUE; + spa_ld_check_for_config_update(spa, state, config_cache_txg); - for (int c = 0; c < rvd->vdev_children; c++) - if (rvd->vdev_child[c]->vdev_ms_array == 0) - need_update = B_TRUE; - /* - * Update the config cache asychronously in case we're the - * root pool, in which case the config cache isn't writable yet. - */ - if (need_update) - spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); - - /* * Check all DTLs to see if anything needs resilvering. */ if (!dsl_scan_resilvering(spa->spa_dsl_pool) && - vdev_resilver_needed(rvd, NULL, NULL)) + vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) spa_async_request(spa, SPA_ASYNC_RESILVER); /* @@ -3076,7 +3383,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t } static int -spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig) +spa_load_retry(spa_t *spa, spa_load_state_t state, int trust_config) { int mode = spa->spa_mode; @@ -3088,7 +3395,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int spa_activate(spa, mode); spa_async_suspend(spa); - return (spa_load(spa, state, SPA_IMPORT_EXISTING, mosconfig)); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, trust_config)); } /* @@ -3099,7 +3406,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int * spa_load(). */ static int -spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig, +spa_load_best(spa_t *spa, spa_load_state_t state, int trust_config, uint64_t max_request, int rewind_flags) { nvlist_t *loadinfo = NULL; @@ -3118,7 +3425,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int } load_error = rewind_error = spa_load(spa, state, SPA_IMPORT_EXISTING, - mosconfig); + trust_config); if (load_error == 0) return (0); @@ -3159,7 +3466,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int spa->spa_uberblock.ub_txg <= spa->spa_load_max_txg) { if (spa->spa_load_max_txg < safe_rewind_txg) spa->spa_extreme_rewind = B_TRUE; - rewind_error = spa_load_retry(spa, state, mosconfig); + rewind_error = spa_load_retry(spa, state, trust_config); } spa->spa_extreme_rewind = B_FALSE; @@ -4481,7 +4788,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ state = SPA_LOAD_RECOVER; /* - * Pass off the heavy lifting to spa_load(). Pass TRUE for mosconfig + * Pass off the heavy lifting to spa_load(). Pass TRUE for trust_config * because the user-supplied config is actually the one to trust when * doing an import. */ @@ -4632,7 +4939,7 @@ spa_tryimport(nvlist_t *tryconfig) /* * Pass off the heavy lifting to spa_load(). - * Pass TRUE for mosconfig because the user-supplied config + * Pass TRUE for trust_config because the user-supplied config * is actually the one to trust when doing an import. */ error = spa_load(spa, SPA_LOAD_TRYIMPORT, SPA_IMPORT_EXISTING, B_TRUE); From owner-svn-src-all@freebsd.org Wed Feb 21 23:42:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E30FF0BD12; Wed, 21 Feb 2018 23:42:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B52BA7966A; Wed, 21 Feb 2018 23:42:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF7161F5A3; Wed, 21 Feb 2018 23:42:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNgV6v086185; Wed, 21 Feb 2018 23:42:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNgUUW086175; Wed, 21 Feb 2018 23:42:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802212342.w1LNgUUW086175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Feb 2018 23:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329762 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:42:32 -0000 Author: mav Date: Wed Feb 21 23:42:30 2018 New Revision: 329762 URL: https://svnweb.freebsd.org/changeset/base/329762 Log: 8961 SPA load/import should tell us why it failed illumos/illumos-gate@3ee8c80c747c4aa3f83351a6920f30c411236e1b When we fail to open or import a storage pool, we typically don't get any additional diagnostic information, just "no pool found" or "can not import". While there may be no additional user-consumable information, we should at least make this situation easier to debug/diagnose for developers and support. For example, we could start by using `zfs_dbgmsg()` to log each thing that we try when importing, and which things failed. E.g. "tried uberblock of txg X from label Y of device Z". Also, we could log each of the stages that we go through in `spa_load_impl()`. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Feb 21 23:42:30 2018 (r329762) @@ -1242,6 +1242,8 @@ spa_unload(spa_t *spa) ASSERT(MUTEX_HELD(&spa_namespace_lock)); + spa_load_note(spa, "UNLOADING"); + /* * Stop async tasks. */ @@ -1995,6 +1997,13 @@ spa_load_verify(spa_t *spa) ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); if (spa_load_verify_metadata) { + if (spa->spa_extreme_rewind) { + spa_load_note(spa, "performing a complete scan of the " + "pool since extreme rewind is on. This may take " + "a very long time.\n (spa_load_verify_data=%u, " + "spa_load_verify_metadata=%u)", + spa_load_verify_data, spa_load_verify_metadata); + } error = traverse_pool(spa, spa->spa_verify_min_txg, TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, spa_load_verify_cb, rio); @@ -2047,10 +2056,17 @@ spa_prop_find(spa_t *spa, zpool_prop_t prop, uint64_t * Find a value in the pool directory object. */ static int -spa_dir_prop(spa_t *spa, const char *name, uint64_t *val) +spa_dir_prop(spa_t *spa, const char *name, uint64_t *val, boolean_t log_enoent) { - return (zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, - name, sizeof (uint64_t), 1, val)); + int error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, + name, sizeof (uint64_t), 1, val); + + if (error != 0 && (error != ENOENT || log_enoent)) { + spa_load_failed(spa, "couldn't get '%s' value in MOS directory " + "[error=%d]", name, error); + } + + return (error); } static int @@ -2242,19 +2258,18 @@ vdev_count_verify_zaps(vdev_t *vd) static int spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type) + spa_import_type_t type) { int error = 0; nvlist_t *nvtree = NULL; int parse; vdev_t *rvd; - ASSERT(MUTEX_HELD(&spa_namespace_lock)); - - spa->spa_load_state = state; - - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) { + spa_load_failed(spa, "invalid config provided: '%s' missing", + ZPOOL_CONFIG_VDEV_TREE); return (SET_ERROR(EINVAL)); + } parse = (type == SPA_IMPORT_EXISTING ? VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); @@ -2279,8 +2294,11 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "unable to parse config [error=%d]", + error); return (error); + } ASSERT(spa->spa_root_vdev == rvd); ASSERT3U(spa->spa_min_ashift, >=, SPA_MINBLOCKSHIFT); @@ -2301,6 +2319,10 @@ spa_ld_open_vdevs(spa_t *spa) spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); + if (error != 0) { + spa_load_failed(spa, "unable to open vdev tree [error=%d]", + error); + } return (error); } @@ -2330,11 +2352,17 @@ spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t ty error = vdev_validate(rvd, trust_config); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "vdev_validate failed [error=%d]", + error); return (error); + } - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "cannot open vdev tree after " + "invalidating some vdevs"); return (SET_ERROR(ENXIO)); + } } return (0); @@ -2359,14 +2387,20 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, */ if (ub->ub_txg == 0) { nvlist_free(label); + spa_load_failed(spa, "no valid uberblock found"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, ENXIO)); } + spa_load_note(spa, "using uberblock with txg=%llu", + (u_longlong_t)ub->ub_txg); + /* * If the pool has an unsupported version we can't open it. */ if (!SPA_VERSION_IS_SUPPORTED(ub->ub_version)) { nvlist_free(label); + spa_load_failed(spa, "version %llu is not supported", + (u_longlong_t)ub->ub_version); return (spa_vdev_err(rvd, VDEV_AUX_VERSION_NEWER, ENOTSUP)); } @@ -2377,9 +2411,17 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, * If we weren't able to find what's necessary for reading the * MOS in the label, return failure. */ - if (label == NULL || nvlist_lookup_nvlist(label, - ZPOOL_CONFIG_FEATURES_FOR_READ, &features) != 0) { + if (label == NULL) { + spa_load_failed(spa, "label config unavailable"); + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, + ENXIO)); + } + + if (nvlist_lookup_nvlist(label, ZPOOL_CONFIG_FEATURES_FOR_READ, + &features) != 0) { nvlist_free(label); + spa_load_failed(spa, "invalid label: '%s' missing", + ZPOOL_CONFIG_FEATURES_FOR_READ); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, ENXIO)); } @@ -2418,6 +2460,7 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, VERIFY(nvlist_add_nvlist(spa->spa_load_info, ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0); nvlist_free(unsup_feat); + spa_load_failed(spa, "some features are unsupported"); return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); } @@ -2434,8 +2477,13 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, */ if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &children) != 0 && trust_config && type != SPA_IMPORT_ASSEMBLE && - rvd->vdev_guid_sum != ub->ub_guid_sum) + rvd->vdev_guid_sum != ub->ub_guid_sum) { + spa_load_failed(spa, "guid sum in config doesn't match guid " + "sum in uberblock (%llu != %llu)", + (u_longlong_t)rvd->vdev_guid_sum, + (u_longlong_t)ub->ub_guid_sum); return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); + } if (type != SPA_IMPORT_ASSEMBLE && spa->spa_config_splitting) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); @@ -2467,8 +2515,11 @@ spa_ld_open_rootbp(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; error = dsl_pool_init(spa, spa->spa_first_txg, &spa->spa_dsl_pool); - if (error) + if (error != 0) { + spa_load_failed(spa, "unable to open rootbp in dsl_pool_init " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset; return (0); @@ -2479,7 +2530,8 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t { vdev_t *rvd = spa->spa_root_vdev; - if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0) + if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object, B_TRUE) + != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* @@ -2491,11 +2543,16 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t */ if (type != SPA_IMPORT_ASSEMBLE) { nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) + != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } if (!spa_config_valid(spa, mos_config)) { nvlist_free(mos_config); + spa_load_failed(spa, "mismatch between config provided " + "and config stored in MOS"); return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); } @@ -2506,8 +2563,10 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t * root vdev. If it can't be opened, it indicates one or * more toplevel vdevs are faulted. */ - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "some top vdevs are unavailable"); return (SET_ERROR(ENXIO)); + } } return (0); @@ -2523,14 +2582,20 @@ spa_ld_open_indirect_vdev_metadata(spa_t *spa) * Everything that we read before spa_remove_init() must be stored * on concreted vdevs. Therefore we do this as early as possible. */ - if (spa_remove_init(spa) != 0) + error = spa_remove_init(spa); + if (error != 0) { + spa_load_failed(spa, "spa_remove_init failed [error=%d]", + error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } /* * Retrieve information needed to condense indirect vdev mappings. */ error = spa_condense_init(spa); if (error != 0) { + spa_load_failed(spa, "spa_condense_init failed [error=%d]", + error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -2538,8 +2603,7 @@ spa_ld_open_indirect_vdev_metadata(spa_t *spa) } static int -spa_ld_check_features(spa_t *spa, spa_load_state_t state, - boolean_t *missing_feat_writep) +spa_ld_check_features(spa_t *spa, boolean_t *missing_feat_writep) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -2549,17 +2613,17 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta nvlist_t *unsup_feat, *enabled_feat; if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ, - &spa->spa_feat_for_read_obj) != 0) { + &spa->spa_feat_for_read_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_WRITE, - &spa->spa_feat_for_write_obj) != 0) { + &spa->spa_feat_for_write_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } if (spa_dir_prop(spa, DMU_POOL_FEATURE_DESCRIPTIONS, - &spa->spa_feat_desc_obj) != 0) { + &spa->spa_feat_desc_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2570,7 +2634,8 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta unsup_feat, enabled_feat)) missing_feat_read = B_TRUE; - if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { + if (spa_writeable(spa) || + spa->spa_load_state == SPA_LOAD_TRYIMPORT) { if (!spa_features_check(spa, B_TRUE, unsup_feat, enabled_feat)) { *missing_feat_writep = B_TRUE; @@ -2614,6 +2679,7 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta */ if (missing_feat_read || (*missing_feat_writep && spa_writeable(spa))) { + spa_load_failed(spa, "pool uses unsupported features"); return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); } @@ -2633,6 +2699,9 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta spa->spa_feat_refcount_cache[i] = SPA_FEATURE_DISABLED; } else { + spa_load_failed(spa, "error getting refcount " + "for feature %s [error=%d]", + spa_feature_table[i].fi_guid, error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2641,7 +2710,7 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { if (spa_dir_prop(spa, DMU_POOL_FEATURE_ENABLED_TXG, - &spa->spa_feat_enabled_txg_obj) != 0) + &spa->spa_feat_enabled_txg_obj, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2657,8 +2726,10 @@ spa_ld_load_special_directories(spa_t *spa) spa->spa_is_initializing = B_TRUE; error = dsl_pool_open(spa->spa_dsl_pool); spa->spa_is_initializing = B_FALSE; - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "dsl_pool_open failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } return (0); } @@ -2672,8 +2743,10 @@ spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) nvlist_t *policy = NULL; nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, ZPOOL_CONFIG_HOSTID, &hostid) == 0) { @@ -2734,26 +2807,31 @@ spa_ld_get_props(spa_t *spa) (void) random_get_pseudo_bytes(spa->spa_cksum_salt.zcs_bytes, sizeof (spa->spa_cksum_salt.zcs_bytes)); } else if (error != 0) { + spa_load_failed(spa, "unable to retrieve checksum salt from " + "MOS [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } - if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj) != 0) + if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = bpobj_open(&spa->spa_deferred_bpobj, spa->spa_meta_objset, obj); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "error opening deferred-frees bpobj " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } /* * Load the bit that tells us to use the new accounting function * (raid-z deflation). If we have an older pool, this will not * be present. */ - error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate); + error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = spa_dir_prop(spa, DMU_POOL_CREATION_VERSION, - &spa->spa_creation_version); + &spa->spa_creation_version, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2761,12 +2839,13 @@ spa_ld_get_props(spa_t *spa) * Load the persistent error log. If we have an older pool, this will * not be present. */ - error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last); + error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last, + B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = spa_dir_prop(spa, DMU_POOL_ERRLOG_SCRUB, - &spa->spa_errlog_scrub); + &spa->spa_errlog_scrub, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2774,7 +2853,7 @@ spa_ld_get_props(spa_t *spa) * Load the history object. If we have an older pool, this * will not be present. */ - error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history); + error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2787,11 +2866,13 @@ spa_ld_get_props(spa_t *spa) /* The sentinel is only available in the MOS config. */ nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP, - &spa->spa_all_vdev_zaps); + &spa->spa_all_vdev_zaps, B_FALSE); if (error == ENOENT) { VERIFY(!nvlist_exists(mos_config, @@ -2817,7 +2898,8 @@ spa_ld_get_props(spa_t *spa) spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); - error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); + error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object, + B_FALSE); if (error && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2853,14 +2935,17 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty /* * Load any hot spares for this pool. */ - error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object); + error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object, + B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); if (error == 0 && type != SPA_IMPORT_ASSEMBLE) { ASSERT(spa_version(spa) >= SPA_VERSION_SPARES); if (load_nvlist(spa, spa->spa_spares.sav_object, - &spa->spa_spares.sav_config) != 0) + &spa->spa_spares.sav_config) != 0) { + spa_load_failed(spa, "error loading spares nvlist"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); spa_load_spares(spa); @@ -2873,14 +2958,16 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty * Load any level 2 ARC devices for this pool. */ error = spa_dir_prop(spa, DMU_POOL_L2CACHE, - &spa->spa_l2cache.sav_object); + &spa->spa_l2cache.sav_object, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); if (error == 0 && type != SPA_IMPORT_ASSEMBLE) { ASSERT(spa_version(spa) >= SPA_VERSION_L2CACHE); if (load_nvlist(spa, spa->spa_l2cache.sav_object, - &spa->spa_l2cache.sav_config) != 0) + &spa->spa_l2cache.sav_config) != 0) { + spa_load_failed(spa, "error loading l2cache nvlist"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); spa_load_l2cache(spa); @@ -2893,7 +2980,7 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty } static int -spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t state) +spa_ld_load_vdev_metadata(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -2905,14 +2992,14 @@ spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t * unopenable vdevs so that the normal autoreplace handler can take * over. */ - if (spa->spa_autoreplace && state != SPA_LOAD_TRYIMPORT) { + if (spa->spa_autoreplace && spa->spa_load_state != SPA_LOAD_TRYIMPORT) { spa_check_removed(spa->spa_root_vdev); /* * For the import case, this is done in spa_import(), because * at this point we're using the spare definitions from * the MOS config, not necessarily from the userland config. */ - if (state != SPA_LOAD_IMPORT) { + if (spa->spa_load_state != SPA_LOAD_IMPORT) { spa_aux_check_removed(&spa->spa_spares); spa_aux_check_removed(&spa->spa_l2cache); } @@ -2923,6 +3010,7 @@ spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t */ error = vdev_load(rvd); if (error != 0) { + spa_load_failed(spa, "vdev_load failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -2943,8 +3031,10 @@ spa_ld_load_dedup_tables(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; error = ddt_load(spa); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "ddt_load failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } return (0); } @@ -2954,17 +3044,20 @@ spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, { vdev_t *rvd = spa->spa_root_vdev; - if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa) && - spa_check_logs(spa)) { - *ereport = FM_EREPORT_ZFS_LOG_REPLAY; - return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); + if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa)) { + boolean_t missing = spa_check_logs(spa); + if (missing) { + *ereport = FM_EREPORT_ZFS_LOG_REPLAY; + spa_load_failed(spa, "spa_check_logs failed"); + return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); + } } return (0); } static int -spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t state) +spa_ld_verify_pool_data(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -2973,9 +3066,11 @@ spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t s * We've successfully opened the pool, verify that we're ready * to start pushing transactions. */ - if (state != SPA_LOAD_TRYIMPORT) { + if (spa->spa_load_state != SPA_LOAD_TRYIMPORT) { error = spa_load_verify(spa); if (error != 0) { + spa_load_failed(spa, "spa_load_verify failed " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -3010,8 +3105,7 @@ spa_ld_claim_log_blocks(spa_t *spa) } static void -spa_ld_check_for_config_update(spa_t *spa, spa_load_state_t state, - int64_t config_cache_txg) +spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg) { vdev_t *rvd = spa->spa_root_vdev; int need_update = B_FALSE; @@ -3024,8 +3118,8 @@ spa_ld_check_for_config_update(spa_t *spa, spa_load_st * in-core spa_config and update the disk labels. */ if (config_cache_txg != spa->spa_config_txg || - state == SPA_LOAD_IMPORT || - state == SPA_LOAD_RECOVER || + spa->spa_load_state == SPA_LOAD_IMPORT || + spa->spa_load_state == SPA_LOAD_RECOVER || (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) need_update = B_TRUE; @@ -3057,6 +3151,11 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t int orig_mode = spa->spa_mode; boolean_t missing_feat_write = B_FALSE; + ASSERT(MUTEX_HELD(&spa_namespace_lock)); + + spa->spa_load_state = state; + spa_load_note(spa, "LOADING"); + /* * If this is an untrusted config, first access the pool in read-only * mode. We will then retrieve a trusted copy of the config from the MOS @@ -3068,7 +3167,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t /* * Parse the config provided to create a vdev tree. */ - error = spa_ld_parse_config(spa, pool_guid, config, state, type); + error = spa_ld_parse_config(spa, pool_guid, config, type); if (error != 0) return (error); @@ -3136,7 +3235,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Retrieve the full list of active features from the MOS and check if * they are all supported. */ - error = spa_ld_check_features(spa, state, &missing_feat_write); + error = spa_ld_check_features(spa, &missing_feat_write); if (error != 0) return (error); @@ -3156,6 +3255,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t error = spa_ld_prepare_for_reload(spa, orig_mode); if (error != 0) return (error); + + spa_load_note(spa, "RELOADING"); return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); } @@ -3178,7 +3279,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Load the metadata for all vdevs. Also check if unopenable devices * should be autoreplaced. */ - error = spa_ld_load_vdev_metadata(spa, state); + error = spa_ld_load_vdev_metadata(spa); if (error != 0) return (error); @@ -3211,7 +3312,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * state. When performing an extreme rewind, we verify the whole pool, * which can take a very long time. */ - error = spa_ld_verify_pool_data(spa, state); + error = spa_ld_verify_pool_data(spa); if (error != 0) return (error); @@ -3268,7 +3369,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * next sync, we would update the config stored in vdev labels * and the cachefile (by default /etc/zfs/zpool.cache). */ - spa_ld_check_for_config_update(spa, state, config_cache_txg); + spa_ld_check_for_config_update(spa, config_cache_txg); /* * Check all DTLs to see if anything needs resilvering. @@ -3305,6 +3406,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa_condense_indirect_restart(spa); } + spa_load_note(spa, "LOADED"); + return (0); } @@ -3321,6 +3424,9 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int spa_activate(spa, mode); spa_async_suspend(spa); + spa_load_note(spa, "spa_load_retry: rewind, max txg: %llu", + (u_longlong_t)spa->spa_load_max_txg); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, trust_config)); } @@ -3472,6 +3578,7 @@ spa_open_common(const char *pool, spa_t **spapp, void if (state != SPA_LOAD_RECOVER) spa->spa_last_ubsync_txg = spa->spa_load_txg = 0; + zfs_dbgmsg("spa_open_common: opening %s", pool); error = spa_load_best(spa, state, B_FALSE, policy.zrp_txg, policy.zrp_request); @@ -4477,7 +4584,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_write_cachefile(spa, B_FALSE, B_TRUE); spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); - + zfs_dbgmsg("spa_import: verbatim import of %s", pool); mutex_exit(&spa_namespace_lock); return (0); } @@ -4501,6 +4608,8 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ if (state != SPA_LOAD_RECOVER) spa->spa_last_ubsync_txg = spa->spa_load_txg = 0; + zfs_dbgmsg("spa_import: importing %s%s", pool, + (state == SPA_LOAD_RECOVER) ? " (RECOVERY MODE)" : ""); error = spa_load_best(spa, state, B_TRUE, policy.zrp_txg, policy.zrp_request); @@ -4637,6 +4746,8 @@ spa_tryimport(nvlist_t *tryconfig) mutex_enter(&spa_namespace_lock); spa = spa_add(TRYIMPORT_NAME, tryconfig, NULL); spa_activate(spa, FREAD); + + zfs_dbgmsg("spa_tryimport: importing %s", poolname); /* * Pass off the heavy lifting to spa_load(). Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Feb 21 23:42:30 2018 (r329762) @@ -354,6 +354,34 @@ int spa_asize_inflation = 24; int spa_slop_shift = 5; uint64_t spa_min_slop = 128 * 1024 * 1024; +/*PRINTFLIKE2*/ +void +spa_load_failed(spa_t *spa, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + zfs_dbgmsg("spa_load(%s): FAILED: %s", spa->spa_name, buf); +} + +/*PRINTFLIKE2*/ +void +spa_load_note(spa_t *spa, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + zfs_dbgmsg("spa_load(%s): %s", spa->spa_name, buf); +} + /* * ========================================================================== * SPA config locking Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Feb 21 23:42:30 2018 (r329762) @@ -807,6 +807,8 @@ extern objset_t *spa_meta_objset(spa_t *spa); extern uint64_t spa_deadman_synctime(spa_t *spa); /* Miscellaneous support routines */ +extern void spa_load_failed(spa_t *spa, const char *fmt, ...); +extern void spa_load_note(spa_t *spa, const char *fmt, ...); extern void spa_activate_mos_feature(spa_t *spa, const char *feature, dmu_tx_t *tx); extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Wed Feb 21 23:42:30 2018 (r329762) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_H @@ -47,6 +47,7 @@ typedef enum vdev_dtl_type { extern boolean_t zfs_nocacheflush; +extern void vdev_dbgmsg(vdev_t *vd, const char *fmt, ...); extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); extern boolean_t vdev_uses_zvols(vdev_t *); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Feb 21 23:42:30 2018 (r329762) @@ -77,6 +77,28 @@ int zfs_scrub_limit = 10; */ int metaslabs_per_vdev = 200; +/*PRINTFLIKE2*/ +void +vdev_dbgmsg(vdev_t *vd, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + if (vd->vdev_path != NULL) { + zfs_dbgmsg("%s vdev '%s': %s", vd->vdev_ops->vdev_op_type, + vd->vdev_path, buf); + } else { + zfs_dbgmsg("%s-%llu vdev (guid %llu): %s", + vd->vdev_ops->vdev_op_type, + (u_longlong_t)vd->vdev_id, + (u_longlong_t)vd->vdev_guid, buf); + } +} + /* * Given a vdev type, return the appropriate ops vector. */ @@ -932,14 +954,20 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg) error = dmu_read(mos, vd->vdev_ms_array, m * sizeof (uint64_t), sizeof (uint64_t), &object, DMU_READ_PREFETCH); - if (error) + if (error != 0) { + vdev_dbgmsg(vd, "unable to read the metaslab " + "array [error=%d]", error); return (error); + } } error = metaslab_init(vd->vdev_mg, m, object, txg, &(vd->vdev_ms[m])); - if (error) + if (error != 0) { + vdev_dbgmsg(vd, "metaslab_init failed [error=%d]", + error); return (error); + } } if (txg == 0) @@ -1021,8 +1049,7 @@ vdev_probe_done(zio_t *zio) zio->io_error = 0; } else { ASSERT(zio->io_error != 0); - zfs_dbgmsg("failed probe on vdev %llu", - (longlong_t)vd->vdev_id); + vdev_dbgmsg(vd, "failed probe"); zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE, spa, vd, NULL, 0, 0); zio->io_error = SET_ERROR(ENXIO); @@ -1465,6 +1492,7 @@ vdev_validate(vdev_t *vd, boolean_t strict) if ((label = vdev_label_read_config(vd, txg)) == NULL) { vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, VDEV_AUX_BAD_LABEL); + vdev_dbgmsg(vd, "vdev_validate: failed reading config"); return (0); } @@ -1477,6 +1505,8 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_SPLIT_POOL); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: vdev split into other " + "pool"); return (0); } @@ -1486,6 +1516,10 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: vdev label pool_guid " + "doesn't match config (%llu != %llu)", + (u_longlong_t)guid, + (u_longlong_t)spa_guid(spa)); return (0); } @@ -1515,6 +1549,9 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: config guid doesn't " + "match label guid (%llu != %llu)", + (u_longlong_t)vd->vdev_guid, (u_longlong_t)guid); return (0); } @@ -1523,6 +1560,8 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: '%s' missing", + ZPOOL_CONFIG_POOL_STATE); return (0); } @@ -1534,8 +1573,12 @@ vdev_validate(vdev_t *vd, boolean_t strict) */ if (!(spa->spa_import_flags & ZFS_IMPORT_VERBATIM) && spa_load_state(spa) == SPA_LOAD_OPEN && - state != POOL_STATE_ACTIVE) + state != POOL_STATE_ACTIVE) { + vdev_dbgmsg(vd, "vdev_validate: invalid pool state " + "(%llu) for spa %s", (u_longlong_t)state, + spa->spa_name); return (SET_ERROR(EBADF)); + } /* * If we were able to open and validate a vdev that was @@ -2149,9 +2192,10 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) * the top level so that we update the config. */ if (object != space_map_object(vd->vdev_dtl_sm)) { - zfs_dbgmsg("txg %llu, spa %s, DTL old object %llu, " - "new object %llu", txg, spa_name(spa), object, - space_map_object(vd->vdev_dtl_sm)); + vdev_dbgmsg(vd, "txg %llu, spa %s, DTL old object %llu, " + "new object %llu", (u_longlong_t)txg, spa_name(spa), + (u_longlong_t)object, + (u_longlong_t)space_map_object(vd->vdev_dtl_sm)); vdev_config_dirty(vd->vdev_top); } @@ -2259,8 +2303,13 @@ vdev_load(vdev_t *vd) if (vd->vdev_ashift == 0 || vd->vdev_asize == 0) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: invalid size. ashift=%llu, " + "asize=%llu", (u_longlong_t)vd->vdev_ashift, + (u_longlong_t)vd->vdev_asize); return (SET_ERROR(ENXIO)); } else if ((error = vdev_metaslab_init(vd, 0)) != 0) { + vdev_dbgmsg(vd, "vdev_load: metaslab_init failed " + "[error=%d]", error); vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); return (error); @@ -2273,6 +2322,8 @@ vdev_load(vdev_t *vd) if (vd->vdev_ops->vdev_op_leaf && (error = vdev_dtl_load(vd)) != 0) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: vdev_dtl_load failed " + "[error=%d]", error); return (error); } @@ -2286,6 +2337,9 @@ vdev_load(vdev_t *vd) obsolete_sm_object, 0, vd->vdev_asize, 0))) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: space_map_open failed for " + "obsolete spacemap (obj %llu) [error=%d]", + (u_longlong_t)obsolete_sm_object, error); return (error); } space_map_update(vd->vdev_obsolete_sm); @@ -3647,9 +3701,9 @@ vdev_deadman(vdev_t *vd) fio = avl_first(&vq->vq_active_tree); delta = gethrtime() - fio->io_timestamp; if (delta > spa_deadman_synctime(spa)) { - zfs_dbgmsg("SLOW IO: zio timestamp %lluns, " - "delta %lluns, last io %lluns", - fio->io_timestamp, delta, + vdev_dbgmsg(vd, "SLOW IO: zio timestamp " + "%lluns, delta %lluns, last io %lluns", + fio->io_timestamp, (u_longlong_t)delta, vq->vq_io_complete_ts); fm_panic("I/O to pool '%s' appears to be " "hung.", spa_name(spa)); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Wed Feb 21 23:42:30 2018 (r329762) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ @@ -325,6 +325,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * if (ddi_devid_str_decode(vd->vdev_devid, &dvd->vd_devid, &dvd->vd_minor) != 0) { vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; + vdev_dbgmsg(vd, "vdev_disk_open: invalid " + "vdev_devid '%s'", vd->vdev_devid); return (SET_ERROR(EINVAL)); } } @@ -417,6 +419,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * if (error) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; + vdev_dbgmsg(vd, "vdev_disk_open: failed to open [error=%d]", + error); return (error); } @@ -430,8 +434,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * char *vd_devid; vd_devid = ddi_devid_str_encode(devid, dvd->vd_minor); - zfs_dbgmsg("vdev %s: update devid from %s, " - "to %s", vd->vdev_path, vd->vdev_devid, vd_devid); + vdev_dbgmsg(vd, "vdev_disk_open: update devid from " + "'%s' to '%s'", vd->vdev_devid, vd_devid); spa_strfree(vd->vdev_devid); vd->vdev_devid = spa_strdup(vd_devid); ddi_devid_str_free(vd_devid); @@ -491,6 +495,7 @@ skip_open: */ if (ldi_get_size(dvd->vd_lh, psize) != 0) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; + vdev_dbgmsg(vd, "vdev_disk_open: failed to get size"); return (SET_ERROR(EINVAL)); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Feb 21 23:38:30 2018 (r329761) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Feb 21 23:42:30 2018 (r329762) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Feb 21 23:49:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 511E5F0D47C; Wed, 21 Feb 2018 23:49:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0591679913; Wed, 21 Feb 2018 23:49:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECDC61F5A9; Wed, 21 Feb 2018 23:49:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNnInm086474; Wed, 21 Feb 2018 23:49:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNnImq086473; Wed, 21 Feb 2018 23:49:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802212349.w1LNnImq086473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Feb 2018 23:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329763 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 329763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:49:19 -0000 Author: imp Date: Wed Feb 21 23:49:18 2018 New Revision: 329763 URL: https://svnweb.freebsd.org/changeset/base/329763 Log: Add LOADER_DEBUG regression test Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Wed Feb 21 23:42:30 2018 (r329762) +++ head/tools/boot/universe.sh Wed Feb 21 23:49:18 2018 (r329763) @@ -108,3 +108,12 @@ for i in \ ta=${i##*/} dobuild $ta _.boot.${ta}.firewire.log "MK_LOADER_FIREWIRE=yes" done + +# Build with LOADER_DEBUG, only sparc64 does this. +for i in \ + sparc64/sparc64 \ + ; do + ta=${i##*/} + dobuild $ta _.boot.${ta}.debug.log "LOADER_DEBUG=yes" +done + From owner-svn-src-all@freebsd.org Wed Feb 21 23:49:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49851F0D4B8; Wed, 21 Feb 2018 23:49:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED2B079A24; Wed, 21 Feb 2018 23:49:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7DE51F5AA; Wed, 21 Feb 2018 23:49:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LNnZLf086531; Wed, 21 Feb 2018 23:49:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LNnZrY086530; Wed, 21 Feb 2018 23:49:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802212349.w1LNnZrY086530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 21 Feb 2018 23:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329764 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 329764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 23:49:36 -0000 Author: imp Date: Wed Feb 21 23:49:35 2018 New Revision: 329764 URL: https://svnweb.freebsd.org/changeset/base/329764 Log: Minor formatting nits. Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Wed Feb 21 23:49:18 2018 (r329763) +++ head/sys/cam/nvme/nvme_da.c Wed Feb 21 23:49:35 2018 (r329764) @@ -101,14 +101,14 @@ struct trim_request { }; struct nda_softc { struct cam_iosched_softc *cam_iosched; - int outstanding_cmds; /* Number of active commands */ - int refcount; /* Active xpt_action() calls */ - nda_state state; - nda_flags flags; - nda_quirks quirks; - int unmappedio; - uint32_t nsid; /* Namespace ID for this nda device */ - struct disk *disk; + int outstanding_cmds; /* Number of active commands */ + int refcount; /* Active xpt_action() calls */ + nda_state state; + nda_flags flags; + nda_quirks quirks; + int unmappedio; + uint32_t nsid; /* Namespace ID for this nda device */ + struct disk *disk; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -116,9 +116,9 @@ struct nda_softc { #ifdef CAM_IO_STATS struct sysctl_ctx_list sysctl_stats_ctx; struct sysctl_oid *sysctl_stats_tree; - u_int timeouts; - u_int errors; - u_int invalidations; + u_int timeouts; + u_int errors; + u_int invalidations; #endif }; From owner-svn-src-all@freebsd.org Thu Feb 22 00:03:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59D16F0E83A; Thu, 22 Feb 2018 00:03:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E5E27A68A; Thu, 22 Feb 2018 00:03:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0877E1F8D6; Thu, 22 Feb 2018 00:03:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M03F6D096486; Thu, 22 Feb 2018 00:03:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M03ETl096478; Thu, 22 Feb 2018 00:03:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220003.w1M03ETl096478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329765 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:03:15 -0000 Author: mav Date: Thu Feb 22 00:03:14 2018 New Revision: 329765 URL: https://svnweb.freebsd.org/changeset/base/329765 Log: MFV r329762: 8961 SPA load/import should tell us why it failed illumos/illumos-gate@3ee8c80c747c4aa3f83351a6920f30c411236e1b When we fail to open or import a storage pool, we typically don't get any additional diagnostic information, just "no pool found" or "can not import". While there may be no additional user-consumable information, we should at least make this situation easier to debug/diagnose for developers and support. For example, we could start by using `zfs_dbgmsg()` to log each thing that we try when importing, and which things failed. E.g. "tried uberblock of txg X from label Y of device Z". Also, we could log each of the stages that we go through in `spa_load_impl()`. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 00:03:14 2018 (r329765) @@ -1296,6 +1296,8 @@ spa_unload(spa_t *spa) ASSERT(MUTEX_HELD(&spa_namespace_lock)); + spa_load_note(spa, "UNLOADING"); + /* * Stop TRIM thread. */ @@ -2069,6 +2071,13 @@ spa_load_verify(spa_t *spa) ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); if (spa_load_verify_metadata) { + if (spa->spa_extreme_rewind) { + spa_load_note(spa, "performing a complete scan of the " + "pool since extreme rewind is on. This may take " + "a very long time.\n (spa_load_verify_data=%u, " + "spa_load_verify_metadata=%u)", + spa_load_verify_data, spa_load_verify_metadata); + } error = traverse_pool(spa, spa->spa_verify_min_txg, TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, spa_load_verify_cb, rio); @@ -2121,10 +2130,17 @@ spa_prop_find(spa_t *spa, zpool_prop_t prop, uint64_t * Find a value in the pool directory object. */ static int -spa_dir_prop(spa_t *spa, const char *name, uint64_t *val) +spa_dir_prop(spa_t *spa, const char *name, uint64_t *val, boolean_t log_enoent) { - return (zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, - name, sizeof (uint64_t), 1, val)); + int error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT, + name, sizeof (uint64_t), 1, val); + + if (error != 0 && (error != ENOENT || log_enoent)) { + spa_load_failed(spa, "couldn't get '%s' value in MOS directory " + "[error=%d]", name, error); + } + + return (error); } static int @@ -2316,19 +2332,18 @@ vdev_count_verify_zaps(vdev_t *vd) static int spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type) + spa_import_type_t type) { int error = 0; nvlist_t *nvtree = NULL; int parse; vdev_t *rvd; - ASSERT(MUTEX_HELD(&spa_namespace_lock)); - - spa->spa_load_state = state; - - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) { + spa_load_failed(spa, "invalid config provided: '%s' missing", + ZPOOL_CONFIG_VDEV_TREE); return (SET_ERROR(EINVAL)); + } parse = (type == SPA_IMPORT_EXISTING ? VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); @@ -2353,8 +2368,11 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "unable to parse config [error=%d]", + error); return (error); + } ASSERT(spa->spa_root_vdev == rvd); ASSERT3U(spa->spa_min_ashift, >=, SPA_MINBLOCKSHIFT); @@ -2375,6 +2393,10 @@ spa_ld_open_vdevs(spa_t *spa) spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); + if (error != 0) { + spa_load_failed(spa, "unable to open vdev tree [error=%d]", + error); + } return (error); } @@ -2404,11 +2426,17 @@ spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t ty error = vdev_validate(rvd, trust_config); spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "vdev_validate failed [error=%d]", + error); return (error); + } - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "cannot open vdev tree after " + "invalidating some vdevs"); return (SET_ERROR(ENXIO)); + } } return (0); @@ -2433,14 +2461,20 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, */ if (ub->ub_txg == 0) { nvlist_free(label); + spa_load_failed(spa, "no valid uberblock found"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, ENXIO)); } + spa_load_note(spa, "using uberblock with txg=%llu", + (u_longlong_t)ub->ub_txg); + /* * If the pool has an unsupported version we can't open it. */ if (!SPA_VERSION_IS_SUPPORTED(ub->ub_version)) { nvlist_free(label); + spa_load_failed(spa, "version %llu is not supported", + (u_longlong_t)ub->ub_version); return (spa_vdev_err(rvd, VDEV_AUX_VERSION_NEWER, ENOTSUP)); } @@ -2451,9 +2485,17 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, * If we weren't able to find what's necessary for reading the * MOS in the label, return failure. */ - if (label == NULL || nvlist_lookup_nvlist(label, - ZPOOL_CONFIG_FEATURES_FOR_READ, &features) != 0) { + if (label == NULL) { + spa_load_failed(spa, "label config unavailable"); + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, + ENXIO)); + } + + if (nvlist_lookup_nvlist(label, ZPOOL_CONFIG_FEATURES_FOR_READ, + &features) != 0) { nvlist_free(label); + spa_load_failed(spa, "invalid label: '%s' missing", + ZPOOL_CONFIG_FEATURES_FOR_READ); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, ENXIO)); } @@ -2492,6 +2534,7 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, VERIFY(nvlist_add_nvlist(spa->spa_load_info, ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0); nvlist_free(unsup_feat); + spa_load_failed(spa, "some features are unsupported"); return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); } @@ -2508,8 +2551,13 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, */ if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &children) != 0 && trust_config && type != SPA_IMPORT_ASSEMBLE && - rvd->vdev_guid_sum != ub->ub_guid_sum) + rvd->vdev_guid_sum != ub->ub_guid_sum) { + spa_load_failed(spa, "guid sum in config doesn't match guid " + "sum in uberblock (%llu != %llu)", + (u_longlong_t)rvd->vdev_guid_sum, + (u_longlong_t)ub->ub_guid_sum); return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); + } if (type != SPA_IMPORT_ASSEMBLE && spa->spa_config_splitting) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); @@ -2541,8 +2589,11 @@ spa_ld_open_rootbp(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; error = dsl_pool_init(spa, spa->spa_first_txg, &spa->spa_dsl_pool); - if (error) + if (error != 0) { + spa_load_failed(spa, "unable to open rootbp in dsl_pool_init " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset; return (0); @@ -2553,7 +2604,8 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t { vdev_t *rvd = spa->spa_root_vdev; - if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0) + if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object, B_TRUE) + != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* @@ -2565,11 +2617,16 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t */ if (type != SPA_IMPORT_ASSEMBLE) { nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) + != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } if (!spa_config_valid(spa, mos_config)) { nvlist_free(mos_config); + spa_load_failed(spa, "mismatch between config provided " + "and config stored in MOS"); return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); } @@ -2580,8 +2637,10 @@ spa_ld_validate_config(spa_t *spa, spa_import_type_t t * root vdev. If it can't be opened, it indicates one or * more toplevel vdevs are faulted. */ - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "some top vdevs are unavailable"); return (SET_ERROR(ENXIO)); + } } return (0); @@ -2597,14 +2656,20 @@ spa_ld_open_indirect_vdev_metadata(spa_t *spa) * Everything that we read before spa_remove_init() must be stored * on concreted vdevs. Therefore we do this as early as possible. */ - if (spa_remove_init(spa) != 0) + error = spa_remove_init(spa); + if (error != 0) { + spa_load_failed(spa, "spa_remove_init failed [error=%d]", + error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } /* * Retrieve information needed to condense indirect vdev mappings. */ error = spa_condense_init(spa); if (error != 0) { + spa_load_failed(spa, "spa_condense_init failed [error=%d]", + error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -2612,8 +2677,7 @@ spa_ld_open_indirect_vdev_metadata(spa_t *spa) } static int -spa_ld_check_features(spa_t *spa, spa_load_state_t state, - boolean_t *missing_feat_writep) +spa_ld_check_features(spa_t *spa, boolean_t *missing_feat_writep) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -2623,17 +2687,17 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta nvlist_t *unsup_feat, *enabled_feat; if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ, - &spa->spa_feat_for_read_obj) != 0) { + &spa->spa_feat_for_read_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_WRITE, - &spa->spa_feat_for_write_obj) != 0) { + &spa->spa_feat_for_write_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } if (spa_dir_prop(spa, DMU_POOL_FEATURE_DESCRIPTIONS, - &spa->spa_feat_desc_obj) != 0) { + &spa->spa_feat_desc_obj, B_TRUE) != 0) { return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2644,7 +2708,8 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta unsup_feat, enabled_feat)) missing_feat_read = B_TRUE; - if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { + if (spa_writeable(spa) || + spa->spa_load_state == SPA_LOAD_TRYIMPORT) { if (!spa_features_check(spa, B_TRUE, unsup_feat, enabled_feat)) { *missing_feat_writep = B_TRUE; @@ -2688,6 +2753,7 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta */ if (missing_feat_read || (*missing_feat_writep && spa_writeable(spa))) { + spa_load_failed(spa, "pool uses unsupported features"); return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP)); } @@ -2707,6 +2773,9 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta spa->spa_feat_refcount_cache[i] = SPA_FEATURE_DISABLED; } else { + spa_load_failed(spa, "error getting refcount " + "for feature %s [error=%d]", + spa_feature_table[i].fi_guid, error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2715,7 +2784,7 @@ spa_ld_check_features(spa_t *spa, spa_load_state_t sta if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { if (spa_dir_prop(spa, DMU_POOL_FEATURE_ENABLED_TXG, - &spa->spa_feat_enabled_txg_obj) != 0) + &spa->spa_feat_enabled_txg_obj, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } @@ -2731,8 +2800,10 @@ spa_ld_load_special_directories(spa_t *spa) spa->spa_is_initializing = B_TRUE; error = dsl_pool_open(spa->spa_dsl_pool); spa->spa_is_initializing = B_FALSE; - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "dsl_pool_open failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } return (0); } @@ -2746,8 +2817,10 @@ spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) nvlist_t *policy = NULL; nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, ZPOOL_CONFIG_HOSTID, &hostid) == 0) { @@ -2808,26 +2881,31 @@ spa_ld_get_props(spa_t *spa) (void) random_get_pseudo_bytes(spa->spa_cksum_salt.zcs_bytes, sizeof (spa->spa_cksum_salt.zcs_bytes)); } else if (error != 0) { + spa_load_failed(spa, "unable to retrieve checksum salt from " + "MOS [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } - if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj) != 0) + if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = bpobj_open(&spa->spa_deferred_bpobj, spa->spa_meta_objset, obj); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "error opening deferred-frees bpobj " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } /* * Load the bit that tells us to use the new accounting function * (raid-z deflation). If we have an older pool, this will not * be present. */ - error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate); + error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = spa_dir_prop(spa, DMU_POOL_CREATION_VERSION, - &spa->spa_creation_version); + &spa->spa_creation_version, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2835,12 +2913,13 @@ spa_ld_get_props(spa_t *spa) * Load the persistent error log. If we have an older pool, this will * not be present. */ - error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last); + error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last, + B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); error = spa_dir_prop(spa, DMU_POOL_ERRLOG_SCRUB, - &spa->spa_errlog_scrub); + &spa->spa_errlog_scrub, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2848,7 +2927,7 @@ spa_ld_get_props(spa_t *spa) * Load the history object. If we have an older pool, this * will not be present. */ - error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history); + error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2861,11 +2940,13 @@ spa_ld_get_props(spa_t *spa) /* The sentinel is only available in the MOS config. */ nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP, - &spa->spa_all_vdev_zaps); + &spa->spa_all_vdev_zaps, B_FALSE); if (error == ENOENT) { VERIFY(!nvlist_exists(mos_config, @@ -2891,7 +2972,8 @@ spa_ld_get_props(spa_t *spa) spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION); - error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object); + error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object, + B_FALSE); if (error && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); @@ -2927,14 +3009,17 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty /* * Load any hot spares for this pool. */ - error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object); + error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object, + B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); if (error == 0 && type != SPA_IMPORT_ASSEMBLE) { ASSERT(spa_version(spa) >= SPA_VERSION_SPARES); if (load_nvlist(spa, spa->spa_spares.sav_object, - &spa->spa_spares.sav_config) != 0) + &spa->spa_spares.sav_config) != 0) { + spa_load_failed(spa, "error loading spares nvlist"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); spa_load_spares(spa); @@ -2947,14 +3032,16 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty * Load any level 2 ARC devices for this pool. */ error = spa_dir_prop(spa, DMU_POOL_L2CACHE, - &spa->spa_l2cache.sav_object); + &spa->spa_l2cache.sav_object, B_FALSE); if (error != 0 && error != ENOENT) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); if (error == 0 && type != SPA_IMPORT_ASSEMBLE) { ASSERT(spa_version(spa) >= SPA_VERSION_L2CACHE); if (load_nvlist(spa, spa->spa_l2cache.sav_object, - &spa->spa_l2cache.sav_config) != 0) + &spa->spa_l2cache.sav_config) != 0) { + spa_load_failed(spa, "error loading l2cache nvlist"); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); spa_load_l2cache(spa); @@ -2967,7 +3054,7 @@ spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t ty } static int -spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t state) +spa_ld_load_vdev_metadata(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -2979,14 +3066,14 @@ spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t * unopenable vdevs so that the normal autoreplace handler can take * over. */ - if (spa->spa_autoreplace && state != SPA_LOAD_TRYIMPORT) { + if (spa->spa_autoreplace && spa->spa_load_state != SPA_LOAD_TRYIMPORT) { spa_check_removed(spa->spa_root_vdev); /* * For the import case, this is done in spa_import(), because * at this point we're using the spare definitions from * the MOS config, not necessarily from the userland config. */ - if (state != SPA_LOAD_IMPORT) { + if (spa->spa_load_state != SPA_LOAD_IMPORT) { spa_aux_check_removed(&spa->spa_spares); spa_aux_check_removed(&spa->spa_l2cache); } @@ -2997,6 +3084,7 @@ spa_ld_load_vdev_metadata(spa_t *spa, spa_load_state_t */ error = vdev_load(rvd); if (error != 0) { + spa_load_failed(spa, "vdev_load failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -3017,8 +3105,10 @@ spa_ld_load_dedup_tables(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; error = ddt_load(spa); - if (error != 0) + if (error != 0) { + spa_load_failed(spa, "ddt_load failed [error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } return (0); } @@ -3028,17 +3118,20 @@ spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, { vdev_t *rvd = spa->spa_root_vdev; - if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa) && - spa_check_logs(spa)) { - *ereport = FM_EREPORT_ZFS_LOG_REPLAY; - return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); + if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa)) { + boolean_t missing = spa_check_logs(spa); + if (missing) { + *ereport = FM_EREPORT_ZFS_LOG_REPLAY; + spa_load_failed(spa, "spa_check_logs failed"); + return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); + } } return (0); } static int -spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t state) +spa_ld_verify_pool_data(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; @@ -3047,9 +3140,11 @@ spa_ld_verify_pool_data(spa_t *spa, spa_load_state_t s * We've successfully opened the pool, verify that we're ready * to start pushing transactions. */ - if (state != SPA_LOAD_TRYIMPORT) { + if (spa->spa_load_state != SPA_LOAD_TRYIMPORT) { error = spa_load_verify(spa); if (error != 0) { + spa_load_failed(spa, "spa_load_verify failed " + "[error=%d]", error); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error)); } @@ -3084,8 +3179,7 @@ spa_ld_claim_log_blocks(spa_t *spa) } static void -spa_ld_check_for_config_update(spa_t *spa, spa_load_state_t state, - int64_t config_cache_txg) +spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg) { vdev_t *rvd = spa->spa_root_vdev; int need_update = B_FALSE; @@ -3098,8 +3192,8 @@ spa_ld_check_for_config_update(spa_t *spa, spa_load_st * in-core spa_config and update the disk labels. */ if (config_cache_txg != spa->spa_config_txg || - state == SPA_LOAD_IMPORT || - state == SPA_LOAD_RECOVER || + spa->spa_load_state == SPA_LOAD_IMPORT || + spa->spa_load_state == SPA_LOAD_RECOVER || (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) need_update = B_TRUE; @@ -3131,6 +3225,11 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t int orig_mode = spa->spa_mode; boolean_t missing_feat_write = B_FALSE; + ASSERT(MUTEX_HELD(&spa_namespace_lock)); + + spa->spa_load_state = state; + spa_load_note(spa, "LOADING"); + /* * If this is an untrusted config, first access the pool in read-only * mode. We will then retrieve a trusted copy of the config from the MOS @@ -3142,7 +3241,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t /* * Parse the config provided to create a vdev tree. */ - error = spa_ld_parse_config(spa, pool_guid, config, state, type); + error = spa_ld_parse_config(spa, pool_guid, config, type); if (error != 0) return (error); @@ -3210,7 +3309,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Retrieve the full list of active features from the MOS and check if * they are all supported. */ - error = spa_ld_check_features(spa, state, &missing_feat_write); + error = spa_ld_check_features(spa, &missing_feat_write); if (error != 0) return (error); @@ -3230,6 +3329,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t error = spa_ld_prepare_for_reload(spa, orig_mode); if (error != 0) return (error); + + spa_load_note(spa, "RELOADING"); return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE)); } @@ -3252,7 +3353,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * Load the metadata for all vdevs. Also check if unopenable devices * should be autoreplaced. */ - error = spa_ld_load_vdev_metadata(spa, state); + error = spa_ld_load_vdev_metadata(spa); if (error != 0) return (error); @@ -3285,7 +3386,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * state. When performing an extreme rewind, we verify the whole pool, * which can take a very long time. */ - error = spa_ld_verify_pool_data(spa, state); + error = spa_ld_verify_pool_data(spa); if (error != 0) return (error); @@ -3342,7 +3443,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t * next sync, we would update the config stored in vdev labels * and the cachefile (by default /etc/zfs/zpool.cache). */ - spa_ld_check_for_config_update(spa, state, config_cache_txg); + spa_ld_check_for_config_update(spa, config_cache_txg); /* * Check all DTLs to see if anything needs resilvering. @@ -3379,6 +3480,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa_condense_indirect_restart(spa); } + spa_load_note(spa, "LOADED"); + return (0); } @@ -3395,6 +3498,9 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int spa_activate(spa, mode); spa_async_suspend(spa); + spa_load_note(spa, "spa_load_retry: rewind, max txg: %llu", + (u_longlong_t)spa->spa_load_max_txg); + return (spa_load(spa, state, SPA_IMPORT_EXISTING, trust_config)); } @@ -3549,6 +3655,7 @@ spa_open_common(const char *pool, spa_t **spapp, void if (state != SPA_LOAD_RECOVER) spa->spa_last_ubsync_txg = spa->spa_load_txg = 0; + zfs_dbgmsg("spa_open_common: opening %s", pool); error = spa_load_best(spa, state, B_FALSE, policy.zrp_txg, policy.zrp_request); @@ -4771,7 +4878,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_write_cachefile(spa, B_FALSE, B_TRUE); spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); - + zfs_dbgmsg("spa_import: verbatim import of %s", pool); mutex_exit(&spa_namespace_lock); return (0); } @@ -4795,6 +4902,8 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ if (state != SPA_LOAD_RECOVER) spa->spa_last_ubsync_txg = spa->spa_load_txg = 0; + zfs_dbgmsg("spa_import: importing %s%s", pool, + (state == SPA_LOAD_RECOVER) ? " (RECOVERY MODE)" : ""); error = spa_load_best(spa, state, B_TRUE, policy.zrp_txg, policy.zrp_request); @@ -4936,6 +5045,8 @@ spa_tryimport(nvlist_t *tryconfig) mutex_enter(&spa_namespace_lock); spa = spa_add(TRYIMPORT_NAME, tryconfig, NULL); spa_activate(spa, FREAD); + + zfs_dbgmsg("spa_tryimport: importing %s", poolname); /* * Pass off the heavy lifting to spa_load(). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Feb 22 00:03:14 2018 (r329765) @@ -431,6 +431,34 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG &spa_min_slop, 0, "Minimal value of reserved space"); +/*PRINTFLIKE2*/ +void +spa_load_failed(spa_t *spa, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + zfs_dbgmsg("spa_load(%s): FAILED: %s", spa->spa_name, buf); +} + +/*PRINTFLIKE2*/ +void +spa_load_note(spa_t *spa, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + zfs_dbgmsg("spa_load(%s): %s", spa->spa_name, buf); +} + /* * ========================================================================== * SPA config locking Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Feb 22 00:03:14 2018 (r329765) @@ -827,6 +827,8 @@ extern objset_t *spa_meta_objset(spa_t *spa); extern uint64_t spa_deadman_synctime(spa_t *spa); /* Miscellaneous support routines */ +extern void spa_load_failed(spa_t *spa, const char *fmt, ...); +extern void spa_load_note(spa_t *spa, const char *fmt, ...); extern void spa_activate_mos_feature(spa_t *spa, const char *feature, dmu_tx_t *tx); extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Thu Feb 22 00:03:14 2018 (r329765) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_H @@ -48,6 +48,7 @@ typedef enum vdev_dtl_type { extern boolean_t zfs_nocacheflush; extern boolean_t zfs_trim_enabled; +extern void vdev_dbgmsg(vdev_t *vd, const char *fmt, ...); extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); extern boolean_t vdev_uses_zvols(vdev_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Feb 22 00:03:14 2018 (r329765) @@ -171,6 +171,28 @@ SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, metaslabs_per_vdev &metaslabs_per_vdev, 0, "When a vdev is added, how many metaslabs the vdev should be divided into"); +/*PRINTFLIKE2*/ +void +vdev_dbgmsg(vdev_t *vd, const char *fmt, ...) +{ + va_list adx; + char buf[256]; + + va_start(adx, fmt); + (void) vsnprintf(buf, sizeof (buf), fmt, adx); + va_end(adx); + + if (vd->vdev_path != NULL) { + zfs_dbgmsg("%s vdev '%s': %s", vd->vdev_ops->vdev_op_type, + vd->vdev_path, buf); + } else { + zfs_dbgmsg("%s-%llu vdev (guid %llu): %s", + vd->vdev_ops->vdev_op_type, + (u_longlong_t)vd->vdev_id, + (u_longlong_t)vd->vdev_guid, buf); + } +} + /* * Given a vdev type, return the appropriate ops vector. */ @@ -1030,14 +1052,20 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg) error = dmu_read(mos, vd->vdev_ms_array, m * sizeof (uint64_t), sizeof (uint64_t), &object, DMU_READ_PREFETCH); - if (error) + if (error != 0) { + vdev_dbgmsg(vd, "unable to read the metaslab " + "array [error=%d]", error); return (error); + } } error = metaslab_init(vd->vdev_mg, m, object, txg, &(vd->vdev_ms[m])); - if (error) + if (error != 0) { + vdev_dbgmsg(vd, "metaslab_init failed [error=%d]", + error); return (error); + } } if (txg == 0) @@ -1119,8 +1147,7 @@ vdev_probe_done(zio_t *zio) zio->io_error = 0; } else { ASSERT(zio->io_error != 0); - zfs_dbgmsg("failed probe on vdev %llu", - (longlong_t)vd->vdev_id); + vdev_dbgmsg(vd, "failed probe"); zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE, spa, vd, NULL, 0, 0); zio->io_error = SET_ERROR(ENXIO); @@ -1576,6 +1603,7 @@ vdev_validate(vdev_t *vd, boolean_t strict) if ((label = vdev_label_read_config(vd, txg)) == NULL) { vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, VDEV_AUX_BAD_LABEL); + vdev_dbgmsg(vd, "vdev_validate: failed reading config"); return (0); } @@ -1588,6 +1616,8 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_SPLIT_POOL); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: vdev split into other " + "pool"); return (0); } @@ -1597,6 +1627,10 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: vdev label pool_guid " + "doesn't match config (%llu != %llu)", + (u_longlong_t)guid, + (u_longlong_t)spa_guid(spa)); return (0); } @@ -1626,6 +1660,9 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: config guid doesn't " + "match label guid (%llu != %llu)", + (u_longlong_t)vd->vdev_guid, (u_longlong_t)guid); return (0); } @@ -1634,6 +1671,8 @@ vdev_validate(vdev_t *vd, boolean_t strict) vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); + vdev_dbgmsg(vd, "vdev_validate: '%s' missing", + ZPOOL_CONFIG_POOL_STATE); return (0); } @@ -1645,8 +1684,12 @@ vdev_validate(vdev_t *vd, boolean_t strict) */ if (!(spa->spa_import_flags & ZFS_IMPORT_VERBATIM) && spa_load_state(spa) == SPA_LOAD_OPEN && - state != POOL_STATE_ACTIVE) + state != POOL_STATE_ACTIVE) { + vdev_dbgmsg(vd, "vdev_validate: invalid pool state " + "(%llu) for spa %s", (u_longlong_t)state, + spa->spa_name); return (SET_ERROR(EBADF)); + } /* * If we were able to open and validate a vdev that was @@ -2294,9 +2337,10 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) * the top level so that we update the config. */ if (object != space_map_object(vd->vdev_dtl_sm)) { - zfs_dbgmsg("txg %llu, spa %s, DTL old object %llu, " - "new object %llu", txg, spa_name(spa), object, - space_map_object(vd->vdev_dtl_sm)); + vdev_dbgmsg(vd, "txg %llu, spa %s, DTL old object %llu, " + "new object %llu", (u_longlong_t)txg, spa_name(spa), + (u_longlong_t)object, + (u_longlong_t)space_map_object(vd->vdev_dtl_sm)); vdev_config_dirty(vd->vdev_top); } @@ -2404,8 +2448,13 @@ vdev_load(vdev_t *vd) if (vd->vdev_ashift == 0 || vd->vdev_asize == 0) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: invalid size. ashift=%llu, " + "asize=%llu", (u_longlong_t)vd->vdev_ashift, + (u_longlong_t)vd->vdev_asize); return (SET_ERROR(ENXIO)); } else if ((error = vdev_metaslab_init(vd, 0)) != 0) { + vdev_dbgmsg(vd, "vdev_load: metaslab_init failed " + "[error=%d]", error); vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); return (error); @@ -2418,6 +2467,8 @@ vdev_load(vdev_t *vd) if (vd->vdev_ops->vdev_op_leaf && (error = vdev_dtl_load(vd)) != 0) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: vdev_dtl_load failed " + "[error=%d]", error); return (error); } @@ -2431,6 +2482,9 @@ vdev_load(vdev_t *vd) obsolete_sm_object, 0, vd->vdev_asize, 0))) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); + vdev_dbgmsg(vd, "vdev_load: space_map_open failed for " + "obsolete spacemap (obj %llu) [error=%d]", + (u_longlong_t)obsolete_sm_object, error); return (error); } space_map_update(vd->vdev_obsolete_sm); @@ -3805,9 +3859,9 @@ vdev_deadman(vdev_t *vd) fio = avl_first(&vq->vq_active_tree); delta = gethrtime() - fio->io_timestamp; if (delta > spa_deadman_synctime(spa)) { - zfs_dbgmsg("SLOW IO: zio timestamp %lluns, " - "delta %lluns, last io %lluns", - fio->io_timestamp, delta, + vdev_dbgmsg(vd, "SLOW IO: zio timestamp " + "%lluns, delta %lluns, last io %lluns", + fio->io_timestamp, (u_longlong_t)delta, vq->vq_io_complete_ts); fm_panic("I/O to pool '%s' appears to be " "hung on vdev guid %llu at '%s'.", Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Thu Feb 22 00:03:14 2018 (r329765) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ @@ -325,6 +325,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * if (ddi_devid_str_decode(vd->vdev_devid, &dvd->vd_devid, &dvd->vd_minor) != 0) { vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; + vdev_dbgmsg(vd, "vdev_disk_open: invalid " + "vdev_devid '%s'", vd->vdev_devid); return (SET_ERROR(EINVAL)); } } @@ -417,6 +419,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * if (error) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; + vdev_dbgmsg(vd, "vdev_disk_open: failed to open [error=%d]", + error); return (error); } @@ -430,8 +434,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t * char *vd_devid; vd_devid = ddi_devid_str_encode(devid, dvd->vd_minor); - zfs_dbgmsg("vdev %s: update devid from %s, " - "to %s", vd->vdev_path, vd->vdev_devid, vd_devid); + vdev_dbgmsg(vd, "vdev_disk_open: update devid from " + "'%s' to '%s'", vd->vdev_devid, vd_devid); spa_strfree(vd->vdev_devid); vd->vdev_devid = spa_strdup(vd_devid); ddi_devid_str_free(vd_devid); @@ -491,6 +495,7 @@ skip_open: */ if (ldi_get_size(dvd->vd_lh, psize) != 0) { vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; + vdev_dbgmsg(vd, "vdev_disk_open: failed to get size"); return (SET_ERROR(EINVAL)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Feb 21 23:49:35 2018 (r329764) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Feb 22 00:03:14 2018 (r329765) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 00:09:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67362F0F165; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19F497AB20; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10B441F8D8; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M09Fwd096716; Thu, 22 Feb 2018 00:09:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M09FkI096715; Thu, 22 Feb 2018 00:09:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220009.w1M09FkI096715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329766 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 329766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:09:16 -0000 Author: mav Date: Thu Feb 22 00:09:15 2018 New Revision: 329766 URL: https://svnweb.freebsd.org/changeset/base/329766 Log: 8962 zdb should work on non-idle pools illumos/illumos-gate@e144c4e6c90e7d4dccaad6db660ee42b6e7ba04f Currently `zdb` consistently fails to examine non-idle pools as it fails during the `spa_load()` process. The main problem seems to be that `spa_load_verify()` fails as can be seen below: $ sudo zdb -d -G dcenter zdb: can't open 'dcenter': I/O error ZFS_DBGMSG(zdb): spa_open_common: opening dcenter spa_load(dcenter): LOADING disk vdev '/dev/dsk/c4t11d0s0': best uberblock found for spa dcenter. txg 40824950 spa_load(dcenter): using uberblock with txg=40824950 spa_load(dcenter): UNLOADING spa_load(dcenter): RELOADING spa_load(dcenter): LOADING disk vdev '/dev/dsk/c3t10d0s0': best uberblock found for spa dcenter. txg 40824952 spa_load(dcenter): using uberblock with txg=40824952 spa_load(dcenter): FAILED: spa_load_verify failed [error=5] spa_load(dcenter): UNLOADING This change makes `spa_load_verify()` a dryrun when ran from `zdb`. This is done by creating a global flag in zfs and then setting it in `zdb`. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 00:03:14 2018 (r329765) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 00:09:15 2018 (r329766) @@ -165,6 +165,12 @@ boolean_t spa_create_process = B_TRUE; /* no process = extern int zfs_sync_pass_deferred_free; /* + * Report any spa_load_verify errors found, but do not fail spa_load. + * This is used by zdb to analyze non-idle pools. + */ +boolean_t spa_load_verify_dryrun = B_FALSE; + +/* * This (illegal) pool name is used when temporarily importing a spa_t in order * to get the vdev stats associated with the imported devices. */ @@ -2014,8 +2020,15 @@ spa_load_verify(spa_t *spa) spa->spa_load_meta_errors = sle.sle_meta_count; spa->spa_load_data_errors = sle.sle_data_count; - if (!error && sle.sle_meta_count <= policy.zrp_maxmeta && - sle.sle_data_count <= policy.zrp_maxdata) { + if (sle.sle_meta_count != 0 || sle.sle_data_count != 0) { + spa_load_note(spa, "spa_load_verify found %llu metadata errors " + "and %llu data errors", (u_longlong_t)sle.sle_meta_count, + (u_longlong_t)sle.sle_data_count); + } + + if (spa_load_verify_dryrun || + (!error && sle.sle_meta_count <= policy.zrp_maxmeta && + sle.sle_data_count <= policy.zrp_maxdata)) { int64_t loss = 0; verify_ok = B_TRUE; @@ -2032,6 +2045,9 @@ spa_load_verify(spa_t *spa) } else { spa->spa_load_max_txg = spa->spa_uberblock.ub_txg; } + + if (spa_load_verify_dryrun) + return (0); if (error) { if (error != ENXIO && error != EIO) From owner-svn-src-all@freebsd.org Thu Feb 22 00:09:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97237F0F166; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4559C7AB21; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FCB41F8D9; Thu, 22 Feb 2018 00:09:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M09GTS096722; Thu, 22 Feb 2018 00:09:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M09GZ0096721; Thu, 22 Feb 2018 00:09:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220009.w1M09GZ0096721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329766 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 329766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:09:16 -0000 Author: mav Date: Thu Feb 22 00:09:15 2018 New Revision: 329766 URL: https://svnweb.freebsd.org/changeset/base/329766 Log: 8962 zdb should work on non-idle pools illumos/illumos-gate@e144c4e6c90e7d4dccaad6db660ee42b6e7ba04f Currently `zdb` consistently fails to examine non-idle pools as it fails during the `spa_load()` process. The main problem seems to be that `spa_load_verify()` fails as can be seen below: $ sudo zdb -d -G dcenter zdb: can't open 'dcenter': I/O error ZFS_DBGMSG(zdb): spa_open_common: opening dcenter spa_load(dcenter): LOADING disk vdev '/dev/dsk/c4t11d0s0': best uberblock found for spa dcenter. txg 40824950 spa_load(dcenter): using uberblock with txg=40824950 spa_load(dcenter): UNLOADING spa_load(dcenter): RELOADING spa_load(dcenter): LOADING disk vdev '/dev/dsk/c3t10d0s0': best uberblock found for spa dcenter. txg 40824952 spa_load(dcenter): using uberblock with txg=40824952 spa_load(dcenter): FAILED: spa_load_verify failed [error=5] spa_load(dcenter): UNLOADING This change makes `spa_load_verify()` a dryrun when ran from `zdb`. This is done by creating a global flag in zfs and then setting it in `zdb`. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: vendor/illumos/dist/cmd/zdb/zdb.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Thu Feb 22 00:03:14 2018 (r329765) +++ vendor/illumos/dist/cmd/zdb/zdb.c Thu Feb 22 00:09:15 2018 (r329766) @@ -89,12 +89,14 @@ extern boolean_t zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; extern int zfs_vdev_async_read_max_active; extern int aok; +extern boolean_t spa_load_verify_dryrun; #else int reference_tracking_enable; boolean_t zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; int aok; +boolean_t spa_load_verify_dryrun; #endif static const char cmdname[] = "zdb"; @@ -4542,6 +4544,12 @@ main(int argc, char **argv) * Disable reference tracking for better performance. */ reference_tracking_enable = B_FALSE; + + /* + * Do not fail spa_load when spa_load_verify fails. This is needed + * to load non-idle pools. + */ + spa_load_verify_dryrun = B_TRUE; kernel_init(FREAD); g_zfs = libzfs_init(); From owner-svn-src-all@freebsd.org Thu Feb 22 00:36:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB10EF10FFE; Thu, 22 Feb 2018 00:36:13 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78A217BA8E; Thu, 22 Feb 2018 00:36:13 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DBFA1FDB8; Thu, 22 Feb 2018 00:36:13 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0aDdT011453; Thu, 22 Feb 2018 00:36:13 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0aCBe011443; Thu, 22 Feb 2018 00:36:12 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201802220036.w1M0aCBe011443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Thu, 22 Feb 2018 00:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329767 - in stable/11: share/man/man4 stand/forth sys/amd64/conf sys/conf sys/dev/amdsmn sys/dev/amdtemp sys/modules sys/modules/amdsmn X-SVN-Group: stable-11 X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: in stable/11: share/man/man4 stand/forth sys/amd64/conf sys/conf sys/dev/amdsmn sys/dev/amdtemp sys/modules sys/modules/amdsmn X-SVN-Commit-Revision: 329767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:36:14 -0000 Author: truckman Date: Thu Feb 22 00:36:12 2018 New Revision: 329767 URL: https://svnweb.freebsd.org/changeset/base/329767 Log: MFC r323067, r323184, r323185, r323195, r323196 (by cem) ------------------------------------------------------------------------ r323067 | cem | 2017-08-31 11:39:18 -0700 (Thu, 31 Aug 2017) | 4 lines amdtemp.4: Update BKDG URL to current location Sponsored by: Dell EMC Isilon ------------------------------------------------------------------------ r323184 | cem | 2017-09-05 08:13:41 -0700 (Tue, 05 Sep 2017) | 10 lines Add smn(4) driver for AMD System Management Network AMD Family 17h CPUs have an internal network used to communicate between the host CPU and the PSP and SMU coprocessors. It exposes a simple 32-bit register space. Reviewed by: avg (no +1), mjoras, truckman Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12217 ------------------------------------------------------------------------ r323185 | cem | 2017-09-05 08:19:14 -0700 (Tue, 05 Sep 2017) | 13 lines amdtemp(4): Add support for Family 17h temperature sensor The sensor value is formatted similarly to previous models (same bitfield sizes, same units), but must be read off of the internal System Management Network (SMN) from the System Management Unit (SMU) co-processor. PR: 218264 Reported and tested by: Nils Beyer Reviewed by: avg (no +1), mjoras, truckman Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12217 ------------------------------------------------------------------------ r323195 | cem | 2017-09-05 13:35:25 -0700 (Tue, 05 Sep 2017) | 8 lines amdtemp(4): Do not probe not matching hostbridges Some systems have hostbs that do not match our PCI device id criteria. Detect and ignore these devices in probe. PR: 218264 Sponsored by: Dell EMC Isilon ------------------------------------------------------------------------ r323196 | cem | 2017-09-05 14:00:33 -0700 (Tue, 05 Sep 2017) | 8 lines amdsmn(4): Do not probe not matching hostbridges Similar to r323195, but for amdsmn(4) driver (which borrowed some design). Ignore hostbs that do not match our PCI device id criteria. Sponsored by: Dell EMC Isilon PR: 218264 Differential Revision: https://reviews.freebsd.org/D12217 Added: stable/11/share/man/man4/amdsmn.4 - copied unchanged from r323184, head/share/man/man4/amdsmn.4 stable/11/sys/dev/amdsmn/ - copied from r323184, head/sys/dev/amdsmn/ stable/11/sys/modules/amdsmn/ - copied from r323184, head/sys/modules/amdsmn/ Modified: stable/11/share/man/man4/Makefile stable/11/share/man/man4/amdtemp.4 stable/11/stand/forth/loader.conf stable/11/sys/amd64/conf/NOTES stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/amdsmn/amdsmn.c stable/11/sys/dev/amdtemp/amdtemp.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/share/man/man4/Makefile Thu Feb 22 00:36:12 2018 (r329767) @@ -46,6 +46,7 @@ MAN= aac.4 \ amdpm.4 \ ${_amdsbwd.4} \ ${_amdsmb.4} \ + ${_amdsmn.4} \ ${_amdtemp.4} \ ${_bxe.4} \ amr.4 \ @@ -792,6 +793,7 @@ _attimer.4= attimer.4 _aibs.4= aibs.4 _amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 +_amdsmn.4= amdsmn.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _bxe.4= bxe.4 Copied: stable/11/share/man/man4/amdsmn.4 (from r323184, head/share/man/man4/amdsmn.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/amdsmn.4 Thu Feb 22 00:36:12 2018 (r329767, copy of r323184, head/share/man/man4/amdsmn.4) @@ -0,0 +1,64 @@ +.\"- +.\" Copyright (c) 2017 Conrad Meyer +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 5, 2017 +.Dt AMDSMN 4 +.Os +.Sh NAME +.Nm amdsmn +.Nd device driver for +.Tn AMD +processor System Management Network +.Sh SYNOPSIS +To compile this driver into the kernel, place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device amdsmn" +.Ed +.Pp +Alternatively, to load the driver as a module at boot time, place the +following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +amdsmn_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for resources on the System Management Network bus +in +.Tn AMD +Family 17h processors. +.Sh SEE ALSO +.Xr loader 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An Conrad Meyer Aq Mt cem@FreeBSD.org Modified: stable/11/share/man/man4/amdtemp.4 ============================================================================== --- stable/11/share/man/man4/amdtemp.4 Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/share/man/man4/amdtemp.4 Thu Feb 22 00:36:12 2018 (r329767) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2015 +.Dd September 5, 2017 .Dt AMDTEMP 4 .Os .Sh NAME @@ -53,7 +53,7 @@ The driver provides support for the on-die digital thermal sensor present in .Tn AMD -Family 0Fh, 10h, 11h, 12h, 14h, 15h, and 16h processors. +Family 0Fh, 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors. .Pp For Family 0Fh processors, the .Nm @@ -64,8 +64,8 @@ The driver also creates in the corresponding CPU device's sysctl tree, displaying the maximum temperature of the two sensors located in each CPU core. .Pp -For Family 10h, 11h, 12h, 14h, 15h, and 16h processors, the driver reports each -package's temperature through a sysctl node, named +For Family 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors, the driver reports +each package's temperature through a sysctl node, named .Va dev.amdtemp.%d.core0.sensor0 . The driver also creates .Va dev.cpu.%d.temperature @@ -107,5 +107,5 @@ specified maximum case temperature and maximum thermal according to .Rs .%T BIOS and Kernel Developer's Guide (BKDG) for AMD Processors -.%U http://developer.amd.com/documentation/guides/Pages/default.aspx +.%U http://developer.amd.com/resources/developer-guides-manuals/ .Re Modified: stable/11/stand/forth/loader.conf ============================================================================== --- stable/11/stand/forth/loader.conf Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/stand/forth/loader.conf Thu Feb 22 00:36:12 2018 (r329767) @@ -533,6 +533,7 @@ coretemp_load="NO" # Intel Core CPU temperature monit vkbd_load="NO" # Virtual AT keyboard interface vpd_load="NO" # Vital Product Data kernel interface vpo_load="NO" # Parallel to SCSI interface driver +amdsmn_load="NO" # AMD Family 17h System Management Network amdtemp_load="NO" # AMD K8/K10/K11 temperature monitor tpm_load="NO" # Trusted Platform Module wbwd_load="NO" # Winbond watchdog Modified: stable/11/sys/amd64/conf/NOTES ============================================================================== --- stable/11/sys/amd64/conf/NOTES Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/sys/amd64/conf/NOTES Thu Feb 22 00:36:12 2018 (r329767) @@ -599,6 +599,11 @@ device cpuctl options ENABLE_ALART # Control alarm on Intel intpm driver # +# AMD System Management Network (SMN) +# +device amdsmn + +# # Number of initial kernel page table pages used for early bootstrap. # This number should include enough pages to map the kernel and any # modules or other data loaded with the kernel by the loader. Each Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/sys/conf/files.amd64 Thu Feb 22 00:36:12 2018 (r329767) @@ -192,6 +192,7 @@ dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_via.c optional agp dev/amdsbwd/amdsbwd.c optional amdsbwd +dev/amdsmn/amdsmn.c optional amdsmn | amdtemp dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/sys/conf/files.i386 Thu Feb 22 00:36:12 2018 (r329767) @@ -175,6 +175,7 @@ dev/agp/agp_sis.c optional agp dev/agp/agp_via.c optional agp dev/aic/aic_isa.c optional aic isa dev/amdsbwd/amdsbwd.c optional amdsbwd +dev/amdsmn/amdsmn.c optional amdsmn | amdtemp dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa Modified: stable/11/sys/dev/amdsmn/amdsmn.c ============================================================================== --- head/sys/dev/amdsmn/amdsmn.c Tue Sep 5 15:13:41 2017 (r323184) +++ stable/11/sys/dev/amdsmn/amdsmn.c Thu Feb 22 00:36:12 2018 (r329767) @@ -90,24 +90,29 @@ static devclass_t amdsmn_devclass; DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL); MODULE_VERSION(amdsmn, 1); -static void -amdsmn_identify(driver_t *driver, device_t parent) +static bool +amdsmn_match(device_t parent) { - device_t child; uint32_t devid; size_t i; - /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "amdsmn", -1) != NULL) - return; - devid = pci_get_devid(parent); for (i = 0; i < nitems(amdsmn_ids); i++) if (amdsmn_ids[i].device_id == devid) - break; + return (true); + return (false); +} - if (i >= nitems(amdsmn_ids)) +static void +amdsmn_identify(driver_t *driver, device_t parent) +{ + device_t child; + + /* Make sure we're not being doubly invoked. */ + if (device_find_child(parent, "amdsmn", -1) != NULL) return; + if (!amdsmn_match(parent)) + return; child = device_add_child(parent, "amdsmn", -1); if (child == NULL) @@ -120,6 +125,8 @@ amdsmn_probe(device_t dev) uint32_t family; if (resource_disabled("amdsmn", 0)) + return (ENXIO); + if (!amdsmn_match(device_get_parent(dev))) return (ENXIO); family = CPUID_TO_FAMILY(cpu_id); Modified: stable/11/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/11/sys/dev/amdtemp/amdtemp.c Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/sys/dev/amdtemp/amdtemp.c Thu Feb 22 00:36:12 2018 (r329767) @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + typedef enum { CORE0_SENSOR0, CORE0_SENSOR1, @@ -59,7 +61,6 @@ typedef enum { } amdsensor_t; struct amdtemp_softc { - device_t sc_dev; int sc_ncores; int sc_ntemps; int sc_flags; @@ -70,6 +71,7 @@ struct amdtemp_softc { int32_t (*sc_gettemp)(device_t, amdsensor_t); struct sysctl_oid *sc_sysctl_cpu[MAXCPU]; struct intr_config_hook sc_ich; + device_t sc_smn; }; #define VENDORID_AMD 0x1022 @@ -82,6 +84,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16 0x1533 #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_MISC17 0x141d +#define DEVICEID_AMD_HOSTB17H 0x1450 static struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -96,6 +99,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC16 }, { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H }, { VENDORID_AMD, DEVICEID_AMD_MISC17 }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H }, { 0, 0 } }; @@ -105,6 +109,11 @@ static struct amdtemp_product { #define AMDTEMP_REPTMP_CTRL 0xa4 /* + * Reported Temperature, Family 17h + */ +#define AMDTEMP_17H_CUR_TMP 0x59800 + +/* * Thermaltrip Status Register (Family 0Fh only) */ #define AMDTEMP_THERMTP_STAT 0xe4 @@ -133,6 +142,7 @@ static int amdtemp_detach(device_t dev); static int amdtemp_match(device_t dev); static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor); +static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor); static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t amdtemp_methods[] = { @@ -153,6 +163,8 @@ static driver_t amdtemp_driver = { static devclass_t amdtemp_devclass; DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL); +MODULE_VERSION(amdtemp, 1); +MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1); static int amdtemp_match(device_t dev) @@ -195,6 +207,8 @@ amdtemp_probe(device_t dev) if (resource_disabled("amdtemp", 0)) return (ENXIO); + if (!amdtemp_match(device_get_parent(dev))) + return (ENXIO); family = CPUID_TO_FAMILY(cpu_id); model = CPUID_TO_MODEL(cpu_id); @@ -211,6 +225,7 @@ amdtemp_probe(device_t dev) case 0x14: case 0x15: case 0x16: + case 0x17: break; default: return (ENXIO); @@ -240,7 +255,7 @@ amdtemp_attach(device_t dev) cpuid = cpu_id; family = CPUID_TO_FAMILY(cpuid); model = CPUID_TO_MODEL(cpuid); - if (family != 0x0f || model >= 0x40) { + if ((family != 0x0f || model >= 0x40) && family != 0x17) { cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4); family = CPUID_TO_FAMILY(cpuid); model = CPUID_TO_MODEL(cpuid); @@ -342,6 +357,17 @@ amdtemp_attach(device_t dev) sc->sc_gettemp = amdtemp_gettemp; break; + case 0x17: + sc->sc_ntemps = 1; + sc->sc_gettemp = amdtemp_gettemp17h; + sc->sc_smn = device_find_child( + device_get_parent(dev), "amdsmn", -1); + if (sc->sc_smn == NULL) { + if (bootverbose) + device_printf(dev, "No SMN device found\n"); + return (ENXIO); + } + break; } /* Find number of cores per package. */ @@ -552,6 +578,22 @@ amdtemp_gettemp(device_t dev, amdsensor_t sensor) uint32_t temp; temp = pci_read_config(dev, AMDTEMP_REPTMP_CTRL, 4); + temp = ((temp >> 21) & 0x7ff) * 5 / 4; + temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10; + + return (temp); +} + +static int32_t +amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) +{ + struct amdtemp_softc *sc = device_get_softc(dev); + uint32_t temp; + int error; + + error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &temp); + KASSERT(error == 0, ("amdsmn_read")); + temp = ((temp >> 21) & 0x7ff) * 5 / 4; temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10; Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Thu Feb 22 00:09:15 2018 (r329766) +++ stable/11/sys/modules/Makefile Thu Feb 22 00:36:12 2018 (r329767) @@ -36,6 +36,7 @@ SUBDIR= \ alq \ ${_amd_ecc_inject} \ ${_amdsbwd} \ + ${_amdsmn} \ ${_amdtemp} \ amr \ ${_an} \ @@ -631,6 +632,7 @@ _aesni= aesni .endif _amd_ecc_inject=amd_ecc_inject _amdsbwd= amdsbwd +_amdsmn= amdsmn _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc From owner-svn-src-all@freebsd.org Thu Feb 22 00:39:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A7DF1135D; Thu, 22 Feb 2018 00:39:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75B1D7BC7D; Thu, 22 Feb 2018 00:39:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C5B51FDBC; Thu, 22 Feb 2018 00:39:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0dQx1011636; Thu, 22 Feb 2018 00:39:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0dP8d011632; Thu, 22 Feb 2018 00:39:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802220039.w1M0dP8d011632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Feb 2018 00:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329768 - in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm X-SVN-Commit-Revision: 329768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:39:27 -0000 Author: jhb Date: Thu Feb 22 00:39:25 2018 New Revision: 329768 URL: https://svnweb.freebsd.org/changeset/base/329768 Log: Add two new ioctls to bhyve for batch register fetch/store operations. These are a convenience for bhyve's debug server to use a single ioctl for 'g' and 'G' rather than a loop of individual get/set ioctl requests. Reviewed by: grehan MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D14074 Modified: head/lib/libvmmapi/vmmapi.c head/lib/libvmmapi/vmmapi.h head/sys/amd64/include/vmm_dev.h head/sys/amd64/vmm/vmm_dev.c Modified: head/lib/libvmmapi/vmmapi.c ============================================================================== --- head/lib/libvmmapi/vmmapi.c Thu Feb 22 00:36:12 2018 (r329767) +++ head/lib/libvmmapi/vmmapi.c Thu Feb 22 00:39:25 2018 (r329768) @@ -588,6 +588,40 @@ vm_get_register(struct vmctx *ctx, int vcpu, int reg, } int +vm_set_register_set(struct vmctx *ctx, int vcpu, unsigned int count, + const int *regnums, uint64_t *regvals) +{ + int error; + struct vm_register_set vmregset; + + bzero(&vmregset, sizeof(vmregset)); + vmregset.cpuid = vcpu; + vmregset.count = count; + vmregset.regnums = regnums; + vmregset.regvals = regvals; + + error = ioctl(ctx->fd, VM_SET_REGISTER_SET, &vmregset); + return (error); +} + +int +vm_get_register_set(struct vmctx *ctx, int vcpu, unsigned int count, + const int *regnums, uint64_t *regvals) +{ + int error; + struct vm_register_set vmregset; + + bzero(&vmregset, sizeof(vmregset)); + vmregset.cpuid = vcpu; + vmregset.count = count; + vmregset.regnums = regnums; + vmregset.regvals = regvals; + + error = ioctl(ctx->fd, VM_GET_REGISTER_SET, &vmregset); + return (error); +} + +int vm_run(struct vmctx *ctx, int vcpu, struct vm_exit *vmexit) { int error; @@ -1435,6 +1469,7 @@ vm_get_ioctls(size_t *len) VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_GETNEXT, VM_SET_REGISTER, VM_GET_REGISTER, VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR, + VM_SET_REGISTER_SET, VM_GET_REGISTER_SET, VM_INJECT_EXCEPTION, VM_LAPIC_IRQ, VM_LAPIC_LOCAL_IRQ, VM_LAPIC_MSI, VM_IOAPIC_ASSERT_IRQ, VM_IOAPIC_DEASSERT_IRQ, VM_IOAPIC_PULSE_IRQ, VM_IOAPIC_PINCOUNT, VM_ISA_ASSERT_IRQ, Modified: head/lib/libvmmapi/vmmapi.h ============================================================================== --- head/lib/libvmmapi/vmmapi.h Thu Feb 22 00:36:12 2018 (r329767) +++ head/lib/libvmmapi/vmmapi.h Thu Feb 22 00:39:25 2018 (r329768) @@ -127,6 +127,10 @@ int vm_get_seg_desc(struct vmctx *ctx, int vcpu, int r struct seg_desc *seg_desc); int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val); int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval); +int vm_set_register_set(struct vmctx *ctx, int vcpu, unsigned int count, + const int *regnums, uint64_t *regvals); +int vm_get_register_set(struct vmctx *ctx, int vcpu, unsigned int count, + const int *regnums, uint64_t *regvals); int vm_run(struct vmctx *ctx, int vcpu, struct vm_exit *ret_vmexit); int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); int vm_reinit(struct vmctx *ctx); Modified: head/sys/amd64/include/vmm_dev.h ============================================================================== --- head/sys/amd64/include/vmm_dev.h Thu Feb 22 00:36:12 2018 (r329767) +++ head/sys/amd64/include/vmm_dev.h Thu Feb 22 00:39:25 2018 (r329768) @@ -66,6 +66,13 @@ struct vm_seg_desc { /* data or code segment */ struct seg_desc desc; }; +struct vm_register_set { + int cpuid; + unsigned int count; + const int *regnums; /* enum vm_reg_name */ + uint64_t *regvals; +}; + struct vm_run { int cpuid; struct vm_exit vm_exit; @@ -242,6 +249,8 @@ enum { IOCNUM_GET_REGISTER = 21, IOCNUM_SET_SEGMENT_DESCRIPTOR = 22, IOCNUM_GET_SEGMENT_DESCRIPTOR = 23, + IOCNUM_SET_REGISTER_SET = 24, + IOCNUM_GET_REGISTER_SET = 25, /* interrupt injection */ IOCNUM_GET_INTINFO = 28, @@ -312,6 +321,10 @@ enum { _IOW('v', IOCNUM_SET_SEGMENT_DESCRIPTOR, struct vm_seg_desc) #define VM_GET_SEGMENT_DESCRIPTOR \ _IOWR('v', IOCNUM_GET_SEGMENT_DESCRIPTOR, struct vm_seg_desc) +#define VM_SET_REGISTER_SET \ + _IOW('v', IOCNUM_SET_REGISTER_SET, struct vm_register_set) +#define VM_GET_REGISTER_SET \ + _IOWR('v', IOCNUM_GET_REGISTER_SET, struct vm_register_set) #define VM_INJECT_EXCEPTION \ _IOW('v', IOCNUM_INJECT_EXCEPTION, struct vm_exception) #define VM_LAPIC_IRQ \ Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Thu Feb 22 00:36:12 2018 (r329767) +++ head/sys/amd64/vmm/vmm_dev.c Thu Feb 22 00:39:25 2018 (r329768) @@ -282,6 +282,36 @@ done: } static int +vm_get_register_set(struct vm *vm, int vcpu, unsigned int count, int *regnum, + uint64_t *regval) +{ + int error, i; + + error = 0; + for (i = 0; i < count; i++) { + error = vm_get_register(vm, vcpu, regnum[i], ®val[i]); + if (error) + break; + } + return (error); +} + +static int +vm_set_register_set(struct vm *vm, int vcpu, unsigned int count, int *regnum, + uint64_t *regval) +{ + int error, i; + + error = 0; + for (i = 0; i < count; i++) { + error = vm_set_register(vm, vcpu, regnum[i], regval[i]); + if (error) + break; + } + return (error); +} + +static int vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { @@ -290,6 +320,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da struct vmmdev_softc *sc; struct vm_register *vmreg; struct vm_seg_desc *vmsegdesc; + struct vm_register_set *vmregset; struct vm_run *vmrun; struct vm_exception *vmexc; struct vm_lapic_irq *vmirq; @@ -315,6 +346,8 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + uint64_t *regvals; + int *regnums; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -333,6 +366,8 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da case VM_SET_REGISTER: case VM_GET_SEGMENT_DESCRIPTOR: case VM_SET_SEGMENT_DESCRIPTOR: + case VM_GET_REGISTER_SET: + case VM_SET_REGISTER_SET: case VM_INJECT_EXCEPTION: case VM_GET_CAPABILITY: case VM_SET_CAPABILITY: @@ -545,6 +580,48 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da error = vm_get_seg_desc(sc->vm, vmsegdesc->cpuid, vmsegdesc->regnum, &vmsegdesc->desc); + break; + case VM_GET_REGISTER_SET: + vmregset = (struct vm_register_set *)data; + if (vmregset->count > VM_REG_LAST) { + error = EINVAL; + break; + } + regvals = malloc(sizeof(regvals[0]) * vmregset->count, M_VMMDEV, + M_WAITOK); + regnums = malloc(sizeof(regnums[0]) * vmregset->count, M_VMMDEV, + M_WAITOK); + error = copyin(vmregset->regnums, regnums, sizeof(regnums[0]) * + vmregset->count); + if (error == 0) + error = vm_get_register_set(sc->vm, vmregset->cpuid, + vmregset->count, regnums, regvals); + if (error == 0) + error = copyout(regvals, vmregset->regvals, + sizeof(regvals[0]) * vmregset->count); + free(regvals, M_VMMDEV); + free(regnums, M_VMMDEV); + break; + case VM_SET_REGISTER_SET: + vmregset = (struct vm_register_set *)data; + if (vmregset->count > VM_REG_LAST) { + error = EINVAL; + break; + } + regvals = malloc(sizeof(regvals[0]) * vmregset->count, M_VMMDEV, + M_WAITOK); + regnums = malloc(sizeof(regnums[0]) * vmregset->count, M_VMMDEV, + M_WAITOK); + error = copyin(vmregset->regnums, regnums, sizeof(regnums[0]) * + vmregset->count); + if (error == 0) + error = copyin(vmregset->regvals, regvals, + sizeof(regvals[0]) * vmregset->count); + if (error == 0) + error = vm_set_register_set(sc->vm, vmregset->cpuid, + vmregset->count, regnums, regvals); + free(regvals, M_VMMDEV); + free(regnums, M_VMMDEV); break; case VM_GET_CAPABILITY: vmcap = (struct vm_capability *)data; From owner-svn-src-all@freebsd.org Thu Feb 22 00:42:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8927F117D7; Thu, 22 Feb 2018 00:42:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64BF27C093; Thu, 22 Feb 2018 00:42:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA941FF48; Thu, 22 Feb 2018 00:42:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0gDoL016558; Thu, 22 Feb 2018 00:42:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0gDrc016556; Thu, 22 Feb 2018 00:42:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220042.w1M0gDrc016556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329769 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:42:14 -0000 Author: mav Date: Thu Feb 22 00:42:12 2018 New Revision: 329769 URL: https://svnweb.freebsd.org/changeset/base/329769 Log: MFV r329766: 8962 zdb should work on non-idle pools illumos/illumos-gate@e144c4e6c90e7d4dccaad6db660ee42b6e7ba04f Currently `zdb` consistently fails to examine non-idle pools as it fails during the `spa_load()` process. The main problem seems to be that `spa_load_verify()` fails as can be seen below: $ sudo zdb -d -G dcenter zdb: can't open 'dcenter': I/O error ZFS_DBGMSG(zdb): spa_open_common: opening dcenter spa_load(dcenter): LOADING disk vdev '/dev/dsk/c4t11d0s0': best uberblock found for spa dcenter. txg 40824950 spa_load(dcenter): using uberblock with txg=40824950 spa_load(dcenter): UNLOADING spa_load(dcenter): RELOADING spa_load(dcenter): LOADING disk vdev '/dev/dsk/c3t10d0s0': best uberblock found for spa dcenter. txg 40824952 spa_load(dcenter): using uberblock with txg=40824952 spa_load(dcenter): FAILED: spa_load_verify failed [error=5] spa_load(dcenter): UNLOADING This change makes `spa_load_verify()` a dryrun when ran from `zdb`. This is done by creating a global flag in zfs and then setting it in `zdb`. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Pavel Zakharov Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Feb 22 00:39:25 2018 (r329768) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Feb 22 00:42:12 2018 (r329769) @@ -87,11 +87,13 @@ extern int reference_tracking_enable; extern boolean_t zfs_recover; extern uint64_t zfs_arc_max, zfs_arc_meta_limit; extern int zfs_vdev_async_read_max_active; +extern boolean_t spa_load_verify_dryrun; #else int reference_tracking_enable; boolean_t zfs_recover; uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; +boolean_t spa_load_verify_dryrun; #endif static const char cmdname[] = "zdb"; @@ -4577,6 +4579,12 @@ main(int argc, char **argv) * Disable reference tracking for better performance. */ reference_tracking_enable = B_FALSE; + + /* + * Do not fail spa_load when spa_load_verify fails. This is needed + * to load non-idle pools. + */ + spa_load_verify_dryrun = B_TRUE; kernel_init(FREAD); g_zfs = libzfs_init(); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 00:39:25 2018 (r329768) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 00:42:12 2018 (r329769) @@ -181,6 +181,12 @@ boolean_t spa_create_process = B_TRUE; /* no process = extern int zfs_sync_pass_deferred_free; /* + * Report any spa_load_verify errors found, but do not fail spa_load. + * This is used by zdb to analyze non-idle pools. + */ +boolean_t spa_load_verify_dryrun = B_FALSE; + +/* * This (illegal) pool name is used when temporarily importing a spa_t in order * to get the vdev stats associated with the imported devices. */ @@ -2088,8 +2094,15 @@ spa_load_verify(spa_t *spa) spa->spa_load_meta_errors = sle.sle_meta_count; spa->spa_load_data_errors = sle.sle_data_count; - if (!error && sle.sle_meta_count <= policy.zrp_maxmeta && - sle.sle_data_count <= policy.zrp_maxdata) { + if (sle.sle_meta_count != 0 || sle.sle_data_count != 0) { + spa_load_note(spa, "spa_load_verify found %llu metadata errors " + "and %llu data errors", (u_longlong_t)sle.sle_meta_count, + (u_longlong_t)sle.sle_data_count); + } + + if (spa_load_verify_dryrun || + (!error && sle.sle_meta_count <= policy.zrp_maxmeta && + sle.sle_data_count <= policy.zrp_maxdata)) { int64_t loss = 0; verify_ok = B_TRUE; @@ -2106,6 +2119,9 @@ spa_load_verify(spa_t *spa) } else { spa->spa_load_max_txg = spa->spa_uberblock.ub_txg; } + + if (spa_load_verify_dryrun) + return (0); if (error) { if (error != ENXIO && error != EIO) From owner-svn-src-all@freebsd.org Thu Feb 22 00:46:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9273F11C74; Thu, 22 Feb 2018 00:46:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 593737C34C; Thu, 22 Feb 2018 00:46:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B7A41FF5D; Thu, 22 Feb 2018 00:46:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0kOZ9016761; Thu, 22 Feb 2018 00:46:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0kOJw016757; Thu, 22 Feb 2018 00:46:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220046.w1M0kOJw016757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329770 - vendor-sys/illumos/dist/uts/common/fs/zfs/lua X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs/lua X-SVN-Commit-Revision: 329770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:46:26 -0000 Author: mav Date: Thu Feb 22 00:46:24 2018 New Revision: 329770 URL: https://svnweb.freebsd.org/changeset/base/329770 Log: 9035 zfs: this statement may fall through illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553 Reviewed by: Yuri Pankov Reviewed by: Andy Fiddaman Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:42:12 2018 (r329769) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:46:24 2018 (r329770) @@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) { case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; case LUA_TSHRSTR: G(L)->strt.nuse--; - /* go through */ + /* FALLTHROUGH */ case LUA_TLNGSTR: { luaM_freemem(L, o, sizestring(gco2ts(o))); break; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:42:12 2018 (r329769) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:46:24 2018 (r329770) @@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { else if (!lisdigit(ls->current)) return '.'; /* else go through */ } + /* FALLTHROUGH */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { read_numeral(ls, seminfo); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:42:12 2018 (r329769) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:46:24 2018 (r329770) @@ -514,7 +514,7 @@ static const char *match (MatchState *ms, const char * } case '+': /* 1 or more repetitions */ s++; /* 1 match already done */ - /* go through */ + /* FALLTHROUGH */ case '*': /* 0 or more repetitions */ s = max_expand(ms, s, p, ep); break; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:42:12 2018 (r329769) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:46:24 2018 (r329770) @@ -490,6 +490,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { return luaH_getint(t, k); /* use specialized version */ /* else go through */ } + /* FALLTHROUGH */ default: { Node *n = mainposition(t, key); do { /* check whether `key' is somewhere in the chain */ From owner-svn-src-all@freebsd.org Thu Feb 22 00:47:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF025F11DE8; Thu, 22 Feb 2018 00:47:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 956827C4C9; Thu, 22 Feb 2018 00:47:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9019A1FF62; Thu, 22 Feb 2018 00:47:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0ldRn016853; Thu, 22 Feb 2018 00:47:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0ldWO016849; Thu, 22 Feb 2018 00:47:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220047.w1M0ldWO016849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329771 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua X-SVN-Commit-Revision: 329771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:47:40 -0000 Author: mav Date: Thu Feb 22 00:47:38 2018 New Revision: 329771 URL: https://svnweb.freebsd.org/changeset/base/329771 Log: MFV r329770: 9035 zfs: this statement may fall through illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553 Reviewed by: Yuri Pankov Reviewed by: Andy Fiddaman Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Toomas Soome Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:46:24 2018 (r329770) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:47:38 2018 (r329771) @@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) { case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; case LUA_TSHRSTR: G(L)->strt.nuse--; - /* go through */ + /* FALLTHROUGH */ case LUA_TLNGSTR: { luaM_freemem(L, o, sizestring(gco2ts(o))); break; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:46:24 2018 (r329770) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:47:38 2018 (r329771) @@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { else if (!lisdigit(ls->current)) return '.'; /* else go through */ } + /* FALLTHROUGH */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { read_numeral(ls, seminfo); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:46:24 2018 (r329770) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:47:38 2018 (r329771) @@ -519,7 +519,7 @@ static const char *match (MatchState *ms, const char * } case '+': /* 1 or more repetitions */ s++; /* 1 match already done */ - /* go through */ + /* FALLTHROUGH */ case '*': /* 0 or more repetitions */ s = max_expand(ms, s, p, ep); break; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:46:24 2018 (r329770) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:47:38 2018 (r329771) @@ -490,6 +490,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { return luaH_getint(t, k); /* use specialized version */ /* else go through */ } + /* FALLTHROUGH */ default: { Node *n = mainposition(t, key); do { /* check whether `key' is somewhere in the chain */ From owner-svn-src-all@freebsd.org Thu Feb 22 00:49:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 279FDF11FD9; Thu, 22 Feb 2018 00:49:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D01057C654; Thu, 22 Feb 2018 00:48:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAF421FF63; Thu, 22 Feb 2018 00:48:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0mxr1016940; Thu, 22 Feb 2018 00:48:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0mxgq016939; Thu, 22 Feb 2018 00:48:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220048.w1M0mxgq016939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329772 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:49:00 -0000 Author: mav Date: Thu Feb 22 00:48:59 2018 New Revision: 329772 URL: https://svnweb.freebsd.org/changeset/base/329772 Log: 9036 zfs: duplicate 'const' declaration specifier illumos/illumos-gate@f02c28e434fb4d81d95122bab187fb43d4f19c2a Reviewed by: Yuri Pankov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c Thu Feb 22 00:47:38 2018 (r329771) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c Thu Feb 22 00:48:59 2018 (r329772) @@ -133,8 +133,8 @@ vdev_indirect_mapping_size(vdev_indirect_mapping_t *vi static int dva_mapping_overlap_compare(const void *v_key, const void *v_array_elem) { - const uint64_t const *key = v_key; - const vdev_indirect_mapping_entry_phys_t const *array_elem = + const uint64_t *key = v_key; + const vdev_indirect_mapping_entry_phys_t *array_elem = v_array_elem; uint64_t src_offset = DVA_MAPPING_GET_SRC_OFFSET(array_elem); From owner-svn-src-all@freebsd.org Thu Feb 22 00:53:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE0F1F125EA; Thu, 22 Feb 2018 00:53:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 992A77CAC8; Thu, 22 Feb 2018 00:53:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90EE720103; Thu, 22 Feb 2018 00:53:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0r5gl021667; Thu, 22 Feb 2018 00:53:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0r5S9021666; Thu, 22 Feb 2018 00:53:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802220053.w1M0r5S9021666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Feb 2018 00:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329773 - stable/11/sys/opencrypto X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/opencrypto X-SVN-Commit-Revision: 329773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:53:06 -0000 Author: jhb Date: Thu Feb 22 00:53:05 2018 New Revision: 329773 URL: https://svnweb.freebsd.org/changeset/base/329773 Log: MFC 323889: Place the AAD before the plaintext/ciphertext for CIOCRYPTAEAD. Software crypto implementations don't care how the buffer is laid out, but hardware implementations may assume that the AAD is always before the plain/cipher text and that the hash/tag is immediately after the end of the plain/cipher text. In particular, this arrangement matches the layout of both IPSec packets and TLS frames. Linux's crypto framework also assumes this layout for AEAD requests. Sponsored by: Chelsio Communications Modified: stable/11/sys/opencrypto/cryptodev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/opencrypto/cryptodev.c ============================================================================== --- stable/11/sys/opencrypto/cryptodev.c Thu Feb 22 00:48:59 2018 (r329772) +++ stable/11/sys/opencrypto/cryptodev.c Thu Feb 22 00:53:05 2018 (r329773) @@ -898,7 +898,7 @@ cryptodev_aead( uio->uio_iov = &cse->iovec; uio->uio_iovcnt = 1; uio->uio_offset = 0; - uio->uio_resid = caead->len + caead->aadlen + cse->thash->hashsize; + uio->uio_resid = caead->aadlen + caead->len + cse->thash->hashsize; uio->uio_segflg = UIO_SYSSPACE; uio->uio_rw = UIO_WRITE; uio->uio_td = td; @@ -916,17 +916,17 @@ cryptodev_aead( crda = crp->crp_desc; crde = crda->crd_next; - if ((error = copyin(caead->src, cse->uio.uio_iov[0].iov_base, - caead->len))) + if ((error = copyin(caead->aad, cse->uio.uio_iov[0].iov_base, + caead->aadlen))) goto bail; - if ((error = copyin(caead->aad, (char *)cse->uio.uio_iov[0].iov_base + - caead->len, caead->aadlen))) + if ((error = copyin(caead->src, (char *)cse->uio.uio_iov[0].iov_base + + caead->aadlen, caead->len))) goto bail; - crda->crd_skip = caead->len; + crda->crd_skip = 0; crda->crd_len = caead->aadlen; - crda->crd_inject = caead->len + caead->aadlen; + crda->crd_inject = caead->aadlen + caead->len; crda->crd_alg = cse->mac; crda->crd_key = cse->mackey; @@ -936,15 +936,15 @@ cryptodev_aead( crde->crd_flags |= CRD_F_ENCRYPT; else crde->crd_flags &= ~CRD_F_ENCRYPT; - /* crde->crd_skip set below */ + crde->crd_skip = caead->aadlen; crde->crd_len = caead->len; - crde->crd_inject = 0; + crde->crd_inject = caead->aadlen; crde->crd_alg = cse->cipher; crde->crd_key = cse->key; crde->crd_klen = cse->keylen * 8; - crp->crp_ilen = caead->len + caead->aadlen; + crp->crp_ilen = caead->aadlen + caead->len; crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_CBIMM | (caead->flags & COP_F_BATCH); crp->crp_buf = (caddr_t)&cse->uio.uio_iov; @@ -962,10 +962,9 @@ cryptodev_aead( goto bail; bcopy(cse->tmp_iv, crde->crd_iv, caead->ivlen); crde->crd_flags |= CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; - crde->crd_skip = 0; } else { crde->crd_flags |= CRD_F_IV_PRESENT; - crde->crd_skip = cse->txform->blocksize; + crde->crd_skip += cse->txform->blocksize; crde->crd_len -= cse->txform->blocksize; } @@ -1005,12 +1004,13 @@ again: goto bail; } - if (caead->dst && (error = copyout(cse->uio.uio_iov[0].iov_base, - caead->dst, caead->len))) + if (caead->dst && (error = copyout( + (caddr_t)cse->uio.uio_iov[0].iov_base + caead->aadlen, caead->dst, + caead->len))) goto bail; if ((error = copyout((caddr_t)cse->uio.uio_iov[0].iov_base + - caead->len + caead->aadlen, caead->tag, cse->thash->hashsize))) + caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) goto bail; bail: From owner-svn-src-all@freebsd.org Thu Feb 22 00:54:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E157F12746; Thu, 22 Feb 2018 00:54:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4093D7CC07; Thu, 22 Feb 2018 00:54:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BA3A20104; Thu, 22 Feb 2018 00:54:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0s02l021744; Thu, 22 Feb 2018 00:54:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0s0H8021743; Thu, 22 Feb 2018 00:54:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220054.w1M0s0H8021743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329774 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:54:00 -0000 Author: mav Date: Thu Feb 22 00:53:59 2018 New Revision: 329774 URL: https://svnweb.freebsd.org/changeset/base/329774 Log: 8408 dsl_props_set_sync_impl() does not handle nested nvlists correctly illumos/illumos-gate@85723e5eec42f46dbfdb4c09b9e1ed66501d1ccf When iterating over the input nvlist in dsl_props_set_sync_impl() when we don't preserve the nvpair name before looking up ZPROP_VALUE, so when we later go to process it nvpair_name() is always "value" instead of the actual property name. This results in a couple of bugs in the recv code: - received properties are not restored correctly when failing to receive an incremental send stream - received properties are not completely replaced by the new ones when successfully receiving an incremental send stream This was discovered on ZFS on Linux (fixed in https://github.com/zfsonlinux/zfs/commit/5f1346c29997dd4e02acf4c19c875d5484f33b1e) Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c Thu Feb 22 00:53:05 2018 (r329773) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c Thu Feb 22 00:53:59 2018 (r329774) @@ -855,11 +855,15 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { nvpair_t *pair = elem; + const char *name = nvpair_name(pair); if (nvpair_type(pair) == DATA_TYPE_NVLIST) { /* - * dsl_prop_get_all_impl() returns properties in this - * format. + * This usually happens when we reuse the nvlist_t data + * returned by the counterpart dsl_prop_get_all_impl(). + * For instance we do this to restore the original + * received properties when an error occurs in the + * zfs_ioc_recv() codepath. */ nvlist_t *attrs = fnvpair_value_nvlist(pair); pair = fnvlist_lookup_nvpair(attrs, ZPROP_VALUE); @@ -867,14 +871,14 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc if (nvpair_type(pair) == DATA_TYPE_STRING) { const char *value = fnvpair_value_string(pair); - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, 1, strlen(value) + 1, value, tx); } else if (nvpair_type(pair) == DATA_TYPE_UINT64) { uint64_t intval = fnvpair_value_uint64(pair); - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, sizeof (intval), 1, &intval, tx); } else if (nvpair_type(pair) == DATA_TYPE_BOOLEAN) { - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, 0, 0, NULL, tx); } else { panic("invalid nvpair type"); From owner-svn-src-all@freebsd.org Thu Feb 22 00:55:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37BF6F1293B; Thu, 22 Feb 2018 00:55:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF60A7CDC4; Thu, 22 Feb 2018 00:55:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C01C220105; Thu, 22 Feb 2018 00:55:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0tPs5021878; Thu, 22 Feb 2018 00:55:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0tPLS021877; Thu, 22 Feb 2018 00:55:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220055.w1M0tPLS021877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:55:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329775 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:55:26 -0000 Author: mav Date: Thu Feb 22 00:55:25 2018 New Revision: 329775 URL: https://svnweb.freebsd.org/changeset/base/329775 Log: MFV r329774: 8408 dsl_props_set_sync_impl() does not handle nested nvlists correctly illumos/illumos-gate@85723e5eec42f46dbfdb4c09b9e1ed66501d1ccf When iterating over the input nvlist in dsl_props_set_sync_impl() when we don't preserve the nvpair name before looking up ZPROP_VALUE, so when we later go to process it nvpair_name() is always "value" instead of the actual property name. This results in a couple of bugs in the recv code: - received properties are not restored correctly when failing to receive an incremental send stream - received properties are not completely replaced by the new ones when successfully receiving an incremental send stream This was discovered on ZFS on Linux (fixed in https://github.com/zfsonlinux/zfs/commit/5f1346c29997dd4e02acf4c19c875d5484f33b1e) Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Thu Feb 22 00:53:59 2018 (r329774) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Thu Feb 22 00:55:25 2018 (r329775) @@ -856,11 +856,15 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { nvpair_t *pair = elem; + const char *name = nvpair_name(pair); if (nvpair_type(pair) == DATA_TYPE_NVLIST) { /* - * dsl_prop_get_all_impl() returns properties in this - * format. + * This usually happens when we reuse the nvlist_t data + * returned by the counterpart dsl_prop_get_all_impl(). + * For instance we do this to restore the original + * received properties when an error occurs in the + * zfs_ioc_recv() codepath. */ nvlist_t *attrs = fnvpair_value_nvlist(pair); pair = fnvlist_lookup_nvpair(attrs, ZPROP_VALUE); @@ -868,14 +872,14 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc if (nvpair_type(pair) == DATA_TYPE_STRING) { const char *value = fnvpair_value_string(pair); - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, 1, strlen(value) + 1, value, tx); } else if (nvpair_type(pair) == DATA_TYPE_UINT64) { uint64_t intval = fnvpair_value_uint64(pair); - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, sizeof (intval), 1, &intval, tx); } else if (nvpair_type(pair) == DATA_TYPE_BOOLEAN) { - dsl_prop_set_sync_impl(ds, nvpair_name(pair), + dsl_prop_set_sync_impl(ds, name, source, 0, 0, NULL, tx); } else { panic("invalid nvpair type"); From owner-svn-src-all@freebsd.org Thu Feb 22 00:59:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E37A8F12F25; Thu, 22 Feb 2018 00:59:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97CDA7D2A5; Thu, 22 Feb 2018 00:59:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6463620109; Thu, 22 Feb 2018 00:59:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M0xngN022532; Thu, 22 Feb 2018 00:59:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M0xnwE022531; Thu, 22 Feb 2018 00:59:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220059.w1M0xnwE022531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 00:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329776 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 00:59:51 -0000 Author: mav Date: Thu Feb 22 00:59:49 2018 New Revision: 329776 URL: https://svnweb.freebsd.org/changeset/base/329776 Log: 8477 Assertion failed in vdev_state_dirty(): spa_writeable(spa) illumos/illumos-gate@f4c1745bd6c9829a05ecec15759ede7757100ab5 Illumos 4080 allows "zpool clear" to work on readonly pools: i don't think this is the intended behaviour, we shouldn't be allowed to clear readonly pools. Probably. A fix is already in the ZFS on Linux repository to addess this issue: https://github.com/zfsonlinux/zfs/commit/92e43c17188d47f47b69318e4884096dec380e36 Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 00:55:25 2018 (r329775) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 00:59:49 2018 (r329776) @@ -5900,7 +5900,7 @@ zfs_ioctl_init(void) zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_CLEAR, zfs_ioc_clear, - zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); + zfs_secpolicy_config, B_TRUE, POOL_CHECK_READONLY); zfs_ioctl_register_pool(ZFS_IOC_POOL_REOPEN, zfs_ioc_pool_reopen, zfs_secpolicy_config, B_TRUE, POOL_CHECK_SUSPENDED); From owner-svn-src-all@freebsd.org Thu Feb 22 01:00:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E37FAF13096; Thu, 22 Feb 2018 01:00:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9671D7D62C; Thu, 22 Feb 2018 01:00:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9168E2011D; Thu, 22 Feb 2018 01:00:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M10kQw022821; Thu, 22 Feb 2018 01:00:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M10kDO022820; Thu, 22 Feb 2018 01:00:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220100.w1M10kDO022820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329777 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:00:47 -0000 Author: mav Date: Thu Feb 22 01:00:46 2018 New Revision: 329777 URL: https://svnweb.freebsd.org/changeset/base/329777 Log: MFV r329776: 8477 Assertion failed in vdev_state_dirty(): spa_writeable(spa) illumos/illumos-gate@f4c1745bd6c9829a05ecec15759ede7757100ab5 Illumos 4080 allows "zpool clear" to work on readonly pools: i don't think this is the intended behaviour, we shouldn't be allowed to clear readonly pools. Probably. A fix is already in the ZFS on Linux repository to addess this issue: https://github.com/zfsonlinux/zfs/commit/92e43c17188d47f47b69318e4884096dec380e36 Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 00:59:49 2018 (r329776) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 01:00:46 2018 (r329777) @@ -6172,7 +6172,7 @@ zfs_ioctl_init(void) zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_CLEAR, zfs_ioc_clear, - zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); + zfs_secpolicy_config, B_TRUE, POOL_CHECK_READONLY); zfs_ioctl_register_pool(ZFS_IOC_POOL_REOPEN, zfs_ioc_pool_reopen, zfs_secpolicy_config, B_TRUE, POOL_CHECK_SUSPENDED); From owner-svn-src-all@freebsd.org Thu Feb 22 01:04:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7484FF13671; Thu, 22 Feb 2018 01:04:59 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB7AA7DBA1; Thu, 22 Feb 2018 01:04:58 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1M14v6w088615; Wed, 21 Feb 2018 17:04:57 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1M14uHQ088614; Wed, 21 Feb 2018 17:04:56 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802220104.w1M14uHQ088614@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329770 - vendor-sys/illumos/dist/uts/common/fs/zfs/lua In-Reply-To: <201802220046.w1M0kOJw016757@repo.freebsd.org> To: Alexander Motin Date: Wed, 21 Feb 2018 17:04:56 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:04:59 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: mav > Date: Thu Feb 22 00:46:24 2018 > New Revision: 329770 > URL: https://svnweb.freebsd.org/changeset/base/329770 > > Log: > 9035 zfs: this statement may fall through > > illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553 > > Reviewed by: Yuri Pankov > Reviewed by: Andy Fiddaman > Reviewed by: Matthew Ahrens > Approved by: Dan McDonald > Author: Toomas Soome > > Modified: > vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c > vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c > vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c > vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c > > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c > ============================================================================== > --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:42:12 2018 (r329769) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:46:24 2018 (r329770) > @@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) { > case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; > case LUA_TSHRSTR: > G(L)->strt.nuse--; > - /* go through */ > + /* FALLTHROUGH */ > case LUA_TLNGSTR: { > luaM_freemem(L, o, sizestring(gco2ts(o))); > break; > > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c > ============================================================================== > --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:42:12 2018 (r329769) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:46:24 2018 (r329770) > @@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { > else if (!lisdigit(ls->current)) return '.'; > /* else go through */ ^^^^^^^^^^^^^^^^^^^^^^^ Wasnt this already marked, perhaps in the wrong place with the wrong string? > } > + /* FALLTHROUGH */ > case '0': case '1': case '2': case '3': case '4': > case '5': case '6': case '7': case '8': case '9': { > read_numeral(ls, seminfo); > > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c > ============================================================================== > --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:42:12 2018 (r329769) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c Thu Feb 22 00:46:24 2018 (r329770) > @@ -514,7 +514,7 @@ static const char *match (MatchState *ms, const char * > } > case '+': /* 1 or more repetitions */ > s++; /* 1 match already done */ > - /* go through */ > + /* FALLTHROUGH */ > case '*': /* 0 or more repetitions */ > s = max_expand(ms, s, p, ep); > break; > > Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c > ============================================================================== > --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:42:12 2018 (r329769) > +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c Thu Feb 22 00:46:24 2018 (r329770) > @@ -490,6 +490,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { > return luaH_getint(t, k); /* use specialized version */ > /* else go through */ And again? > } > + /* FALLTHROUGH */ > default: { > Node *n = mainposition(t, key); > do { /* check whether `key' is somewhere in the chain */ -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Feb 22 01:21:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3675F1503D; Thu, 22 Feb 2018 01:21:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6751D7E9B2; Thu, 22 Feb 2018 01:21:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6259E20642; Thu, 22 Feb 2018 01:21:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1LeWc036880; Thu, 22 Feb 2018 01:21:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1Ldb3036876; Thu, 22 Feb 2018 01:21:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220121.w1M1Ldb3036876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 01:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329779 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:21:40 -0000 Author: kevans Date: Thu Feb 22 01:21:39 2018 New Revision: 329779 URL: https://svnweb.freebsd.org/changeset/base/329779 Log: lualoader: Split cli bits out into a cli module This module will, in the not-so-distant future, grow functionality for reducing boilerplate in functions that implement cli commands. It will likely also house most in-tree cli commands. Added: head/stand/lua/cli.lua (contents, props changed) Modified: head/stand/lua/Makefile head/stand/lua/core.lua head/stand/lua/loader.lua Modified: head/stand/lua/Makefile ============================================================================== --- head/stand/lua/Makefile Thu Feb 22 01:17:32 2018 (r329778) +++ head/stand/lua/Makefile Thu Feb 22 01:21:39 2018 (r329779) @@ -3,7 +3,8 @@ .include BINDIR= /boot/lua -FILES= color.lua \ +FILES= cli.lua \ + color.lua \ config.lua \ core.lua \ drawer.lua \ Added: head/stand/lua/cli.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/lua/cli.lua Thu Feb 22 01:21:39 2018 (r329779) @@ -0,0 +1,113 @@ +-- +-- Copyright (c) 2018 Kyle Evans +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +local core = require('core') + +local cli = {} + +-- Internal function +-- Parses arguments to boot and returns two values: kernel_name, argstr +-- Defaults to nil and "" respectively. +-- This will also parse arguments to autoboot, but the with_kernel argument +-- will need to be explicitly overwritten to false +local parse_boot_args = function(argv, with_kernel) + if with_kernel == nil then + with_kernel = true + end + if #argv == 0 then + if with_kernel then + return nil, "" + else + return "" + end + end + local kernel_name + local argstr = "" + + for k, v in ipairs(argv) do + if with_kernel and v:sub(1,1) ~= "-" then + kernel_name = v + else + argstr = argstr .. " " .. v + end + end + if with_kernel then + return kernel_name, argstr + else + return argstr + end +end + +-- Globals + +function boot(...) + local argv = {...} + local cmd_name = "" + cmd_name, argv = core.popFrontTable(argv) + local kernel, argstr = parse_boot_args(argv) + if kernel ~= nil then + loader.perform("unload") + config.selectkernel(kernel) + end + core.boot(argstr) +end + +function autoboot(...) + local argv = {...} + local cmd_name = "" + cmd_name, argv = core.popFrontTable(argv) + local argstr = parse_boot_args(argv, false) + core.autoboot(argstr) +end + +-- Declares a global function cli_execute that attempts to dispatch the +-- arguments passed as a lua function. This gives lua a chance to intercept +-- builtin CLI commands like "boot" +function cli_execute(...) + local argv = {...} + -- Just in case... + if #argv == 0 then + loader.command(...) + return + end + + local cmd_name = argv[1] + local cmd = _G[cmd_name] + if cmd ~= nil and type(cmd) == "function" then + -- Pass argv wholesale into cmd. We could omit argv[0] since the + -- traditional reasons for including it don't necessarily apply, + -- it may not be totally redundant if we want to have one global + -- handling multiple commands + cmd(...) + else + loader.command(...) + end + +end + +return cli Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Thu Feb 22 01:17:32 2018 (r329778) +++ head/stand/lua/core.lua Thu Feb 22 01:21:39 2018 (r329779) @@ -37,60 +37,6 @@ local compose_loader_cmd = function(cmd_name, argstr) return cmd_name end --- Internal function --- Parses arguments to boot and returns two values: kernel_name, argstr --- Defaults to nil and "" respectively. --- This will also parse arguments to autoboot, but the with_kernel argument --- will need to be explicitly overwritten to false -local parse_boot_args = function(argv, with_kernel) - if with_kernel == nil then - with_kernel = true - end - if #argv == 0 then - if with_kernel then - return nil, "" - else - return "" - end - end - local kernel_name - local argstr = "" - - for k, v in ipairs(argv) do - if with_kernel and v:sub(1,1) ~= "-" then - kernel_name = v - else - argstr = argstr .. " " .. v - end - end - if with_kernel then - return kernel_name, argstr - else - return argstr - end -end - --- Globals -function boot(...) - local argv = {...} - local cmd_name = "" - cmd_name, argv = core.popFrontTable(argv) - local kernel, argstr = parse_boot_args(argv) - if kernel ~= nil then - loader.perform("unload") - config.selectkernel(kernel) - end - core.boot(argstr) -end - -function autoboot(...) - local argv = {...} - local cmd_name = "" - cmd_name, argv = core.popFrontTable(argv) - local argstr = parse_boot_args(argv, false) - core.autoboot(argstr) -end - -- Module exports -- Commonly appearing constants core.KEY_BACKSPACE = 8 Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Thu Feb 22 01:17:32 2018 (r329778) +++ head/stand/lua/loader.lua Thu Feb 22 01:21:39 2018 (r329779) @@ -27,6 +27,7 @@ -- $FreeBSD$ -- +local cli = require("cli") local config = require("config") local menu = require("menu") local password = require("password") @@ -36,31 +37,6 @@ local result, errstr, errnoval = lfs.attributes("/boot -- Effectively discard any errors; we'll just act if it succeeds. if result ~= nil then local_module = require("local") -end - --- Declares a global function cli_execute that attempts to dispatch the --- arguments passed as a lua function. This gives lua a chance to intercept --- builtin CLI commands like "boot" -function cli_execute(...) - local argv = {...} - -- Just in case... - if #argv == 0 then - loader.command(...) - return - end - - local cmd_name = argv[1] - local cmd = _G[cmd_name] - if cmd ~= nil and type(cmd) == "function" then - -- Pass argv wholesale into cmd. We could omit argv[0] since the - -- traditional reasons for including it don't necessarily apply, - -- it may not be totally redundant if we want to have one global - -- handling multiple commands - cmd(...) - else - loader.command(...) - end - end config.load() From owner-svn-src-all@freebsd.org Thu Feb 22 01:17:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1ACBF148B4; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74FA37E4C7; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FD80204C6; Thu, 22 Feb 2018 01:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1HWei033010; Thu, 22 Feb 2018 01:17:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1HWb1033009; Thu, 22 Feb 2018 01:17:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220117.w1M1HWb1033009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329778 - vendor/illumos/dist/cmd/zpool X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/cmd/zpool X-SVN-Commit-Revision: 329778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:17:32 -0000 Author: mav Date: Thu Feb 22 01:17:32 2018 New Revision: 329778 URL: https://svnweb.freebsd.org/changeset/base/329778 Log: 8941 zpool add: assertion failed in get_replication() with nested interior VDEVs illumos/illumos-gate@ac0215f4d618163d117a40fbf77a3f944852cb7b When replacing a faulted device which was previously handled by a spare multiple levels of nested interior VDEVs will be present in the pool configuration: get_replication() needs to handle this situation gracefully to let zpool add new devices to the pool Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Dan McDonald Author: loli10K Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_vdev.c Thu Feb 22 01:00:46 2018 (r329777) +++ vendor/illumos/dist/cmd/zpool/zpool_vdev.c Thu Feb 22 01:17:32 2018 (r329778) @@ -628,9 +628,11 @@ get_replication(nvlist_t *nvroot, boolean_t fatal) /* * If this is a replacing or spare vdev, then - * get the real first child of the vdev. + * get the real first child of the vdev: do this + * in a loop because replacing and spare vdevs + * can be nested. */ - if (strcmp(childtype, + while (strcmp(childtype, VDEV_TYPE_REPLACING) == 0 || strcmp(childtype, VDEV_TYPE_SPARE) == 0) { nvlist_t **rchild; From owner-svn-src-all@freebsd.org Thu Feb 22 01:25:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3D8DF1567A; Thu, 22 Feb 2018 01:25:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 715CF7EE2F; Thu, 22 Feb 2018 01:25:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52ABC2069F; Thu, 22 Feb 2018 01:25:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1PSAC037765; Thu, 22 Feb 2018 01:25:28 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1PSMZ037764; Thu, 22 Feb 2018 01:25:28 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802220125.w1M1PSMZ037764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 01:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329780 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:25:29 -0000 Author: asomers Date: Thu Feb 22 01:25:28 2018 New Revision: 329780 URL: https://svnweb.freebsd.org/changeset/base/329780 Log: MFC r326399: Fix assertion when ZFS fails to open certain devices "panic: vdev_geom_close_locked: cp->private is NULL" This panic will result if ZFS fails to open a device due to either of the following reasons: 1) The device's sector size is greater than 8KB. 2) ZFS wants to open the device RW, but it can't be opened for writing. The solution is to change the initialization order to ensure that the assertion will be satisfied. PR: 221066 Reported by: David NewHamlet Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13278 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Thu Feb 22 01:21:39 2018 (r329779) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Thu Feb 22 01:25:28 2018 (r329780) @@ -2398,7 +2398,7 @@ vdev_raidz_io_done(zio_t *zio) */ if (parity_errors + parity_untried < rm->rm_firstdatacol || - (zio->io_flags & ZIO_FLAG_RESILVER)) { + (zio->io_flags & (ZIO_FLAG_RESILVER | ZIO_FLAG_SCRUB))) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= @@ -2450,7 +2450,7 @@ vdev_raidz_io_done(zio_t *zio) * out to failed devices later. */ if (parity_errors < rm->rm_firstdatacol - n || - (zio->io_flags & ZIO_FLAG_RESILVER)) { + (zio->io_flags & (ZIO_FLAG_RESILVER | ZIO_FLAG_SCRUB))) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= @@ -2552,7 +2552,8 @@ done: zio_checksum_verified(zio); if (zio->io_error == 0 && spa_writeable(zio->io_spa) && - (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) { + (unexpected_errors || + (zio->io_flags & (ZIO_FLAG_RESILVER | ZIO_FLAG_SCRUB)))) { /* * Use the good data we have in hand to repair damaged children. */ From owner-svn-src-all@freebsd.org Thu Feb 22 01:30:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F076F15ACA; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 201937F0DA; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B0D9206C1; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1U3bW037991; Thu, 22 Feb 2018 01:30:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1U3K6037990; Thu, 22 Feb 2018 01:30:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220130.w1M1U3K6037990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329781 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 329781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:30:04 -0000 Author: mav Date: Thu Feb 22 01:30:03 2018 New Revision: 329781 URL: https://svnweb.freebsd.org/changeset/base/329781 Log: 8942 zfs promote .../%recv should be an error illumos/illumos-gate@add927f8c8d101e16c23eb9cd270be4fd7edf7d5 Reported on the ZFSonLinux https://github.com/zfsonlinux/zfs/issues/4843, fixed by https://github.com/zfsonlinux/zfs/pull/6339: If we are in the middle of an incremental zfs receive, the child .../%recv will exist. If you concurrently run zfs promote .../%recv, it will "work", but then zfs gets confused. For example, there's no obvious way to destroy the containing filesystem (because it is now a clone of its invisible child). Attempting to do this promote should be an error. We could fix this by having zfs_ioc_promote() check if zc_name contains a %, similar to zfs_ioc_rename(). Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 01:25:28 2018 (r329780) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 01:30:03 2018 (r329781) @@ -3758,9 +3758,12 @@ zfs_ioc_rename(zfs_cmd_t *zc) boolean_t recursive = zc->zc_cookie & 1; char *at; + /* "zfs rename" from and to ...%recv datasets should both fail */ + zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; - if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || - strchr(zc->zc_value, '%')) + if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || + dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || + strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%')) return (SET_ERROR(EINVAL)); at = strchr(zc->zc_name, '@'); @@ -4782,6 +4785,11 @@ zfs_ioc_promote(zfs_cmd_t *zc) char origin[ZFS_MAX_DATASET_NAME_LEN]; char *cp; int error; + + zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; + if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || + strchr(zc->zc_name, '%')) + return (SET_ERROR(EINVAL)); error = dsl_pool_hold(zc->zc_name, FTAG, &dp); if (error != 0) From owner-svn-src-all@freebsd.org Thu Feb 22 01:30:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC85AF15ACD; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DFCF7F0DC; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68FE8206C2; Thu, 22 Feb 2018 01:30:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1U4uO037997; Thu, 22 Feb 2018 01:30:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1U4Fg037996; Thu, 22 Feb 2018 01:30:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220130.w1M1U4Fg037996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:30:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329781 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 329781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:30:05 -0000 Author: mav Date: Thu Feb 22 01:30:03 2018 New Revision: 329781 URL: https://svnweb.freebsd.org/changeset/base/329781 Log: 8942 zfs promote .../%recv should be an error illumos/illumos-gate@add927f8c8d101e16c23eb9cd270be4fd7edf7d5 Reported on the ZFSonLinux https://github.com/zfsonlinux/zfs/issues/4843, fixed by https://github.com/zfsonlinux/zfs/pull/6339: If we are in the middle of an incremental zfs receive, the child .../%recv will exist. If you concurrently run zfs promote .../%recv, it will "work", but then zfs gets confused. For example, there's no obvious way to destroy the containing filesystem (because it is now a clone of its invisible child). Attempting to do this promote should be an error. We could fix this by having zfs_ioc_promote() check if zc_name contains a %, similar to zfs_ioc_rename(). Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:25:28 2018 (r329780) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:30:03 2018 (r329781) @@ -3737,6 +3737,9 @@ zfs_promote(zfs_handle_t *zhp) return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } + if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE)) + return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); + ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname)); if (ret != 0) { @@ -4093,6 +4096,10 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rename to '%s'"), target); + + /* make sure source name is valid */ + if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE)) + return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); /* * Make sure the target name is valid From owner-svn-src-all@freebsd.org Thu Feb 22 01:31:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE57CF15B51; Thu, 22 Feb 2018 01:31:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71D697F2FD; Thu, 22 Feb 2018 01:31:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CCC9207EA; Thu, 22 Feb 2018 01:31:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1V5hg041137; Thu, 22 Feb 2018 01:31:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1V5D3041136; Thu, 22 Feb 2018 01:31:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220131.w1M1V5D3041136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 01:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329782 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:31:05 -0000 Author: kevans Date: Thu Feb 22 01:31:05 2018 New Revision: 329782 URL: https://svnweb.freebsd.org/changeset/base/329782 Log: lualoader: Unbreak 'boot [kernel]' by including config Modified: head/stand/lua/cli.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Thu Feb 22 01:30:03 2018 (r329781) +++ head/stand/lua/cli.lua Thu Feb 22 01:31:05 2018 (r329782) @@ -26,7 +26,8 @@ -- $FreeBSD$ -- -local core = require('core') +local config = require("config") +local core = require("core") local cli = {} From owner-svn-src-all@freebsd.org Thu Feb 22 01:44:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B90DF16E67; Thu, 22 Feb 2018 01:44:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC857FFD4; Thu, 22 Feb 2018 01:44:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F2720A5F; Thu, 22 Feb 2018 01:44:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1iVgh048058; Thu, 22 Feb 2018 01:44:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1iV2W048057; Thu, 22 Feb 2018 01:44:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220144.w1M1iV2W048057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 01:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329784 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:44:31 -0000 Author: kevans Date: Thu Feb 22 01:44:30 2018 New Revision: 329784 URL: https://svnweb.freebsd.org/changeset/base/329784 Log: lualoader: Pull argument extraction for cli functions into cli.arguments This will be the translation layer for varargs -> cmd_name, argv for cli commands. We reserve the right to break exactly what the varargs inclulde, but this gives us a stable way to pull the arguments out of varargs. Modified: head/stand/lua/cli.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Thu Feb 22 01:42:13 2018 (r329783) +++ head/stand/lua/cli.lua Thu Feb 22 01:44:30 2018 (r329784) @@ -67,9 +67,7 @@ end -- Globals function boot(...) - local argv = {...} - local cmd_name = "" - cmd_name, argv = core.popFrontTable(argv) + local cmd_name, argv = cli.arguments(...) local kernel, argstr = parse_boot_args(argv) if kernel ~= nil then loader.perform("unload") @@ -79,9 +77,7 @@ function boot(...) end function autoboot(...) - local argv = {...} - local cmd_name = "" - cmd_name, argv = core.popFrontTable(argv) + local cmd_name, argv = cli.arguments(...) local argstr = parse_boot_args(argv, false) core.autoboot(argstr) end @@ -109,6 +105,15 @@ function cli_execute(...) loader.command(...) end +end + +-- Module exports + +function cli.arguments(...) + local argv = {...} + local cmd_name = "" + cmd_name, argv = core.popFrontTable(argv) + return cmd_name, argv end return cli From owner-svn-src-all@freebsd.org Thu Feb 22 01:42:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50C30F16BBD; Thu, 22 Feb 2018 01:42:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 046177FD9D; Thu, 22 Feb 2018 01:42:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F397020A31; Thu, 22 Feb 2018 01:42:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1gDOP044855; Thu, 22 Feb 2018 01:42:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1gDSY044853; Thu, 22 Feb 2018 01:42:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220142.w1M1gDSY044853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 01:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329783 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:42:14 -0000 Author: mav Date: Thu Feb 22 01:42:13 2018 New Revision: 329783 URL: https://svnweb.freebsd.org/changeset/base/329783 Log: 8942 zfs promote .../%recv should be an error illumos/illumos-gate@add927f8c8d101e16c23eb9cd270be4fd7edf7d5 Reported on the ZFSonLinux https://github.com/zfsonlinux/zfs/issues/4843, fixed by https://github.com/zfsonlinux/zfs/pull/6339: If we are in the middle of an incremental zfs receive, the child .../%recv will exist. If you concurrently run zfs promote .../%recv, it will "work", but then zfs gets confused. For example, there's no obvious way to destroy the containing filesystem (because it is now a clone of its invisible child). Attempting to do this promote should be an error. We could fix this by having zfs_ioc_promote() check if zc_name contains a %, similar to zfs_ioc_rename(). Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: loli10K Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:31:05 2018 (r329782) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:42:13 2018 (r329783) @@ -3786,6 +3786,9 @@ zfs_promote(zfs_handle_t *zhp) return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } + if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE)) + return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); + ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname)); if (ret != 0) { @@ -4155,6 +4158,10 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons (void) strlcat(zhp->zfs_name, source, sizeof(zhp->zfs_name)); zhp->zfs_type = ZFS_TYPE_SNAPSHOT; } + + /* make sure source name is valid */ + if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE)) + return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); /* * Make sure the target name is valid Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 01:31:05 2018 (r329782) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 01:42:13 2018 (r329783) @@ -3942,9 +3942,12 @@ zfs_ioc_rename(zfs_cmd_t *zc) allow_mounted = (zc->zc_cookie & 2) != 0; #endif + /* "zfs rename" from and to ...%recv datasets should both fail */ + zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; - if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || - strchr(zc->zc_value, '%')) + if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || + dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || + strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%')) return (SET_ERROR(EINVAL)); at = strchr(zc->zc_name, '@'); @@ -4995,6 +4998,11 @@ zfs_ioc_promote(zfs_cmd_t *zc) char origin[ZFS_MAX_DATASET_NAME_LEN]; char *cp; int error; + + zc->zc_name[sizeof (zc->zc_name) - 1] = '\0'; + if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 || + strchr(zc->zc_name, '%')) + return (SET_ERROR(EINVAL)); error = dsl_pool_hold(zc->zc_name, FTAG, &dp); if (error != 0) From owner-svn-src-all@freebsd.org Thu Feb 22 01:50:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F3D3F17A05; Thu, 22 Feb 2018 01:50:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0500780479; Thu, 22 Feb 2018 01:50:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2E2020A83; Thu, 22 Feb 2018 01:50:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1oUjD048323; Thu, 22 Feb 2018 01:50:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1oUnt048319; Thu, 22 Feb 2018 01:50:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802220150.w1M1oUnt048319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Feb 2018 01:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329785 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 329785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:50:31 -0000 Author: jhb Date: Thu Feb 22 01:50:30 2018 New Revision: 329785 URL: https://svnweb.freebsd.org/changeset/base/329785 Log: Move DDP PCB state into a helper structure. This consolidates all of the DDP state in one place. Also, the code has now been fixed to ensure that DDP state is only accessed for DDP connections. This should not be a functional change but makes it cleaner and easier to add state for other TOE socket modes in the future. MFC after: 1 month Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Feb 22 01:44:30 2018 (r329784) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Feb 22 01:50:30 2018 (r329785) @@ -1231,7 +1231,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head so = inp->inp_socket; if (toep->ulp_mode == ULP_MODE_TCPDDP) { DDP_LOCK(toep); - if (__predict_false(toep->ddp_flags & + if (__predict_false(toep->ddp.flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) handle_ddp_close(toep, tp, cpl->rcv_nxt); DDP_UNLOCK(toep); @@ -1607,23 +1607,23 @@ do_rx_data(struct sge_iq *iq, const struct rss_header toep->rx_credits += newsize - hiwat; } - if (toep->ddp_waiting_count != 0 || toep->ddp_active_count != 0) - CTR3(KTR_CXGBE, "%s: tid %u, non-ddp rx (%d bytes)", __func__, - tid, len); - if (toep->ulp_mode == ULP_MODE_TCPDDP) { - int changed = !(toep->ddp_flags & DDP_ON) ^ cpl->ddp_off; + int changed = !(toep->ddp.flags & DDP_ON) ^ cpl->ddp_off; + if (toep->ddp.waiting_count != 0 || toep->ddp.active_count != 0) + CTR3(KTR_CXGBE, "%s: tid %u, non-ddp rx (%d bytes)", + __func__, tid, len); + if (changed) { - if (toep->ddp_flags & DDP_SC_REQ) - toep->ddp_flags ^= DDP_ON | DDP_SC_REQ; + if (toep->ddp.flags & DDP_SC_REQ) + toep->ddp.flags ^= DDP_ON | DDP_SC_REQ; else { KASSERT(cpl->ddp_off == 1, ("%s: DDP switched on by itself.", __func__)); /* Fell out of DDP mode */ - toep->ddp_flags &= ~DDP_ON; + toep->ddp.flags &= ~DDP_ON; CTR1(KTR_CXGBE, "%s: fell out of DDP mode", __func__); @@ -1631,7 +1631,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header } } - if (toep->ddp_flags & DDP_ON) { + if (toep->ddp.flags & DDP_ON) { /* * CPL_RX_DATA with DDP on can only be an indicate. * Start posting queued AIO requests via DDP. The @@ -1657,7 +1657,8 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp->rcv_adv += credits; } - if (toep->ddp_waiting_count > 0 && sbavail(sb) != 0) { + if (toep->ulp_mode == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && + sbavail(sb) != 0) { CTR2(KTR_CXGBE, "%s: tid %u queueing AIO task", __func__, tid); ddp_queue_toep(toep); Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Thu Feb 22 01:44:30 2018 (r329784) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Thu Feb 22 01:50:30 2018 (r329785) @@ -150,11 +150,11 @@ recycle_pageset(struct toepcb *toep, struct pageset *p { DDP_ASSERT_LOCKED(toep); - if (!(toep->ddp_flags & DDP_DEAD) && ps->flags & PS_WIRED) { - KASSERT(toep->ddp_cached_count + toep->ddp_active_count < - nitems(toep->db), ("too many wired pagesets")); - TAILQ_INSERT_HEAD(&toep->ddp_cached_pagesets, ps, link); - toep->ddp_cached_count++; + if (!(toep->ddp.flags & DDP_DEAD) && ps->flags & PS_WIRED) { + KASSERT(toep->ddp.cached_count + toep->ddp.active_count < + nitems(toep->ddp.db), ("too many wired pagesets")); + TAILQ_INSERT_HEAD(&toep->ddp.cached_pagesets, ps, link); + toep->ddp.cached_count++; } else free_pageset(toep->td, ps); } @@ -199,17 +199,18 @@ void ddp_init_toep(struct toepcb *toep) { - TAILQ_INIT(&toep->ddp_aiojobq); - TASK_INIT(&toep->ddp_requeue_task, 0, aio_ddp_requeue_task, toep); - toep->ddp_active_id = -1; - mtx_init(&toep->ddp_lock, "t4 ddp", NULL, MTX_DEF); + TAILQ_INIT(&toep->ddp.aiojobq); + TASK_INIT(&toep->ddp.requeue_task, 0, aio_ddp_requeue_task, toep); + toep->ddp.flags = DDP_OK; + toep->ddp.active_id = -1; + mtx_init(&toep->ddp.lock, "t4 ddp", NULL, MTX_DEF); } void ddp_uninit_toep(struct toepcb *toep) { - mtx_destroy(&toep->ddp_lock); + mtx_destroy(&toep->ddp.lock); } void @@ -220,11 +221,11 @@ release_ddp_resources(struct toepcb *toep) DDP_LOCK(toep); toep->flags |= DDP_DEAD; - for (i = 0; i < nitems(toep->db); i++) { - free_ddp_buffer(toep->td, &toep->db[i]); + for (i = 0; i < nitems(toep->ddp.db); i++) { + free_ddp_buffer(toep->td, &toep->ddp.db[i]); } - while ((ps = TAILQ_FIRST(&toep->ddp_cached_pagesets)) != NULL) { - TAILQ_REMOVE(&toep->ddp_cached_pagesets, ps, link); + while ((ps = TAILQ_FIRST(&toep->ddp.cached_pagesets)) != NULL) { + TAILQ_REMOVE(&toep->ddp.cached_pagesets, ps, link); free_pageset(toep->td, ps); } ddp_complete_all(toep, 0); @@ -237,13 +238,13 @@ ddp_assert_empty(struct toepcb *toep) { int i; - MPASS(!(toep->ddp_flags & DDP_TASK_ACTIVE)); - for (i = 0; i < nitems(toep->db); i++) { - MPASS(toep->db[i].job == NULL); - MPASS(toep->db[i].ps == NULL); + MPASS(!(toep->ddp.flags & DDP_TASK_ACTIVE)); + for (i = 0; i < nitems(toep->ddp.db); i++) { + MPASS(toep->ddp.db[i].job == NULL); + MPASS(toep->ddp.db[i].ps == NULL); } - MPASS(TAILQ_EMPTY(&toep->ddp_cached_pagesets)); - MPASS(TAILQ_EMPTY(&toep->ddp_aiojobq)); + MPASS(TAILQ_EMPTY(&toep->ddp.cached_pagesets)); + MPASS(TAILQ_EMPTY(&toep->ddp.aiojobq)); } #endif @@ -253,21 +254,21 @@ complete_ddp_buffer(struct toepcb *toep, struct ddp_bu { unsigned int db_flag; - toep->ddp_active_count--; - if (toep->ddp_active_id == db_idx) { - if (toep->ddp_active_count == 0) { - KASSERT(toep->db[db_idx ^ 1].job == NULL, + toep->ddp.active_count--; + if (toep->ddp.active_id == db_idx) { + if (toep->ddp.active_count == 0) { + KASSERT(toep->ddp.db[db_idx ^ 1].job == NULL, ("%s: active_count mismatch", __func__)); - toep->ddp_active_id = -1; + toep->ddp.active_id = -1; } else - toep->ddp_active_id ^= 1; + toep->ddp.active_id ^= 1; #ifdef VERBOSE_TRACES CTR2(KTR_CXGBE, "%s: ddp_active_id = %d", __func__, - toep->ddp_active_id); + toep->ddp.active_id); #endif } else { - KASSERT(toep->ddp_active_count != 0 && - toep->ddp_active_id != -1, + KASSERT(toep->ddp.active_count != 0 && + toep->ddp.active_id != -1, ("%s: active count mismatch", __func__)); } @@ -277,10 +278,10 @@ complete_ddp_buffer(struct toepcb *toep, struct ddp_bu db->ps = NULL; db_flag = db_idx == 1 ? DDP_BUF1_ACTIVE : DDP_BUF0_ACTIVE; - KASSERT(toep->ddp_flags & db_flag, + KASSERT(toep->ddp.flags & db_flag, ("%s: DDP buffer not active. toep %p, ddp_flags 0x%x", - __func__, toep, toep->ddp_flags)); - toep->ddp_flags &= ~db_flag; + __func__, toep, toep->ddp.flags)); + toep->ddp.flags &= ~db_flag; } /* XXX: handle_ddp_data code duplication */ @@ -308,12 +309,12 @@ insert_ddp_data(struct toepcb *toep, uint32_t n) #endif CTR2(KTR_CXGBE, "%s: placed %u bytes before falling out of DDP", __func__, n); - while (toep->ddp_active_count > 0) { - MPASS(toep->ddp_active_id != -1); - db_idx = toep->ddp_active_id; + while (toep->ddp.active_count > 0) { + MPASS(toep->ddp.active_id != -1); + db_idx = toep->ddp.active_id; db_flag = db_idx == 1 ? DDP_BUF1_ACTIVE : DDP_BUF0_ACTIVE; - MPASS((toep->ddp_flags & db_flag) != 0); - db = &toep->db[db_idx]; + MPASS((toep->ddp.flags & db_flag) != 0); + db = &toep->ddp.db[db_idx]; job = db->job; copied = job->aio_received; placed = n; @@ -335,8 +336,8 @@ insert_ddp_data(struct toepcb *toep, uint32_t n) /* XXX: This always completes if there is some data. */ aio_complete(job, copied + placed, 0); } else if (aio_set_cancel_function(job, t4_aio_cancel_queued)) { - TAILQ_INSERT_HEAD(&toep->ddp_aiojobq, job, list); - toep->ddp_waiting_count++; + TAILQ_INSERT_HEAD(&toep->ddp.aiojobq, job, list); + toep->ddp.waiting_count++; } else aio_cancel(job); n -= placed; @@ -496,10 +497,10 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report sb = &so->so_rcv; DDP_LOCK(toep); - KASSERT(toep->ddp_active_id == db_idx, + KASSERT(toep->ddp.active_id == db_idx, ("completed DDP buffer (%d) != active_id (%d) for tid %d", db_idx, - toep->ddp_active_id, toep->tid)); - db = &toep->db[db_idx]; + toep->ddp.active_id, toep->tid)); + db = &toep->ddp.db[db_idx]; job = db->job; if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { @@ -590,7 +591,7 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report completed: complete_ddp_buffer(toep, db, db_idx); - if (toep->ddp_waiting_count > 0) + if (toep->ddp.waiting_count > 0) ddp_queue_toep(toep); out: DDP_UNLOCK(toep); @@ -604,9 +605,9 @@ handle_ddp_indicate(struct toepcb *toep) { DDP_ASSERT_LOCKED(toep); - MPASS(toep->ddp_active_count == 0); - MPASS((toep->ddp_flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)) == 0); - if (toep->ddp_waiting_count == 0) { + MPASS(toep->ddp.active_count == 0); + MPASS((toep->ddp.flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)) == 0); + if (toep->ddp.waiting_count == 0) { /* * The pending requests that triggered the request for an * an indicate were cancelled. Those cancels should have @@ -616,7 +617,7 @@ handle_ddp_indicate(struct toepcb *toep) return; } CTR3(KTR_CXGBE, "%s: tid %d indicated (%d waiting)", __func__, - toep->tid, toep->ddp_waiting_count); + toep->tid, toep->ddp.waiting_count); ddp_queue_toep(toep); } @@ -646,7 +647,7 @@ handle_ddp_tcb_rpl(struct toepcb *toep, const struct c db_idx = G_COOKIE(cpl->cookie) - DDP_BUF0_INVALIDATED; INP_WLOCK(inp); DDP_LOCK(toep); - db = &toep->db[db_idx]; + db = &toep->ddp.db[db_idx]; /* * handle_ddp_data() should leave the job around until @@ -679,7 +680,7 @@ handle_ddp_tcb_rpl(struct toepcb *toep, const struct c } complete_ddp_buffer(toep, db, db_idx); - if (toep->ddp_waiting_count > 0) + if (toep->ddp.waiting_count > 0) ddp_queue_toep(toep); DDP_UNLOCK(toep); INP_WUNLOCK(inp); @@ -708,12 +709,12 @@ handle_ddp_close(struct toepcb *toep, struct tcpcb *tp toep->rx_credits += len; #endif - while (toep->ddp_active_count > 0) { - MPASS(toep->ddp_active_id != -1); - db_idx = toep->ddp_active_id; + while (toep->ddp.active_count > 0) { + MPASS(toep->ddp.active_id != -1); + db_idx = toep->ddp.active_id; db_flag = db_idx == 1 ? DDP_BUF1_ACTIVE : DDP_BUF0_ACTIVE; - MPASS((toep->ddp_flags & db_flag) != 0); - db = &toep->db[db_idx]; + MPASS((toep->ddp.flags & db_flag) != 0); + db = &toep->ddp.db[db_idx]; job = db->job; copied = job->aio_received; placed = len; @@ -801,15 +802,15 @@ static void enable_ddp(struct adapter *sc, struct toepcb *toep) { - KASSERT((toep->ddp_flags & (DDP_ON | DDP_OK | DDP_SC_REQ)) == DDP_OK, + KASSERT((toep->ddp.flags & (DDP_ON | DDP_OK | DDP_SC_REQ)) == DDP_OK, ("%s: toep %p has bad ddp_flags 0x%x", - __func__, toep, toep->ddp_flags)); + __func__, toep, toep->ddp.flags)); CTR3(KTR_CXGBE, "%s: tid %u (time %u)", __func__, toep->tid, time_uptime); DDP_ASSERT_LOCKED(toep); - toep->ddp_flags |= DDP_SC_REQ; + toep->ddp.flags |= DDP_SC_REQ; t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_RX_DDP_FLAGS, V_TF_DDP_OFF(1) | V_TF_DDP_INDICATE_OUT(1) | V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1) | @@ -1326,11 +1327,11 @@ hold_aio(struct toepcb *toep, struct kaiocb *job, stru /* * Try to reuse a cached pageset. */ - TAILQ_FOREACH(ps, &toep->ddp_cached_pagesets, link) { + TAILQ_FOREACH(ps, &toep->ddp.cached_pagesets, link) { if (pscmp(ps, vm, start, n, pgoff, job->uaiocb.aio_nbytes) == 0) { - TAILQ_REMOVE(&toep->ddp_cached_pagesets, ps, link); - toep->ddp_cached_count--; + TAILQ_REMOVE(&toep->ddp.cached_pagesets, ps, link); + toep->ddp.cached_count--; *pps = ps; return (0); } @@ -1340,15 +1341,15 @@ hold_aio(struct toepcb *toep, struct kaiocb *job, stru * If there are too many cached pagesets to create a new one, * free a pageset before creating a new one. */ - KASSERT(toep->ddp_active_count + toep->ddp_cached_count <= - nitems(toep->db), ("%s: too many wired pagesets", __func__)); - if (toep->ddp_active_count + toep->ddp_cached_count == - nitems(toep->db)) { - KASSERT(toep->ddp_cached_count > 0, + KASSERT(toep->ddp.active_count + toep->ddp.cached_count <= + nitems(toep->ddp.db), ("%s: too many wired pagesets", __func__)); + if (toep->ddp.active_count + toep->ddp.cached_count == + nitems(toep->ddp.db)) { + KASSERT(toep->ddp.cached_count > 0, ("no cached pageset to free")); - ps = TAILQ_LAST(&toep->ddp_cached_pagesets, pagesetq); - TAILQ_REMOVE(&toep->ddp_cached_pagesets, ps, link); - toep->ddp_cached_count--; + ps = TAILQ_LAST(&toep->ddp.cached_pagesets, pagesetq); + TAILQ_REMOVE(&toep->ddp.cached_pagesets, ps, link); + toep->ddp.cached_count--; free_pageset(toep->td, ps); } DDP_UNLOCK(toep); @@ -1388,10 +1389,10 @@ ddp_complete_all(struct toepcb *toep, int error) struct kaiocb *job; DDP_ASSERT_LOCKED(toep); - while (!TAILQ_EMPTY(&toep->ddp_aiojobq)) { - job = TAILQ_FIRST(&toep->ddp_aiojobq); - TAILQ_REMOVE(&toep->ddp_aiojobq, job, list); - toep->ddp_waiting_count--; + while (!TAILQ_EMPTY(&toep->ddp.aiojobq)) { + job = TAILQ_FIRST(&toep->ddp.aiojobq); + TAILQ_REMOVE(&toep->ddp.aiojobq, job, list); + toep->ddp.waiting_count--; if (aio_clear_cancel_function(job)) ddp_complete_one(job, error); } @@ -1424,10 +1425,10 @@ aio_ddp_requeue_one(struct toepcb *toep, struct kaiocb { DDP_ASSERT_LOCKED(toep); - if (!(toep->ddp_flags & DDP_DEAD) && + if (!(toep->ddp.flags & DDP_DEAD) && aio_set_cancel_function(job, t4_aio_cancel_queued)) { - TAILQ_INSERT_HEAD(&toep->ddp_aiojobq, job, list); - toep->ddp_waiting_count++; + TAILQ_INSERT_HEAD(&toep->ddp.aiojobq, job, list); + toep->ddp.waiting_count++; } else aio_ddp_cancel_one(job); } @@ -1451,18 +1452,18 @@ aio_ddp_requeue(struct toepcb *toep) DDP_ASSERT_LOCKED(toep); restart: - if (toep->ddp_flags & DDP_DEAD) { - MPASS(toep->ddp_waiting_count == 0); - MPASS(toep->ddp_active_count == 0); + if (toep->ddp.flags & DDP_DEAD) { + MPASS(toep->ddp.waiting_count == 0); + MPASS(toep->ddp.active_count == 0); return; } - if (toep->ddp_waiting_count == 0 || - toep->ddp_active_count == nitems(toep->db)) { + if (toep->ddp.waiting_count == 0 || + toep->ddp.active_count == nitems(toep->ddp.db)) { return; } - job = TAILQ_FIRST(&toep->ddp_aiojobq); + job = TAILQ_FIRST(&toep->ddp.aiojobq); so = job->fd_file->f_data; sb = &so->so_rcv; SOCKBUF_LOCK(sb); @@ -1474,14 +1475,14 @@ restart: return; } - KASSERT(toep->ddp_active_count == 0 || sbavail(sb) == 0, + KASSERT(toep->ddp.active_count == 0 || sbavail(sb) == 0, ("%s: pending sockbuf data and DDP is active", __func__)); /* Abort if socket has reported problems. */ /* XXX: Wait for any queued DDP's to finish and/or flush them? */ if (so->so_error && sbavail(sb) == 0) { - toep->ddp_waiting_count--; - TAILQ_REMOVE(&toep->ddp_aiojobq, job, list); + toep->ddp.waiting_count--; + TAILQ_REMOVE(&toep->ddp.aiojobq, job, list); if (!aio_clear_cancel_function(job)) { SOCKBUF_UNLOCK(sb); goto restart; @@ -1512,7 +1513,7 @@ restart: */ if (sb->sb_state & SBS_CANTRCVMORE && sbavail(sb) == 0) { SOCKBUF_UNLOCK(sb); - if (toep->ddp_active_count != 0) + if (toep->ddp.active_count != 0) return; ddp_complete_all(toep, 0); return; @@ -1522,7 +1523,7 @@ restart: * If DDP is not enabled and there is no pending socket buffer * data, try to enable DDP. */ - if (sbavail(sb) == 0 && (toep->ddp_flags & DDP_ON) == 0) { + if (sbavail(sb) == 0 && (toep->ddp.flags & DDP_ON) == 0) { SOCKBUF_UNLOCK(sb); /* @@ -1536,7 +1537,7 @@ restart: * XXX: Might want to limit the indicate size to the size * of the first queued request. */ - if ((toep->ddp_flags & DDP_SC_REQ) == 0) + if ((toep->ddp.flags & DDP_SC_REQ) == 0) enable_ddp(sc, toep); return; } @@ -1546,21 +1547,21 @@ restart: * If another thread is queueing a buffer for DDP, let it * drain any work and return. */ - if (toep->ddp_queueing != NULL) + if (toep->ddp.queueing != NULL) return; /* Take the next job to prep it for DDP. */ - toep->ddp_waiting_count--; - TAILQ_REMOVE(&toep->ddp_aiojobq, job, list); + toep->ddp.waiting_count--; + TAILQ_REMOVE(&toep->ddp.aiojobq, job, list); if (!aio_clear_cancel_function(job)) goto restart; - toep->ddp_queueing = job; + toep->ddp.queueing = job; /* NB: This drops DDP_LOCK while it holds the backing VM pages. */ error = hold_aio(toep, job, &ps); if (error != 0) { ddp_complete_one(job, error); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } @@ -1571,7 +1572,7 @@ restart: SOCKBUF_UNLOCK(sb); recycle_pageset(toep, ps); aio_complete(job, copied, 0); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } @@ -1580,26 +1581,26 @@ restart: SOCKBUF_UNLOCK(sb); recycle_pageset(toep, ps); aio_complete(job, -1, error); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } if (sb->sb_state & SBS_CANTRCVMORE && sbavail(sb) == 0) { SOCKBUF_UNLOCK(sb); recycle_pageset(toep, ps); - if (toep->ddp_active_count != 0) { + if (toep->ddp.active_count != 0) { /* * The door is closed, but there are still pending * DDP buffers. Requeue. These jobs will all be * completed once those buffers drain. */ aio_ddp_requeue_one(toep, job); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; return; } ddp_complete_one(job, 0); ddp_complete_all(toep, 0); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; return; } @@ -1608,7 +1609,7 @@ sbcopy: * If the toep is dead, there shouldn't be any data in the socket * buffer, so the above case should have handled this. */ - MPASS(!(toep->ddp_flags & DDP_DEAD)); + MPASS(!(toep->ddp.flags & DDP_DEAD)); /* * If there is pending data in the socket buffer (either @@ -1620,7 +1621,7 @@ sbcopy: MPASS(job->aio_received <= job->uaiocb.aio_nbytes); resid = job->uaiocb.aio_nbytes - job->aio_received; m = sb->sb_mb; - KASSERT(m == NULL || toep->ddp_active_count == 0, + KASSERT(m == NULL || toep->ddp.active_count == 0, ("%s: sockbuf data with active DDP", __func__)); while (m != NULL && resid > 0) { struct iovec iov[1]; @@ -1671,7 +1672,7 @@ sbcopy: } t4_rcvd_locked(&toep->td->tod, intotcpcb(inp)); INP_WUNLOCK(inp); - if (resid == 0 || toep->ddp_flags & DDP_DEAD) { + if (resid == 0 || toep->ddp.flags & DDP_DEAD) { /* * We filled the entire buffer with socket * data, DDP is not being used, or the socket @@ -1681,7 +1682,7 @@ sbcopy: SOCKBUF_UNLOCK(sb); recycle_pageset(toep, ps); aio_complete(job, copied, 0); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } @@ -1690,11 +1691,11 @@ sbcopy: * This will either enable DDP or wait for more data to * arrive on the socket buffer. */ - if ((toep->ddp_flags & (DDP_ON | DDP_SC_REQ)) != DDP_ON) { + if ((toep->ddp.flags & (DDP_ON | DDP_SC_REQ)) != DDP_ON) { SOCKBUF_UNLOCK(sb); recycle_pageset(toep, ps); aio_ddp_requeue_one(toep, job); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } @@ -1711,7 +1712,7 @@ sbcopy: if (prep_pageset(sc, toep, ps) == 0) { recycle_pageset(toep, ps); aio_ddp_requeue_one(toep, job); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; /* * XXX: Need to retry this later. Mostly need a trigger @@ -1722,10 +1723,10 @@ sbcopy: } /* Determine which DDP buffer to use. */ - if (toep->db[0].job == NULL) { + if (toep->ddp.db[0].job == NULL) { db_idx = 0; } else { - MPASS(toep->db[1].job == NULL); + MPASS(toep->ddp.db[1].job == NULL); db_idx = 1; } @@ -1748,11 +1749,11 @@ sbcopy: V_TF_DDP_BUF1_FLUSH(1) | V_TF_DDP_BUF1_VALID(1); buf_flag = DDP_BUF1_ACTIVE; } - MPASS((toep->ddp_flags & buf_flag) == 0); - if ((toep->ddp_flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)) == 0) { + MPASS((toep->ddp.flags & buf_flag) == 0); + if ((toep->ddp.flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)) == 0) { MPASS(db_idx == 0); - MPASS(toep->ddp_active_id == -1); - MPASS(toep->ddp_active_count == 0); + MPASS(toep->ddp.active_id == -1); + MPASS(toep->ddp.active_count == 0); ddp_flags_mask |= V_TF_DDP_ACTIVE_BUF(1); } @@ -1769,7 +1770,7 @@ sbcopy: if (wr == NULL) { recycle_pageset(toep, ps); aio_ddp_requeue_one(toep, job); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; /* * XXX: Need a way to kick a retry here. @@ -1787,7 +1788,7 @@ sbcopy: free_wrqe(wr); recycle_pageset(toep, ps); aio_ddp_cancel_one(job); - toep->ddp_queueing = NULL; + toep->ddp.queueing = NULL; goto restart; } @@ -1797,18 +1798,18 @@ sbcopy: #endif /* Give the chip the go-ahead. */ t4_wrq_tx(sc, wr); - db = &toep->db[db_idx]; + db = &toep->ddp.db[db_idx]; db->cancel_pending = 0; db->job = job; db->ps = ps; - toep->ddp_queueing = NULL; - toep->ddp_flags |= buf_flag; - toep->ddp_active_count++; - if (toep->ddp_active_count == 1) { - MPASS(toep->ddp_active_id == -1); - toep->ddp_active_id = db_idx; + toep->ddp.queueing = NULL; + toep->ddp.flags |= buf_flag; + toep->ddp.active_count++; + if (toep->ddp.active_count == 1) { + MPASS(toep->ddp.active_id == -1); + toep->ddp.active_id = db_idx; CTR2(KTR_CXGBE, "%s: ddp_active_id = %d", __func__, - toep->ddp_active_id); + toep->ddp.active_id); } goto restart; } @@ -1818,11 +1819,11 @@ ddp_queue_toep(struct toepcb *toep) { DDP_ASSERT_LOCKED(toep); - if (toep->ddp_flags & DDP_TASK_ACTIVE) + if (toep->ddp.flags & DDP_TASK_ACTIVE) return; - toep->ddp_flags |= DDP_TASK_ACTIVE; + toep->ddp.flags |= DDP_TASK_ACTIVE; hold_toepcb(toep); - soaio_enqueue(&toep->ddp_requeue_task); + soaio_enqueue(&toep->ddp.requeue_task); } static void @@ -1832,7 +1833,7 @@ aio_ddp_requeue_task(void *context, int pending) DDP_LOCK(toep); aio_ddp_requeue(toep); - toep->ddp_flags &= ~DDP_TASK_ACTIVE; + toep->ddp.flags &= ~DDP_TASK_ACTIVE; DDP_UNLOCK(toep); free_toepcb(toep); @@ -1855,10 +1856,10 @@ t4_aio_cancel_active(struct kaiocb *job) return; } - for (i = 0; i < nitems(toep->db); i++) { - if (toep->db[i].job == job) { + for (i = 0; i < nitems(toep->ddp.db); i++) { + if (toep->ddp.db[i].job == job) { /* Should only ever get one cancel request for a job. */ - MPASS(toep->db[i].cancel_pending == 0); + MPASS(toep->ddp.db[i].cancel_pending == 0); /* * Invalidate this buffer. It will be @@ -1871,7 +1872,7 @@ t4_aio_cancel_active(struct kaiocb *job) W_TCB_RX_DDP_FLAGS, valid_flag, 0, 1, i + DDP_BUF0_INVALIDATED, toep->ofld_rxq->iq.abs_id); - toep->db[i].cancel_pending = 1; + toep->ddp.db[i].cancel_pending = 1; CTR2(KTR_CXGBE, "%s: request %p marked pending", __func__, job); break; @@ -1889,9 +1890,9 @@ t4_aio_cancel_queued(struct kaiocb *job) DDP_LOCK(toep); if (!aio_cancel_cleared(job)) { - TAILQ_REMOVE(&toep->ddp_aiojobq, job, list); - toep->ddp_waiting_count--; - if (toep->ddp_waiting_count == 0) + TAILQ_REMOVE(&toep->ddp.aiojobq, job, list); + toep->ddp.waiting_count--; + if (toep->ddp.waiting_count == 0) ddp_queue_toep(toep); } CTR2(KTR_CXGBE, "%s: request %p cancelled", __func__, job); @@ -1924,9 +1925,9 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job #endif if (!aio_set_cancel_function(job, t4_aio_cancel_queued)) panic("new job was cancelled"); - TAILQ_INSERT_TAIL(&toep->ddp_aiojobq, job, list); - toep->ddp_waiting_count++; - toep->ddp_flags |= DDP_OK; + TAILQ_INSERT_TAIL(&toep->ddp.aiojobq, job, list); + toep->ddp.waiting_count++; + toep->ddp.flags |= DDP_OK; /* * Try to handle this request synchronously. If this has Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Thu Feb 22 01:44:30 2018 (r329784) +++ head/sys/dev/cxgbe/tom/t4_tom.c Thu Feb 22 01:50:30 2018 (r329785) @@ -173,7 +173,6 @@ alloc_toepcb(struct vi_info *vi, int txqid, int rxqid, toep->txsd_pidx = 0; toep->txsd_cidx = 0; aiotx_init_toep(toep); - ddp_init_toep(toep); return (toep); } @@ -198,7 +197,8 @@ free_toepcb(struct toepcb *toep) KASSERT(!(toep->flags & TPF_CPL_PENDING), ("%s: CPL pending", __func__)); - ddp_uninit_toep(toep); + if (toep->ulp_mode == ULP_MODE_TCPDDP) + ddp_uninit_toep(toep); free(toep, M_CXGBE); } @@ -303,7 +303,8 @@ release_offload_resources(struct toepcb *toep) MPASS(mbufq_len(&toep->ulp_pduq) == 0); MPASS(mbufq_len(&toep->ulp_pdu_reclaimq) == 0); #ifdef INVARIANTS - ddp_assert_empty(toep); + if (toep->ulp_mode == ULP_MODE_TCPDDP) + ddp_assert_empty(toep); #endif if (toep->l2te) @@ -623,7 +624,7 @@ set_tcpddp_ulp_mode(struct toepcb *toep) { toep->ulp_mode = ULP_MODE_TCPDDP; - toep->ddp_flags = DDP_OK; + ddp_init_toep(toep); } int Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Feb 22 01:44:30 2018 (r329784) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Feb 22 01:50:30 2018 (r329785) @@ -132,6 +132,20 @@ struct ddp_buffer { int cancel_pending; }; +struct ddp_pcb { + u_int flags; + struct ddp_buffer db[2]; + TAILQ_HEAD(, pageset) cached_pagesets; + TAILQ_HEAD(, kaiocb) aiojobq; + u_int waiting_count; + u_int active_count; + u_int cached_count; + int active_id; /* the currently active DDP buffer */ + struct task requeue_task; + struct kaiocb *queueing; + struct mtx lock; +}; + struct aiotx_buffer { struct pageset ps; struct kaiocb *job; @@ -170,17 +184,7 @@ struct toepcb { struct mbufq ulp_pduq; /* PDUs waiting to be sent out. */ struct mbufq ulp_pdu_reclaimq; - u_int ddp_flags; - struct ddp_buffer db[2]; - TAILQ_HEAD(, pageset) ddp_cached_pagesets; - TAILQ_HEAD(, kaiocb) ddp_aiojobq; - u_int ddp_waiting_count; - u_int ddp_active_count; - u_int ddp_cached_count; - int ddp_active_id; /* the currently active DDP buffer */ - struct task ddp_requeue_task; - struct kaiocb *ddp_queueing; - struct mtx ddp_lock; + struct ddp_pcb ddp; TAILQ_HEAD(, kaiocb) aiotx_jobq; struct task aiotx_task; @@ -194,9 +198,9 @@ struct toepcb { struct ofld_tx_sdesc txsd[]; }; -#define DDP_LOCK(toep) mtx_lock(&(toep)->ddp_lock) -#define DDP_UNLOCK(toep) mtx_unlock(&(toep)->ddp_lock) -#define DDP_ASSERT_LOCKED(toep) mtx_assert(&(toep)->ddp_lock, MA_OWNED) +#define DDP_LOCK(toep) mtx_lock(&(toep)->ddp.lock) +#define DDP_UNLOCK(toep) mtx_unlock(&(toep)->ddp.lock) +#define DDP_ASSERT_LOCKED(toep) mtx_assert(&(toep)->ddp.lock, MA_OWNED) struct flowc_tx_params { uint32_t snd_nxt; From owner-svn-src-all@freebsd.org Thu Feb 22 02:02:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15C45F18A50; Thu, 22 Feb 2018 02:02:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3F39813BA; Thu, 22 Feb 2018 02:02:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEF6E20DFE; Thu, 22 Feb 2018 02:02:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M22VlL057809; Thu, 22 Feb 2018 02:02:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M22VHS057807; Thu, 22 Feb 2018 02:02:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802220202.w1M22VHS057807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Feb 2018 02:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329788 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 329788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:02:32 -0000 Author: jhb Date: Thu Feb 22 02:02:31 2018 New Revision: 329788 URL: https://svnweb.freebsd.org/changeset/base/329788 Log: Bring in additional constants and message fields for TLS-related messages. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/common/t4_tcb.h Modified: head/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_msg.h Thu Feb 22 01:59:59 2018 (r329787) +++ head/sys/dev/cxgbe/common/t4_msg.h Thu Feb 22 02:02:31 2018 (r329788) @@ -3104,7 +3104,8 @@ struct cpl_rx_mps_pkt { struct cpl_tx_tls_sfo { __be32 op_to_seg_len; __be32 pld_len; - __be64 rsvd; + __be32 type_protover; + __be32 r1_lo; __be32 seqno_numivs; __be32 ivgen_hdrlen; __be64 scmd1; @@ -3128,15 +3129,28 @@ struct cpl_tx_tls_sfo { #define V_CPL_TX_TLS_SFO_CPL_LEN(x) ((x) << S_CPL_TX_TLS_SFO_CPL_LEN) #define G_CPL_TX_TLS_SFO_CPL_LEN(x) \ (((x) >> S_CPL_TX_TLS_SFO_CPL_LEN) & M_CPL_TX_TLS_SFO_CPL_LEN) + #define S_CPL_TX_TLS_SFO_SEG_LEN 0 #define M_CPL_TX_TLS_SFO_SEG_LEN 0xffff #define V_CPL_TX_TLS_SFO_SEG_LEN(x) ((x) << S_CPL_TX_TLS_SFO_SEG_LEN) #define G_CPL_TX_TLS_SFO_SEG_LEN(x) \ (((x) >> S_CPL_TX_TLS_SFO_SEG_LEN) & M_CPL_TX_TLS_SFO_SEG_LEN) +#define S_CPL_TX_TLS_SFO_TYPE 24 +#define M_CPL_TX_TLS_SFO_TYPE 0xff +#define V_CPL_TX_TLS_SFO_TYPE(x) ((x) << S_CPL_TX_TLS_SFO_TYPE) +#define G_CPL_TX_TLS_SFO_TYPE(x) \ + (((x) >> S_CPL_TX_TLS_SFO_TYPE) & M_CPL_TX_TLS_SFO_TYPE) + +#define S_CPL_TX_TLS_SFO_PROTOVER 8 +#define M_CPL_TX_TLS_SFO_PROTOVER 0xffff +#define V_CPL_TX_TLS_SFO_PROTOVER(x) ((x) << S_CPL_TX_TLS_SFO_PROTOVER) +#define G_CPL_TX_TLS_SFO_PROTOVER(x) \ + (((x) >> S_CPL_TX_TLS_SFO_PROTOVER) & M_CPL_TX_TLS_SFO_PROTOVER) + struct cpl_tls_data { RSS_HDR - __be32 op_tid; + union opcode_tid ot; __be32 length_pkd; __be32 seq; __be32 r1; @@ -3162,7 +3176,7 @@ struct cpl_tls_data { struct cpl_rx_tls_cmp { RSS_HDR - __be32 op_tid; + union opcode_tid ot; __be32 pdulength_length; __be32 seq; __be32 ddp_report; Modified: head/sys/dev/cxgbe/common/t4_tcb.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_tcb.h Thu Feb 22 01:59:59 2018 (r329787) +++ head/sys/dev/cxgbe/common/t4_tcb.h Thu Feb 22 02:02:31 2018 (r329788) @@ -497,6 +497,54 @@ #define M_TCB_RX_DDP_BUF1_TAG 0xffffffffULL #define V_TCB_RX_DDP_BUF1_TAG(x) ((x) << S_TCB_RX_DDP_BUF1_TAG) +/* 855:832 */ +#define W_TCB_RX_TLS_BUF_OFFSET 26 +#define S_TCB_RX_TLS_BUF_OFFSET 0 +#define M_TCB_RX_TLS_BUF_OFFSET 0xffffffULL +#define V_TCB_RX_TLS_BUF_OFFSET(x) ((x) << S_TCB_RX_TLS_BUF_OFFSET) + +/* 876:856 */ +#define W_TCB_RX_TLS_BUF_LEN 26 +#define S_TCB_RX_TLS_BUF_LEN 24 +#define M_TCB_RX_TLS_BUF_LEN 0xffffffULL +#define V_TCB_RX_TLS_BUF_LEN(x) ((__u64)(x) << S_TCB_RX_TLS_BUF_LEN) + +/* 895:880 */ +#define W_TCB_RX_TLS_FLAGS 26 +#define S_TCB_RX_TLS_FLAGS 48 +#define M_TCB_RX_TLS_FLAGS 0xffffULL +#define V_TCB_RX_TLS_FLAGS(x) ((__u64)(x) << S_TCB_RX_TLS_FLAGS) + +/* 959:896 */ +#define W_TCB_TLS_SEQ 28 +#define S_TCB_TLS_SEQ 0 +#define M_TCB_TLS_SEQ 0xffffffffffffffffULL +#define V_TCB_TLS_SEQ(x) ((__u64)(x) << S_TCB_TLS_SEQ) + +/* 991:960 */ +#define W_TCB_RX_TLS_BUF_TAG 30 +#define S_TCB_RX_TLS_BUF_TAG 0 +#define M_TCB_RX_TLS_BUF_TAG 0xffffffffULL +#define V_TCB_RX_TLS_BUF_TAG(x) ((x) << S_TCB_RX_TLS_BUF_TAG) + +/* 1023:992 */ +#define W_TCB_RX_TLS_KEY_TAG 31 +#define S_TCB_RX_TLS_KEY_TAG 0 +#define M_TCB_RX_TLS_KEY_TAG 0xffffffffULL +#define V_TCB_RX_TLS_KEY_TAG(x) ((x) << S_TCB_RX_TLS_KEY_TAG) + +#define S_TF_TLS_KEY_SIZE 7 +#define V_TF_TLS_KEY_SIZE(x) ((x) << S_TF_TLS_KEY_SIZE) + +#define S_TF_TLS_CONTROL 2 +#define V_TF_TLS_CONTROL(x) ((x) << S_TF_TLS_CONTROL) + +#define S_TF_TLS_ACTIVE 1 +#define V_TF_TLS_ACTIVE(x) ((x) << S_TF_TLS_ACTIVE) + +#define S_TF_TLS_ENABLE 0 +#define V_TF_TLS_ENABLE(x) ((x) << S_TF_TLS_ENABLE) + #define S_TF_MIGRATING 0 #define V_TF_MIGRATING(x) ((x) << S_TF_MIGRATING) From owner-svn-src-all@freebsd.org Thu Feb 22 02:00:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1973F18642; Thu, 22 Feb 2018 01:59:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9406580ED6; Thu, 22 Feb 2018 01:59:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EEB820C5B; Thu, 22 Feb 2018 01:59:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1xxD3053089; Thu, 22 Feb 2018 01:59:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1xxMc053088; Thu, 22 Feb 2018 01:59:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802220159.w1M1xxMc053088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Feb 2018 01:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329787 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 329787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:00:00 -0000 Author: emaste Date: Thu Feb 22 01:59:59 2018 New Revision: 329787 URL: https://svnweb.freebsd.org/changeset/base/329787 Log: Use 'const int *' for sysentvec errno translation table This allows an sv_errtbl to be read-only .rodata. Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/sys/sysent.h Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Thu Feb 22 01:57:38 2018 (r329786) +++ head/sys/sys/sysent.h Thu Feb 22 01:59:59 2018 (r329787) @@ -94,7 +94,7 @@ struct sysentvec { struct sysent *sv_table; /* pointer to sysent */ u_int sv_mask; /* optional mask to index */ int sv_errsize; /* size of errno translation table */ - int *sv_errtbl; /* errno translation table */ + const int *sv_errtbl; /* errno translation table */ int (*sv_transtrap)(int, int); /* translate trap-to-signal mapping */ int (*sv_fixup)(register_t **, struct image_params *); From owner-svn-src-all@freebsd.org Thu Feb 22 02:15:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51B3EF19CD6; Thu, 22 Feb 2018 02:15:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 044C481E9B; Thu, 22 Feb 2018 02:15:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F333220FE7; Thu, 22 Feb 2018 02:15:45 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2FjVG062940; Thu, 22 Feb 2018 02:15:45 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2FjPr062937; Thu, 22 Feb 2018 02:15:45 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802220215.w1M2FjPr062937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 02:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329791 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:15:46 -0000 Author: asomers Date: Thu Feb 22 02:15:45 2018 New Revision: 329791 URL: https://svnweb.freebsd.org/changeset/base/329791 Log: MFC r328296: sys/netinet6: fix typos in comments. No functional change. Sponsored by: Spectra Logic Corp Modified: stable/11/sys/netinet6/in6.c stable/11/sys/netinet6/scope6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/in6.c ============================================================================== --- stable/11/sys/netinet6/in6.c Thu Feb 22 02:14:43 2018 (r329790) +++ stable/11/sys/netinet6/in6.c Thu Feb 22 02:15:45 2018 (r329791) @@ -1449,7 +1449,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignorefl /* - * find the internet address corresponding to a given address. + * find the interface address corresponding to a given IPv6 address. * ifaddr is returned referenced. */ struct in6_ifaddr * Modified: stable/11/sys/netinet6/scope6.c ============================================================================== --- stable/11/sys/netinet6/scope6.c Thu Feb 22 02:14:43 2018 (r329790) +++ stable/11/sys/netinet6/scope6.c Thu Feb 22 02:15:45 2018 (r329791) @@ -409,7 +409,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, if (scope == IPV6_ADDR_SCOPE_INTFACELOCAL || scope == IPV6_ADDR_SCOPE_LINKLOCAL) { /* - * Currently we use interface indeces as the + * Currently we use interface indices as the * zone IDs for interface-local and link-local * scopes. */ From owner-svn-src-all@freebsd.org Thu Feb 22 01:57:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2DE6F1840A; Thu, 22 Feb 2018 01:57:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A63FC80D17; Thu, 22 Feb 2018 01:57:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A12F620C3F; Thu, 22 Feb 2018 01:57:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M1vcHq052957; Thu, 22 Feb 2018 01:57:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M1vc59052956; Thu, 22 Feb 2018 01:57:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220157.w1M1vc59052956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 01:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329786 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 01:57:39 -0000 Author: kevans Date: Thu Feb 22 01:57:38 2018 New Revision: 329786 URL: https://svnweb.freebsd.org/changeset/base/329786 Log: lualoader: Attach cli command functions to cli module Instead of the global namespace, let's attach these to the cli module. Other users, including the "local" module, can attach functions to the cli module at will to add other cli commands and things will still Just Work. This distills down the candidates for functions that may be invoked via the cli to a minimal set (boot, autoboot, arguments), rather than any function that happens to live in the global lua namespace. Modified: head/stand/lua/cli.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Thu Feb 22 01:50:30 2018 (r329785) +++ head/stand/lua/cli.lua Thu Feb 22 01:57:38 2018 (r329786) @@ -64,24 +64,6 @@ local parse_boot_args = function(argv, with_kernel) end end --- Globals - -function boot(...) - local cmd_name, argv = cli.arguments(...) - local kernel, argstr = parse_boot_args(argv) - if kernel ~= nil then - loader.perform("unload") - config.selectkernel(kernel) - end - core.boot(argstr) -end - -function autoboot(...) - local cmd_name, argv = cli.arguments(...) - local argstr = parse_boot_args(argv, false) - core.autoboot(argstr) -end - -- Declares a global function cli_execute that attempts to dispatch the -- arguments passed as a lua function. This gives lua a chance to intercept -- builtin CLI commands like "boot" @@ -94,7 +76,7 @@ function cli_execute(...) end local cmd_name = argv[1] - local cmd = _G[cmd_name] + local cmd = cli[cmd_name] if cmd ~= nil and type(cmd) == "function" then -- Pass argv wholesale into cmd. We could omit argv[0] since the -- traditional reasons for including it don't necessarily apply, @@ -109,6 +91,23 @@ end -- Module exports +function cli.boot(...) + local cmd_name, argv = cli.arguments(...) + local kernel, argstr = parse_boot_args(argv) + if kernel ~= nil then + loader.perform("unload") + config.selectkernel(kernel) + end + core.boot(argstr) +end + +function cli.autoboot(...) + local cmd_name, argv = cli.arguments(...) + local argstr = parse_boot_args(argv, false) + core.autoboot(argstr) +end + +-- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} local cmd_name = "" From owner-svn-src-all@freebsd.org Thu Feb 22 02:12:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97560F1982A; Thu, 22 Feb 2018 02:12:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 482AA81B96; Thu, 22 Feb 2018 02:12:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4309620FCD; Thu, 22 Feb 2018 02:12:48 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2Cmdt062716; Thu, 22 Feb 2018 02:12:48 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2ClMV062711; Thu, 22 Feb 2018 02:12:47 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802220212.w1M2ClMV062711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 02:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329789 - in stable/11: sbin/geom/class/nop sys/geom/nop tests/sys/geom/class/nop X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: sbin/geom/class/nop sys/geom/nop tests/sys/geom/class/nop X-SVN-Commit-Revision: 329789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:12:48 -0000 Author: asomers Date: Thu Feb 22 02:12:47 2018 New Revision: 329789 URL: https://svnweb.freebsd.org/changeset/base/329789 Log: MFC r328108: gnop(8): add the ability to set a nop provider's physical path While I'm here, expand the existing tests a bit. Differential Revision: https://reviews.freebsd.org/D13579 Modified: stable/11/sbin/geom/class/nop/geom_nop.c stable/11/sbin/geom/class/nop/gnop.8 stable/11/sys/geom/nop/g_nop.c stable/11/sys/geom/nop/g_nop.h stable/11/tests/sys/geom/class/nop/nop_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/nop/geom_nop.c ============================================================================== --- stable/11/sbin/geom/class/nop/geom_nop.c Thu Feb 22 02:02:31 2018 (r329788) +++ stable/11/sbin/geom/class/nop/geom_nop.c Thu Feb 22 02:12:47 2018 (r329789) @@ -49,10 +49,12 @@ struct g_command class_commands[] = { { 's', "size", "0", G_TYPE_NUMBER }, { 'S', "secsize", "0", G_TYPE_NUMBER }, { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, + { 'z', "physpath", G_NOP_PHYSPATH_PASSTHROUGH, G_TYPE_STRING }, G_OPT_SENTINEL }, "[-v] [-e error] [-o offset] [-p stripesize] [-P stripeoffset] " - "[-r rfailprob] [-s size] [-S secsize] [-w wfailprob] dev ..." + "[-r rfailprob] [-s size] [-S secsize] [-w wfailprob] " + "[-z physpath] dev ..." }, { "configure", G_FLAG_VERBOSE, NULL, { Modified: stable/11/sbin/geom/class/nop/gnop.8 ============================================================================== --- stable/11/sbin/geom/class/nop/gnop.8 Thu Feb 22 02:02:31 2018 (r329788) +++ stable/11/sbin/geom/class/nop/gnop.8 Thu Feb 22 02:12:47 2018 (r329789) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 10, 2015 +.Dd January 17, 2018 .Dt GNOP 8 .Os .Sh NAME @@ -42,6 +42,7 @@ .Op Fl s Ar size .Op Fl S Ar secsize .Op Fl w Ar wfailprob +.Op Fl z Ar physpath .Ar dev ... .Nm .Cm configure @@ -132,6 +133,8 @@ Sector size of the transparent provider. Specifies write failure probability in percent. .It Fl v Be more verbose. +.It Fl z Ar physpath +Physical path of the transparent provider. .El .Sh SYSCTL VARIABLES The following Modified: stable/11/sys/geom/nop/g_nop.c ============================================================================== --- stable/11/sys/geom/nop/g_nop.c Thu Feb 22 02:02:31 2018 (r329788) +++ stable/11/sys/geom/nop/g_nop.c Thu Feb 22 02:12:47 2018 (r329789) @@ -124,6 +124,11 @@ g_nop_start(struct bio *bp) break; case BIO_GETATTR: sc->sc_getattrs++; + if (sc->sc_physpath && + g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath)) { + mtx_unlock(&sc->sc_lock); + return; + } break; case BIO_FLUSH: sc->sc_flushes++; @@ -180,7 +185,7 @@ g_nop_access(struct g_provider *pp, int dr, int dw, in static int g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, int ioerror, u_int rfailprob, u_int wfailprob, off_t offset, off_t size, - u_int secsize, u_int stripesize, u_int stripeoffset) + u_int secsize, u_int stripesize, u_int stripeoffset, const char *physpath) { struct g_nop_softc *sc; struct g_geom *gp; @@ -251,6 +256,10 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, sc->sc_explicitsize = explicitsize; sc->sc_stripesize = stripesize; sc->sc_stripeoffset = stripeoffset; + if (physpath && strcmp(physpath, G_NOP_PHYSPATH_PASSTHROUGH)) { + sc->sc_physpath = strndup(physpath, MAXPATHLEN, M_GEOM); + } else + sc->sc_physpath = NULL; sc->sc_error = ioerror; sc->sc_rfailprob = rfailprob; sc->sc_wfailprob = wfailprob; @@ -297,6 +306,7 @@ fail: g_destroy_consumer(cp); g_destroy_provider(newpp); mtx_destroy(&sc->sc_lock); + free(sc->sc_physpath, M_GEOM); g_free(gp->softc); g_destroy_geom(gp); return (error); @@ -312,6 +322,7 @@ g_nop_destroy(struct g_geom *gp, boolean_t force) sc = gp->softc; if (sc == NULL) return (ENXIO); + free(sc->sc_physpath, M_GEOM); pp = LIST_FIRST(&gp->provider); if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) { if (force) { @@ -346,7 +357,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class struct g_provider *pp; intmax_t *error, *rfailprob, *wfailprob, *offset, *secsize, *size, *stripesize, *stripeoffset; - const char *name; + const char *name, *physpath; char param[16]; int i, *nargs; @@ -429,6 +440,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class gctl_error(req, "Invalid '%s' argument", "stripeoffset"); return; } + physpath = gctl_get_asciiparam(req, "physpath"); for (i = 0; i < *nargs; i++) { snprintf(param, sizeof(param), "arg%d", i); @@ -450,7 +462,8 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class *rfailprob == -1 ? 0 : (u_int)*rfailprob, *wfailprob == -1 ? 0 : (u_int)*wfailprob, (off_t)*offset, (off_t)*size, (u_int)*secsize, - (u_int)*stripesize, (u_int)*stripeoffset) != 0) { + (u_int)*stripesize, (u_int)*stripeoffset, + physpath) != 0) { return; } } Modified: stable/11/sys/geom/nop/g_nop.h ============================================================================== --- stable/11/sys/geom/nop/g_nop.h Thu Feb 22 02:02:31 2018 (r329788) +++ stable/11/sys/geom/nop/g_nop.h Thu Feb 22 02:12:47 2018 (r329789) @@ -32,6 +32,11 @@ #define G_NOP_CLASS_NAME "NOP" #define G_NOP_VERSION 4 #define G_NOP_SUFFIX ".nop" +/* + * Special flag to instruct gnop to passthrough the underlying provider's + * physical path + */ +#define G_NOP_PHYSPATH_PASSTHROUGH "\255" #ifdef _KERNEL #define G_NOP_DEBUG(lvl, ...) do { \ @@ -73,6 +78,7 @@ struct g_nop_softc { uintmax_t sc_cmd2s; uintmax_t sc_readbytes; uintmax_t sc_wrotebytes; + char* sc_physpath; struct mtx sc_lock; }; #endif /* _KERNEL */ Modified: stable/11/tests/sys/geom/class/nop/nop_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/nop/nop_test.sh Thu Feb 22 02:02:31 2018 (r329788) +++ stable/11/tests/sys/geom/class/nop/nop_test.sh Thu Feb 22 02:12:47 2018 (r329789) @@ -27,14 +27,14 @@ MD_DEVS="md.devs" PLAINFILES=plainfiles -atf_test_case diskinfo cleanup -diskinfo_head() +atf_test_case preserve_props cleanup +preserve_props_head() { - atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "descr" "gnop should preserve basic GEOM properties" atf_set "require.user" "root" atf_set "timeout" 15 } -diskinfo_body() +preserve_props_body() { load_gnop us=$(alloc_md) @@ -49,11 +49,54 @@ diskinfo_body() atf_check_equal "$md_mediasize" "$nop_mediasize" atf_check_equal "$md_stripesize" "$nop_stripesize" } -diskinfo_cleanup() +preserve_props_cleanup() { common_cleanup } +atf_test_case preserve_disk_props cleanup +preserve_disk_props_head() +{ + atf_set "descr" "gnop should preserve properties for disks" + atf_set "require.user" "root" + atf_set "require.config" "disks" + atf_set "timeout" 15 +} +preserve_disk_props_body() +{ + load_gnop + disks=`atf_config_get disks` + disk=${disks%% *} + if [ -z "$disk" ]; then + atf_skip "Must define disks (see tests(7))" + fi + atf_check gnop create ${disk} + + disk_ident=$(diskinfo -s ${disk}) + disk_physpath=$(diskinfo -p ${disk}) + disk_descr=$(diskinfo -v ${disk} | awk '/Disk descr/ {print $1}') + disk_trim=$(diskinfo -v ${disk} | awk '/TRIM.UNMAP/ {print $1}') + disk_rotrate=$(diskinfo -v ${disk} | awk '/Rotation rate/ {print $1}') + disk_zonemode=$(diskinfo -v ${disk} | awk '/Zone Mode/ {print $1}') + nop_ident=$(diskinfo -s ${disk}.nop) + nop_physpath=$(diskinfo -p ${disk}.nop) + nop_descr=$(diskinfo -v ${disk}.nop | awk '/Disk descr/ {print $1}') + nop_trim=$(diskinfo -v ${disk}.nop | awk '/TRIM.UNMAP/ {print $1}') + nop_rotrate=$(diskinfo -v ${disk}.nop | awk '/Rotation/ {print $1}') + nop_zonemode=$(diskinfo -v ${disk}.nop | awk '/Zone Mode/ {print $1}') + atf_check_equal "$disk_ident" "$nop_ident" + atf_check_equal "$disk_physpath" "$nop_physpath" + atf_check_equal "$disk_descr" "$nop_descr" + atf_check_equal "$disk_trim" "$nop_trim" + atf_check_equal "$disk_rotrate" "$nop_rotrate" + atf_check_equal "$disk_zonemode" "$nop_zonemode" +} +preserve_disk_props_cleanup() +{ + disk_cleanup + common_cleanup +} + atf_test_case io cleanup io_head() { @@ -80,6 +123,54 @@ io_cleanup() common_cleanup } +atf_test_case physpath cleanup +physpath_head() +{ + atf_set "descr" "Test gnop's -z option" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +physpath_body() +{ + load_gnop + us=$(alloc_md) + physpath="some/physical/path" + atf_check gnop create -z $physpath /dev/${us} + gnop_physpath=$(diskinfo -p ${us}.nop) + atf_check_equal "$physpath" "$gnop_physpath" +} +physpath_cleanup() +{ + common_cleanup +} + +atf_test_case physpath_blank cleanup +physpath_blank_head() +{ + atf_set "descr" "gnop can set physical path to the empty string" + atf_set "require.user" "root" + atf_set "require.config" "disks" + atf_set "timeout" 15 +} +physpath_blank_body() +{ + load_gnop + disks=`atf_config_get disks` + disk=${disks%% *} + if [ -z "$disk" ]; then + atf_skip "Must define disks (see tests(7))" + fi + + atf_check gnop create -z "" ${disk} + gnop_physpath=$(diskinfo -p ${disk}.nop) + atf_check_equal "" "$gnop_physpath" +} +physpath_blank_cleanup() +{ + disk_cleanup + common_cleanup +} + atf_test_case size cleanup size_head() { @@ -136,7 +227,10 @@ stripesize_cleanup() atf_init_test_cases() { atf_add_test_case io - atf_add_test_case diskinfo + atf_add_test_case physpath + atf_add_test_case physpath_blank + atf_add_test_case preserve_props + atf_add_test_case preserve_disk_props atf_add_test_case stripesize atf_add_test_case size } @@ -167,6 +261,15 @@ common_cleanup() rm ${PLAINFILES} fi true +} + +disk_cleanup() +{ + disks=`atf_config_get disks` + disk=${disks%% *} + if [ -n "$disk" ]; then + gnop destroy -f ${disk}.nop 2>/dev/null + fi } load_gnop() From owner-svn-src-all@freebsd.org Thu Feb 22 02:16:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E1DCF19E63; Thu, 22 Feb 2018 02:16:45 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF9F781FFB; Thu, 22 Feb 2018 02:16:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D041120FEC; Thu, 22 Feb 2018 02:16:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2GiC3063038; Thu, 22 Feb 2018 02:16:44 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2GiVw063037; Thu, 22 Feb 2018 02:16:44 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802220216.w1M2GiVw063037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 02:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329792 - stable/11/cddl/usr.sbin/zfsd X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/cddl/usr.sbin/zfsd X-SVN-Commit-Revision: 329792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:16:45 -0000 Author: asomers Date: Thu Feb 22 02:16:44 2018 New Revision: 329792 URL: https://svnweb.freebsd.org/changeset/base/329792 Log: MFC r328605: zfsd: Don't spare a vdev that's being replaced If a zfs pool contains a replacing vdev (either created manually by "zpool replace" or by zfsd(8) via autoreplace by physical path) and then new spares get added to the pool, zfsd shouldn't use one to replace the drive that is already being replaced. That's a waste of resources that just slows down the rebuild. PR: 225547 Sponsored by: Spectra Logic Corp Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Feb 22 02:15:45 2018 (r329791) +++ stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Feb 22 02:16:44 2018 (r329792) @@ -442,10 +442,38 @@ CaseFile::ReEvaluate(const ZfsEvent &event) return (consumed || closed); } +/* Find a Vdev containing the vdev with the given GUID */ +static nvlist_t* +find_parent(nvlist_t *pool_config, nvlist_t *config, DevdCtl::Guid child_guid) +{ + nvlist_t **vdevChildren; + int error; + unsigned ch, numChildren; + error = nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN, + &vdevChildren, &numChildren); + + if (error != 0 || numChildren == 0) + return (NULL); + + for (ch = 0; ch < numChildren; ch++) { + nvlist *result; + Vdev vdev(pool_config, vdevChildren[ch]); + + if (vdev.GUID() == child_guid) + return (config); + + result = find_parent(pool_config, vdevChildren[ch], child_guid); + if (result != NULL) + return (result); + } + + return (NULL); +} + bool CaseFile::ActivateSpare() { - nvlist_t *config, *nvroot; + nvlist_t *config, *nvroot, *parent_config; nvlist_t **spares; char *devPath, *vdev_type; const char *poolname; @@ -472,6 +500,22 @@ CaseFile::ActivateSpare() { "tree for pool %s", poolname); return (false); } + + parent_config = find_parent(config, nvroot, m_vdevGUID); + if (parent_config != NULL) { + char *parent_type; + + /* + * Don't activate spares for members of a "replacing" vdev. + * They're already dealt with. Sparing them will just drag out + * the resilver process. + */ + error = nvlist_lookup_string(parent_config, + ZPOOL_CONFIG_TYPE, &parent_type); + if (error == 0 && strcmp(parent_type, VDEV_TYPE_REPLACING) == 0) + return (false); + } + nspares = 0; nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares); From owner-svn-src-all@freebsd.org Thu Feb 22 02:26:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21B2FF1AEDC; Thu, 22 Feb 2018 02:26:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5847829C6; Thu, 22 Feb 2018 02:26:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C05D8211F2; Thu, 22 Feb 2018 02:26:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2QT4G068452; Thu, 22 Feb 2018 02:26:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2QTR2068451; Thu, 22 Feb 2018 02:26:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802220226.w1M2QTR2068451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Feb 2018 02:26:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329796 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 329796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:26:30 -0000 Author: jhb Date: Thu Feb 22 02:26:29 2018 New Revision: 329796 URL: https://svnweb.freebsd.org/changeset/base/329796 Log: Avoid grabbing locks when grabbing the vt(4) console for DDB. Trying to grab locks during cngrab() when entering the debugger is deadlock prone as all other CPUs are already halted (and thus unable to release locks) when cngrab() is invoked. One could instead use try-locks. However, the case that the try-lock fails still has to be handled. In addition, if the try-lock works it doesn't provide any greater ordering guarantees than is already provided by entering and exiting DDB. It is simpler to define a simpler path for the case that the try-lock would fail and always use that when entering DDB. Messing with timers, etc. when entering DDB is dubious even if the try-lock succeeds. This patch attempts to use the smallest possible set of operations to grab the vt(4) console when entering DDB without using any locks. Reviewed by: emaste Tested by: Matthew Macy MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Feb 22 02:25:09 2018 (r329795) +++ head/sys/dev/vt/vt_core.c Thu Feb 22 02:26:29 2018 (r329796) @@ -520,6 +520,27 @@ vt_window_switch(struct vt_window *vw) struct vt_window *curvw = vd->vd_curwindow; keyboard_t *kbd; + if (kdb_active) { + /* + * When grabbing the console for the debugger, avoid + * locks as that can result in deadlock. While this + * could use try locks, that wouldn't really make a + * difference as there are sufficient barriers in + * debugger entry/exit to be equivalent to + * successfully try-locking here. + */ + if (curvw == vw) + return (0); + if (!(vw->vw_flags & (VWF_OPENED|VWF_CONSOLE))) + return (EINVAL); + + vd->vd_curwindow = vw; + vd->vd_flags |= VDF_INVALID; + if (vd->vd_driver->vd_postswitch) + vd->vd_driver->vd_postswitch(vd); + return (0); + } + VT_LOCK(vd); if (curvw == vw) { /* Nothing to do. */ From owner-svn-src-all@freebsd.org Thu Feb 22 02:14:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 347B6F19A41; Thu, 22 Feb 2018 02:14:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D84CF81CDB; Thu, 22 Feb 2018 02:14:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D332720FDE; Thu, 22 Feb 2018 02:14:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2EhRI062835; Thu, 22 Feb 2018 02:14:43 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2EhMb062833; Thu, 22 Feb 2018 02:14:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802220214.w1M2EhMb062833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 02:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329790 - in stable/11: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Commit-Revision: 329790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:14:44 -0000 Author: asomers Date: Thu Feb 22 02:14:43 2018 New Revision: 329790 URL: https://svnweb.freebsd.org/changeset/base/329790 Log: MFC r328266: mlock(2): correct documentation for error conditions. The man page is years out of date regarding errors. Our implementation _does_ allow unaligned addresses, and it _does_not_ check for negative lengths, because the length is unsigned. It checks for overflow instead. Update the tests accordingly. Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D13826 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mlock.c stable/11/lib/libc/sys/mlock.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Thu Feb 22 02:12:47 2018 (r329789) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Thu Feb 22 02:14:43 2018 (r329790) @@ -133,38 +133,43 @@ ATF_TC_BODY(mlock_err, tc) ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); - - errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); +#ifdef __FreeBSD__ + /* Wrap around should return EINVAL */ errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); + errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); +#endif - buf = malloc(page); + buf = malloc(page); /* Get a valid address */ ATF_REQUIRE(buf != NULL); - - /* - * unlocking memory that is not locked is an error... - */ - +#ifdef __FreeBSD__ errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); + /* Wrap around should return EINVAL */ + ATF_REQUIRE_ERRNO(EINVAL, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock(buf, -page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, -page) == -1); +#endif + (void)free(buf); /* There is no sbrk on AArch64 and RISC-V */ #if !defined(__aarch64__) && !defined(__riscv__) /* - * These are permitted to fail (EINVAL) but do not on NetBSD - */ - ATF_REQUIRE(mlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - ATF_REQUIRE(munlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - - (void)free(buf); - - /* * Try to create a pointer to an unmapped page - first after current * brk will likely do. */ @@ -360,6 +365,80 @@ ATF_TC_CLEANUP(mlock_nested, tc) } #endif +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(mlock_unaligned); +#else +ATF_TC(mlock_unaligned); +#endif +ATF_TC_HEAD(mlock_unaligned, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that mlock(2) can lock page-unaligned memory"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif +} + +ATF_TC_BODY(mlock_unaligned, tc) +{ + void *buf, *addr; + +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + + if ((uintptr_t)buf & ((uintptr_t)page - 1)) + addr = buf; + else + addr = (void *)(((uintptr_t)buf) + page/3); + + ATF_REQUIRE_EQ(mlock(addr, page/5), 0); + ATF_REQUIRE_EQ(munlock(addr, page/5), 0); + + (void)free(buf); +} + +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(mlock_unaligned, tc) +{ + + restore_vm_max_wired(); +} +#endif + +ATF_TC(munlock_unlocked); +ATF_TC_HEAD(munlock_unlocked, tc) +{ + atf_tc_set_md_var(tc, "descr", +#ifdef __FreeBSD__ + "munlock(2) accepts unlocked memory"); +#else + "munlock(2) of unlocked memory is an error"); +#endif + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(munlock_unlocked, tc) +{ + void *buf; + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + +#ifdef __FreeBSD__ + ATF_REQUIRE_EQ(munlock(buf, page), 0); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); +#endif + (void)free(buf); +} + ATF_TP_ADD_TCS(tp) { @@ -371,6 +450,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mlock_limits); ATF_TP_ADD_TC(tp, mlock_mmap); ATF_TP_ADD_TC(tp, mlock_nested); + ATF_TP_ADD_TC(tp, mlock_unaligned); + ATF_TP_ADD_TC(tp, munlock_unlocked); return atf_no_error(); } Modified: stable/11/lib/libc/sys/mlock.2 ============================================================================== --- stable/11/lib/libc/sys/mlock.2 Thu Feb 22 02:12:47 2018 (r329789) +++ stable/11/lib/libc/sys/mlock.2 Thu Feb 22 02:14:43 2018 (r329790) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd May 17, 2014 +.Dd Jan 22, 2018 .Dt MLOCK 2 .Os .Sh NAME @@ -125,7 +125,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er EAGAIN Locking the indicated range would exceed the system limit for locked memory. .It Bq Er ENOMEM @@ -143,7 +143,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er ENOMEM Some or all of the address range specified by the addr and len arguments does not correspond to valid mapped pages in the address space From owner-svn-src-all@freebsd.org Thu Feb 22 02:25:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 590E0F1AD9C; Thu, 22 Feb 2018 02:25:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A612828B8; Thu, 22 Feb 2018 02:25:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF04D211E7; Thu, 22 Feb 2018 02:25:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2P9ss068352; Thu, 22 Feb 2018 02:25:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2P9Un068350; Thu, 22 Feb 2018 02:25:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220225.w1M2P9Un068350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 02:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329795 - in vendor-sys/illumos/dist/uts/common: fs/zfs fs/zfs/sys sys/fs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: fs/zfs fs/zfs/sys sys/fs X-SVN-Commit-Revision: 329795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:25:10 -0000 Author: mav Date: Thu Feb 22 02:25:09 2018 New Revision: 329795 URL: https://svnweb.freebsd.org/changeset/base/329795 Log: r329793 | mav | 2018-02-22 04:21:03 +0200 (чт, 22 февр. 2018) | 58 lines 9075 Improve ZFS pool import/load process and corrupted pool recovery illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1 Some work has been done lately to improve the debugability of the ZFS pool load (and import) process. This includes: https://www.illumos.org/issues/7638: Refactor spa_load_impl into several functions https://www.illumos.org/issues/8961: SPA load/import should tell us why it failed https://www.illumos.org/issues/7277: zdb should be able to print zfs_dbgmsg's To iterate on top of that, there's a few changes that were made to make the import process more resilient and crash free. One of the first tasks during the pool load process is to parse a config provided from userland that describes what devices the pool is composed of. A vdev tree is generated from that config, and then all the vdevs are opened. The Meta Object Set (MOS) of the pool is accessed, and several metadata objects that are necessary to load the pool are read. The exact configuration of the pool is also stored inside the MOS. Since the configuration provided from userland is external and might not accurately describe the vdev tree of the pool at the txg that is being loaded, it cannot be relied upon to safely operate the pool. For that reason, the configuration in the MOS is read early on. In the past, the two configurations were compared together and if there was a mismatch then the load process was aborted and an error was returned. The latter was a good way to ensure a pool does not get corrupted, however it made the pool load process needlessly fragile in cases where the vdev configuration changed or the userland configuration was outdated. Since the MOS is stored in 3 copies, the configuration provided by userland doesn't have to be perfect in order to read its contents. Hence, a new approach has been adopted: The pool is first opened with the untrusted userland configuration just so that the real configuration can be read from the MOS. The trusted MOS configuration is then used to generate a new vdev tree and the pool is re-opened. When the pool is opened with an untrusted configuration, writes are disabled to avoid accidentally damaging it. During reads, some sanity checks are performed on block pointers to see if each DVA points to a known vdev; when the configuration is untrusted, instead of panicking the system if those checks fail we simply avoid issuing reads to the invalid DVAs. This new two-step pool load process now allows rewinding pools accross vdev tree changes such as device replacement, addition, etc. Loading a pool from an external config file in a clustering environment also becomes much safer now since the pool will import even if the config is outdated and didn't, for instance, register a recent device addition. With this code in place, it became relatively easy to implement a long-sought-after feature: the ability to import a pool with missing top level (i.e. non-redundant) devices. Note that since this almost guarantees some loss Of data, this feature is for now restricted to a read-only import. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Hans Rosenfeld Author: Pavel Zakharov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 02:24:17 2018 (r329794) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 02:25:09 2018 (r329795) @@ -151,9 +151,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); static boolean_t spa_has_active_shared_spare(spa_t *spa); -static int spa_load_impl(spa_t *spa, uint64_t, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, - char **ereport); +static int spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport, + boolean_t reloading); static void spa_vdev_resilver_done(spa_t *spa); uint_t zio_taskq_batch_pct = 75; /* 1 thread per cpu in pset */ @@ -177,6 +176,54 @@ boolean_t spa_load_verify_dryrun = B_FALSE; #define TRYIMPORT_NAME "$import" /* + * For debugging purposes: print out vdev tree during pool import. + */ +boolean_t spa_load_print_vdev_tree = B_FALSE; + +/* + * A non-zero value for zfs_max_missing_tvds means that we allow importing + * pools with missing top-level vdevs. This is strictly intended for advanced + * pool recovery cases since missing data is almost inevitable. Pools with + * missing devices can only be imported read-only for safety reasons, and their + * fail-mode will be automatically set to "continue". + * + * With 1 missing vdev we should be able to import the pool and mount all + * datasets. User data that was not modified after the missing device has been + * added should be recoverable. This means that snapshots created prior to the + * addition of that device should be completely intact. + * + * With 2 missing vdevs, some datasets may fail to mount since there are + * dataset statistics that are stored as regular metadata. Some data might be + * recoverable if those vdevs were added recently. + * + * With 3 or more missing vdevs, the pool is severely damaged and MOS entries + * may be missing entirely. Chances of data recovery are very low. Note that + * there are also risks of performing an inadvertent rewind as we might be + * missing all the vdevs with the latest uberblocks. + */ +uint64_t zfs_max_missing_tvds = 0; + +/* + * The parameters below are similar to zfs_max_missing_tvds but are only + * intended for a preliminary open of the pool with an untrusted config which + * might be incomplete or out-dated. + * + * We are more tolerant for pools opened from a cachefile since we could have + * an out-dated cachefile where a device removal was not registered. + * We could have set the limit arbitrarily high but in the case where devices + * are really missing we would want to return the proper error codes; we chose + * SPA_DVAS_PER_BP - 1 so that some copies of the MOS would still be available + * and we get a chance to retrieve the trusted config. + */ +uint64_t zfs_max_missing_tvds_cachefile = SPA_DVAS_PER_BP - 1; +/* + * In the case where config was assembled by scanning device paths (/dev/dsks + * by default) we are less tolerant since all the existing devices should have + * been detected and we want spa_load to return the right error codes. + */ +uint64_t zfs_max_missing_tvds_scan = 0; + +/* * ========================================================================== * SPA properties routines * ========================================================================== @@ -1633,13 +1680,34 @@ load_nvlist(spa_t *spa, uint64_t obj, nvlist_t **value } /* + * Concrete top-level vdevs that are not missing and are not logs. At every + * spa_sync we write new uberblocks to at least SPA_SYNC_MIN_VDEVS core tvds. + */ +static uint64_t +spa_healthy_core_tvds(spa_t *spa) +{ + vdev_t *rvd = spa->spa_root_vdev; + uint64_t tvds = 0; + + for (uint64_t i = 0; i < rvd->vdev_children; i++) { + vdev_t *vd = rvd->vdev_child[i]; + if (vd->vdev_islog) + continue; + if (vdev_is_concrete(vd) && !vdev_is_dead(vd)) + tvds++; + } + + return (tvds); +} + +/* * Checks to see if the given vdev could not be opened, in which case we post a * sysevent to notify the autoreplace code that the device has been removed. */ static void spa_check_removed(vdev_t *vd) { - for (int c = 0; c < vd->vdev_children; c++) + for (uint64_t c = 0; c < vd->vdev_children; c++) spa_check_removed(vd->vdev_child[c]); if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) && @@ -1649,38 +1717,14 @@ spa_check_removed(vdev_t *vd) } } -static void -spa_config_valid_zaps(vdev_t *vd, vdev_t *mvd) +static int +spa_check_for_missing_logs(spa_t *spa) { - ASSERT3U(vd->vdev_children, ==, mvd->vdev_children); + vdev_t *rvd = spa->spa_root_vdev; - vd->vdev_top_zap = mvd->vdev_top_zap; - vd->vdev_leaf_zap = mvd->vdev_leaf_zap; - - for (uint64_t i = 0; i < vd->vdev_children; i++) { - spa_config_valid_zaps(vd->vdev_child[i], mvd->vdev_child[i]); - } -} - -/* - * Validate the current config against the MOS config - */ -static boolean_t -spa_config_valid(spa_t *spa, nvlist_t *config) -{ - vdev_t *mrvd, *rvd = spa->spa_root_vdev; - nvlist_t *nv; - - VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nv) == 0); - - spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - VERIFY(spa_config_parse(spa, &mrvd, nv, NULL, 0, VDEV_ALLOC_LOAD) == 0); - - ASSERT3U(rvd->vdev_children, ==, mrvd->vdev_children); - /* * If we're doing a normal import, then build up any additional - * diagnostic information about missing devices in this config. + * diagnostic information about missing log devices. * We'll pass this up to the user for further processing. */ if (!(spa->spa_import_flags & ZFS_IMPORT_MISSING_LOG)) { @@ -1691,109 +1735,52 @@ spa_config_valid(spa_t *spa, nvlist_t *config) KM_SLEEP); VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0); - for (int c = 0; c < rvd->vdev_children; c++) { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; - vdev_t *mtvd = mrvd->vdev_child[c]; - if (tvd->vdev_ops == &vdev_missing_ops && - mtvd->vdev_ops != &vdev_missing_ops && - mtvd->vdev_islog) - child[idx++] = vdev_config_generate(spa, mtvd, - B_FALSE, 0); + /* + * We consider a device as missing only if it failed + * to open (i.e. offline or faulted is not considered + * as missing). + */ + if (tvd->vdev_islog && + tvd->vdev_state == VDEV_STATE_CANT_OPEN) { + child[idx++] = vdev_config_generate(spa, tvd, + B_FALSE, VDEV_CONFIG_MISSING); + } } - if (idx) { - VERIFY(nvlist_add_nvlist_array(nv, - ZPOOL_CONFIG_CHILDREN, child, idx) == 0); - VERIFY(nvlist_add_nvlist(spa->spa_load_info, - ZPOOL_CONFIG_MISSING_DEVICES, nv) == 0); + if (idx > 0) { + fnvlist_add_nvlist_array(nv, + ZPOOL_CONFIG_CHILDREN, child, idx); + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_MISSING_DEVICES, nv); - for (int i = 0; i < idx; i++) + for (uint64_t i = 0; i < idx; i++) nvlist_free(child[i]); } nvlist_free(nv); kmem_free(child, rvd->vdev_children * sizeof (char **)); - } - /* - * Compare the root vdev tree with the information we have - * from the MOS config (mrvd). Check each top-level vdev - * with the corresponding MOS config top-level (mtvd). - */ - for (int c = 0; c < rvd->vdev_children; c++) { - vdev_t *tvd = rvd->vdev_child[c]; - vdev_t *mtvd = mrvd->vdev_child[c]; + if (idx > 0) { + spa_load_failed(spa, "some log devices are missing"); + return (SET_ERROR(ENXIO)); + } + } else { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; - /* - * Resolve any "missing" vdevs in the current configuration. - * Also trust the MOS config about any "indirect" vdevs. - * If we find that the MOS config has more accurate information - * about the top-level vdev then use that vdev instead. - */ - if ((tvd->vdev_ops == &vdev_missing_ops && - mtvd->vdev_ops != &vdev_missing_ops) || - (mtvd->vdev_ops == &vdev_indirect_ops && - tvd->vdev_ops != &vdev_indirect_ops)) { - - /* - * Device specific actions. - */ - if (mtvd->vdev_islog) { - if (!(spa->spa_import_flags & - ZFS_IMPORT_MISSING_LOG)) { - continue; - } - + if (tvd->vdev_islog && + tvd->vdev_state == VDEV_STATE_CANT_OPEN) { spa_set_log_state(spa, SPA_LOG_CLEAR); - } else if (mtvd->vdev_ops != &vdev_indirect_ops) { - continue; + spa_load_note(spa, "some log devices are " + "missing, ZIL is dropped."); + break; } - - /* - * Swap the missing vdev with the data we were - * able to obtain from the MOS config. - */ - vdev_remove_child(rvd, tvd); - vdev_remove_child(mrvd, mtvd); - - vdev_add_child(rvd, mtvd); - vdev_add_child(mrvd, tvd); - - vdev_reopen(rvd); - } else { - if (mtvd->vdev_islog) { - /* - * Load the slog device's state from the MOS - * config since it's possible that the label - * does not contain the most up-to-date - * information. - */ - vdev_load_log_state(tvd, mtvd); - vdev_reopen(tvd); - } - - /* - * Per-vdev ZAP info is stored exclusively in the MOS. - */ - spa_config_valid_zaps(tvd, mtvd); } - - /* - * Never trust this info from userland; always use what's - * in the MOS. This prevents it from getting out of sync - * with the rest of the info in the MOS. - */ - tvd->vdev_removing = mtvd->vdev_removing; - tvd->vdev_indirect_config = mtvd->vdev_indirect_config; } - vdev_free(mrvd); - spa_config_exit(spa, SCL_ALL, FTAG); - - /* - * Ensure we were able to validate the config. - */ - return (rvd->vdev_guid_sum == spa->spa_uberblock.ub_guid_sum); + return (0); } /* @@ -2175,55 +2162,17 @@ spa_try_repair(spa_t *spa, nvlist_t *config) } static int -spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type, - boolean_t trust_config) +spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type) { - nvlist_t *config = spa->spa_config; char *ereport = FM_EREPORT_ZFS_POOL; - char *comment; int error; - uint64_t pool_guid; - nvlist_t *nvl; - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid)) - return (SET_ERROR(EINVAL)); + spa->spa_load_state = state; - ASSERT(spa->spa_comment == NULL); - if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) - spa->spa_comment = spa_strdup(comment); + gethrestime(&spa->spa_loaded_ts); + error = spa_load_impl(spa, type, &ereport, B_FALSE); /* - * Versioning wasn't explicitly added to the label until later, so if - * it's not present treat it as the initial version. - */ - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, - &spa->spa_ubsync.ub_version) != 0) - spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; - - (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, - &spa->spa_config_txg); - - if ((state == SPA_LOAD_IMPORT || state == SPA_LOAD_TRYIMPORT) && - spa_guid_exists(pool_guid, 0)) { - error = SET_ERROR(EEXIST); - } else { - spa->spa_config_guid = pool_guid; - - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_SPLIT, - &nvl) == 0) { - VERIFY(nvlist_dup(nvl, &spa->spa_config_splitting, - KM_SLEEP) == 0); - } - - nvlist_free(spa->spa_load_info); - spa->spa_load_info = fnvlist_alloc(); - - gethrestime(&spa->spa_loaded_ts); - error = spa_load_impl(spa, pool_guid, config, state, type, - trust_config, &ereport); - } - - /* * Don't count references from objsets that are already closed * and are making their way through the eviction process. */ @@ -2273,23 +2222,87 @@ vdev_count_verify_zaps(vdev_t *vd) } static int -spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_import_type_t type) +spa_verify_host(spa_t *spa, nvlist_t *mos_config) { + uint64_t hostid; + char *hostname; + uint64_t myhostid = 0; + + if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_HOSTID, &hostid) == 0) { + hostname = fnvlist_lookup_string(mos_config, + ZPOOL_CONFIG_HOSTNAME); + + myhostid = zone_get_hostid(NULL); + + if (hostid != 0 && myhostid != 0 && hostid != myhostid) { + cmn_err(CE_WARN, "pool '%s' could not be " + "loaded as it was last accessed by " + "another system (host: %s hostid: 0x%llx). " + "See: http://illumos.org/msg/ZFS-8000-EY", + spa_name(spa), hostname, (u_longlong_t)hostid); + spa_load_failed(spa, "hostid verification failed: pool " + "last accessed by host: %s (hostid: 0x%llx)", + hostname, (u_longlong_t)hostid); + return (SET_ERROR(EBADF)); + } + } + + return (0); +} + +static int +spa_ld_parse_config(spa_t *spa, spa_import_type_t type) +{ int error = 0; - nvlist_t *nvtree = NULL; + nvlist_t *nvtree, *nvl, *config = spa->spa_config; int parse; vdev_t *rvd; + uint64_t pool_guid; + char *comment; + /* + * Versioning wasn't explicitly added to the label until later, so if + * it's not present treat it as the initial version. + */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &spa->spa_ubsync.ub_version) != 0) + spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; + + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid)) { + spa_load_failed(spa, "invalid config provided: '%s' missing", + ZPOOL_CONFIG_POOL_GUID); + return (SET_ERROR(EINVAL)); + } + + if ((spa->spa_load_state == SPA_LOAD_IMPORT || spa->spa_load_state == + SPA_LOAD_TRYIMPORT) && spa_guid_exists(pool_guid, 0)) { + spa_load_failed(spa, "a pool with guid %llu is already open", + (u_longlong_t)pool_guid); + return (SET_ERROR(EEXIST)); + } + + spa->spa_config_guid = pool_guid; + + nvlist_free(spa->spa_load_info); + spa->spa_load_info = fnvlist_alloc(); + + ASSERT(spa->spa_comment == NULL); + if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) + spa->spa_comment = spa_strdup(comment); + + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, + &spa->spa_config_txg); + + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_SPLIT, &nvl) == 0) + spa->spa_config_splitting = fnvlist_dup(nvl); + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) { spa_load_failed(spa, "invalid config provided: '%s' missing", ZPOOL_CONFIG_VDEV_TREE); return (SET_ERROR(EINVAL)); } - parse = (type == SPA_IMPORT_EXISTING ? - VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); - /* * Create "The Godfather" zio to hold all async IOs */ @@ -2307,6 +2320,8 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv * configuration requires knowing the version number. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + parse = (type == SPA_IMPORT_EXISTING ? + VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); @@ -2327,71 +2342,105 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv return (0); } +/* + * Recursively open all vdevs in the vdev tree. This function is called twice: + * first with the untrusted config, then with the trusted config. + */ static int spa_ld_open_vdevs(spa_t *spa) { int error = 0; + /* + * spa_missing_tvds_allowed defines how many top-level vdevs can be + * missing/unopenable for the root vdev to be still considered openable. + */ + if (spa->spa_trust_config) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds; + } else if (spa->spa_config_source == SPA_CONFIG_SRC_CACHEFILE) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds_cachefile; + } else if (spa->spa_config_source == SPA_CONFIG_SRC_SCAN) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds_scan; + } else { + spa->spa_missing_tvds_allowed = 0; + } + + spa->spa_missing_tvds_allowed = + MAX(zfs_max_missing_tvds, spa->spa_missing_tvds_allowed); + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); + + if (spa->spa_missing_tvds != 0) { + spa_load_note(spa, "vdev tree has %lld missing top-level " + "vdevs.", (u_longlong_t)spa->spa_missing_tvds); + if (spa->spa_trust_config && (spa->spa_mode & FWRITE)) { + /* + * Although theoretically we could allow users to open + * incomplete pools in RW mode, we'd need to add a lot + * of extra logic (e.g. adjust pool space to account + * for missing vdevs). + * This limitation also prevents users from accidentally + * opening the pool in RW mode during data recovery and + * damaging it further. + */ + spa_load_note(spa, "pools with missing top-level " + "vdevs can only be opened in read-only mode."); + error = SET_ERROR(ENXIO); + } else { + spa_load_note(spa, "current settings allow for maximum " + "%lld missing top-level vdevs at this stage.", + (u_longlong_t)spa->spa_missing_tvds_allowed); + } + } if (error != 0) { spa_load_failed(spa, "unable to open vdev tree [error=%d]", error); } + if (spa->spa_missing_tvds != 0 || error != 0) + vdev_dbgmsg_print_tree(spa->spa_root_vdev, 2); return (error); } +/* + * We need to validate the vdev labels against the configuration that + * we have in hand. This function is called twice: first with an untrusted + * config, then with a trusted config. The validation is more strict when the + * config is trusted. + */ static int -spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type, - boolean_t trust_config) +spa_ld_validate_vdevs(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; - /* - * We need to validate the vdev labels against the configuration that - * we have in hand, which is dependent on the setting of trust_config. - * If trust_config is true then we're validating the vdev labels based - * on that config. Otherwise, we're validating against the cached - * config (zpool.cache) that was read when we loaded the zfs module, and - * then later we will recursively call spa_load() and validate against - * the vdev config. - * - * If we're assembling a new pool that's been split off from an - * existing pool, the labels haven't yet been updated so we skip - * validation for now. - */ - if (type != SPA_IMPORT_ASSEMBLE) { - spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = vdev_validate(rvd, trust_config); - spa_config_exit(spa, SCL_ALL, FTAG); + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + error = vdev_validate(rvd); + spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) { - spa_load_failed(spa, "vdev_validate failed [error=%d]", - error); - return (error); - } + if (error != 0) { + spa_load_failed(spa, "vdev_validate failed [error=%d]", error); + return (error); + } - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { - spa_load_failed(spa, "cannot open vdev tree after " - "invalidating some vdevs"); - return (SET_ERROR(ENXIO)); - } + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "cannot open vdev tree after invalidating " + "some vdevs"); + vdev_dbgmsg_print_tree(rvd, 2); + return (SET_ERROR(ENXIO)); } return (0); } static int -spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, spa_import_type_t type, - boolean_t trust_config) +spa_ld_select_uberblock(spa_t *spa, spa_import_type_t type) { vdev_t *rvd = spa->spa_root_vdev; nvlist_t *label; uberblock_t *ub = &spa->spa_uberblock; - uint64_t children; /* * Find the best uberblock. @@ -2484,26 +2533,9 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, nvlist_free(unsup_feat); } - /* - * If the vdev guid sum doesn't match the uberblock, we have an - * incomplete configuration. We first check to see if the pool - * is aware of the complete config (i.e ZPOOL_CONFIG_VDEV_CHILDREN). - * If it is, defer the vdev_guid_sum check till later so we - * can handle missing vdevs. - */ - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, - &children) != 0 && trust_config && type != SPA_IMPORT_ASSEMBLE && - rvd->vdev_guid_sum != ub->ub_guid_sum) { - spa_load_failed(spa, "guid sum in config doesn't match guid " - "sum in uberblock (%llu != %llu)", - (u_longlong_t)rvd->vdev_guid_sum, - (u_longlong_t)ub->ub_guid_sum); - return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); - } - if (type != SPA_IMPORT_ASSEMBLE && spa->spa_config_splitting) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - spa_try_repair(spa, config); + spa_try_repair(spa, spa->spa_config); spa_config_exit(spa, SCL_ALL, FTAG); nvlist_free(spa->spa_config_splitting); spa->spa_config_splitting = NULL; @@ -2542,49 +2574,167 @@ spa_ld_open_rootbp(spa_t *spa) } static int -spa_ld_validate_config(spa_t *spa, spa_import_type_t type) +spa_ld_load_trusted_config(spa_t *spa, spa_import_type_t type, + boolean_t reloading) { - vdev_t *rvd = spa->spa_root_vdev; + vdev_t *mrvd, *rvd = spa->spa_root_vdev; + nvlist_t *nv, *mos_config, *policy; + int error = 0, copy_error; + uint64_t healthy_tvds, healthy_tvds_mos; + uint64_t mos_config_txg; if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* - * Validate the config, using the MOS config to fill in any - * information which might be missing. If we fail to validate - * the config then declare the pool unfit for use. If we're - * assembling a pool from a split, the log is not transferred - * over. + * If we're assembling a pool from a split, the config provided is + * already trusted so there is nothing to do. */ - if (type != SPA_IMPORT_ASSEMBLE) { - nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) - != 0) { - spa_load_failed(spa, "unable to retrieve MOS config"); - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } + if (type == SPA_IMPORT_ASSEMBLE) + return (0); - if (!spa_config_valid(spa, mos_config)) { + healthy_tvds = spa_healthy_core_tvds(spa); + + if (load_nvlist(spa, spa->spa_config_object, &mos_config) + != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } + + /* + * If we are doing an open, pool owner wasn't verified yet, thus do + * the verification here. + */ + if (spa->spa_load_state == SPA_LOAD_OPEN) { + error = spa_verify_host(spa, mos_config); + if (error != 0) { nvlist_free(mos_config); - spa_load_failed(spa, "mismatch between config provided " - "and config stored in MOS"); - return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, - ENXIO)); + return (error); } - nvlist_free(mos_config); + } + nv = fnvlist_lookup_nvlist(mos_config, ZPOOL_CONFIG_VDEV_TREE); + + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + + /* + * Build a new vdev tree from the trusted config + */ + VERIFY(spa_config_parse(spa, &mrvd, nv, NULL, 0, VDEV_ALLOC_LOAD) == 0); + + /* + * Vdev paths in the MOS may be obsolete. If the untrusted config was + * obtained by scanning /dev/dsk, then it will have the right vdev + * paths. We update the trusted MOS config with this information. + * We first try to copy the paths with vdev_copy_path_strict, which + * succeeds only when both configs have exactly the same vdev tree. + * If that fails, we fall back to a more flexible method that has a + * best effort policy. + */ + copy_error = vdev_copy_path_strict(rvd, mrvd); + if (copy_error != 0 || spa_load_print_vdev_tree) { + spa_load_note(spa, "provided vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + spa_load_note(spa, "MOS vdev tree:"); + vdev_dbgmsg_print_tree(mrvd, 2); + } + if (copy_error != 0) { + spa_load_note(spa, "vdev_copy_path_strict failed, falling " + "back to vdev_copy_path_relaxed"); + vdev_copy_path_relaxed(rvd, mrvd); + } + + vdev_close(rvd); + vdev_free(rvd); + spa->spa_root_vdev = mrvd; + rvd = mrvd; + spa_config_exit(spa, SCL_ALL, FTAG); + + /* + * We will use spa_config if we decide to reload the spa or if spa_load + * fails and we rewind. We must thus regenerate the config using the + * MOS information with the updated paths. Rewind policy is an import + * setting and is not in the MOS. We copy it over to our new, trusted + * config. + */ + mos_config_txg = fnvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_POOL_TXG); + nvlist_free(mos_config); + mos_config = spa_config_generate(spa, NULL, mos_config_txg, B_FALSE); + if (nvlist_lookup_nvlist(spa->spa_config, ZPOOL_REWIND_POLICY, + &policy) == 0) + fnvlist_add_nvlist(mos_config, ZPOOL_REWIND_POLICY, policy); + spa_config_set(spa, mos_config); + spa->spa_config_source = SPA_CONFIG_SRC_MOS; + + /* + * Now that we got the config from the MOS, we should be more strict + * in checking blkptrs and can make assumptions about the consistency + * of the vdev tree. spa_trust_config must be set to true before opening + * vdevs in order for them to be writeable. + */ + spa->spa_trust_config = B_TRUE; + + /* + * Open and validate the new vdev tree + */ + error = spa_ld_open_vdevs(spa); + if (error != 0) + return (error); + + error = spa_ld_validate_vdevs(spa); + if (error != 0) + return (error); + + if (copy_error != 0 || spa_load_print_vdev_tree) { + spa_load_note(spa, "final vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + } + + if (spa->spa_load_state != SPA_LOAD_TRYIMPORT && + !spa->spa_extreme_rewind && zfs_max_missing_tvds == 0) { /* - * Now that we've validated the config, check the state of the - * root vdev. If it can't be opened, it indicates one or - * more toplevel vdevs are faulted. + * Sanity check to make sure that we are indeed loading the + * latest uberblock. If we missed SPA_SYNC_MIN_VDEVS tvds + * in the config provided and they happened to be the only ones + * to have the latest uberblock, we could involuntarily perform + * an extreme rewind. */ - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { - spa_load_failed(spa, "some top vdevs are unavailable"); - return (SET_ERROR(ENXIO)); + healthy_tvds_mos = spa_healthy_core_tvds(spa); + if (healthy_tvds_mos - healthy_tvds >= + SPA_SYNC_MIN_VDEVS) { + spa_load_note(spa, "config provided misses too many " + "top-level vdevs compared to MOS (%lld vs %lld). ", + (u_longlong_t)healthy_tvds, + (u_longlong_t)healthy_tvds_mos); + spa_load_note(spa, "vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + if (reloading) { + spa_load_failed(spa, "config was already " + "provided from MOS. Aborting."); + return (spa_vdev_err(rvd, + VDEV_AUX_CORRUPT_DATA, EIO)); + } + spa_load_note(spa, "spa must be reloaded using MOS " + "config"); + return (SET_ERROR(EAGAIN)); } } + error = spa_check_for_missing_logs(spa); + if (error != 0) + return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); + + if (rvd->vdev_guid_sum != spa->spa_uberblock.ub_guid_sum) { + spa_load_failed(spa, "uberblock guid sum doesn't match MOS " + "guid sum (%llu != %llu)", + (u_longlong_t)spa->spa_uberblock.ub_guid_sum, + (u_longlong_t)rvd->vdev_guid_sum); + return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, + ENXIO)); + } + return (0); } @@ -2751,62 +2901,6 @@ spa_ld_load_special_directories(spa_t *spa) } static int -spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) -{ - vdev_t *rvd = spa->spa_root_vdev; - - uint64_t hostid; - nvlist_t *policy = NULL; - nvlist_t *mos_config; - - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { - spa_load_failed(spa, "unable to retrieve MOS config"); - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } - - if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, - ZPOOL_CONFIG_HOSTID, &hostid) == 0) { - char *hostname; - unsigned long myhostid = 0; - - VERIFY(nvlist_lookup_string(mos_config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); - -#ifdef _KERNEL - myhostid = zone_get_hostid(NULL); -#else /* _KERNEL */ - /* - * We're emulating the system's hostid in userland, so - * we can't use zone_get_hostid(). - */ - (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); -#endif /* _KERNEL */ - if (hostid != 0 && myhostid != 0 && - hostid != myhostid) { - nvlist_free(mos_config); - cmn_err(CE_WARN, "pool '%s' could not be " - "loaded as it was last accessed by " - "another system (host: %s hostid: 0x%lx). " - "See: http://illumos.org/msg/ZFS-8000-EY", - spa_name(spa), hostname, - (unsigned long)hostid); - return (SET_ERROR(EBADF)); - } - } - if (nvlist_lookup_nvlist(spa->spa_config, - ZPOOL_REWIND_POLICY, &policy) == 0) - VERIFY(nvlist_add_nvlist(mos_config, - ZPOOL_REWIND_POLICY, policy) == 0); - - spa_config_set(spa, mos_config); - spa_unload(spa); - spa_deactivate(spa); - spa_activate(spa, orig_mode); - - return (0); -} - -static int spa_ld_get_props(spa_t *spa) { int error = 0; @@ -2933,6 +3027,19 @@ spa_ld_get_props(spa_t *spa) spa->spa_autoreplace = (autoreplace != 0); } + /* + * If we are importing a pool with missing top-level vdevs, + * we enforce that the pool doesn't panic or get suspended on + * error since the likelihood of missing data is extremely high. + */ + if (spa->spa_missing_tvds > 0 && + spa->spa_failmode != ZIO_FAILURE_MODE_CONTINUE && + spa->spa_load_state != SPA_LOAD_TRYIMPORT) { + spa_load_note(spa, "forcing failmode to 'continue' " + "as some top level vdevs are missing"); + spa->spa_failmode = ZIO_FAILURE_MODE_CONTINUE; + } + return (0); } @@ -3063,9 +3170,15 @@ spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa)) { boolean_t missing = spa_check_logs(spa); if (missing) { - *ereport = FM_EREPORT_ZFS_LOG_REPLAY; - spa_load_failed(spa, "spa_check_logs failed"); - return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); + if (spa->spa_missing_tvds != 0) { + spa_load_note(spa, "spa_check_logs failed " + "so dropping the logs"); + } else { + *ereport = FM_EREPORT_ZFS_LOG_REPLAY; + spa_load_failed(spa, "spa_check_logs failed"); + return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, + ENXIO)); + } } } @@ -3121,7 +3234,8 @@ spa_ld_claim_log_blocks(spa_t *spa) } static void -spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg) +spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg, + boolean_t reloading) { vdev_t *rvd = spa->spa_root_vdev; int need_update = B_FALSE; @@ -3133,7 +3247,7 @@ spa_ld_check_for_config_update(spa_t *spa, uint64_t co * If this is a verbatim import, trust the current * in-core spa_config and update the disk labels. */ - if (config_cache_txg != spa->spa_config_txg || + if (reloading || config_cache_txg != spa->spa_config_txg || spa->spa_load_state == SPA_LOAD_IMPORT || spa->spa_load_state == SPA_LOAD_RECOVER || (spa->spa_import_flags & ZFS_IMPORT_VERBATIM)) @@ -3151,6 +3265,24 @@ spa_ld_check_for_config_update(spa_t *spa, uint64_t co spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); } +static void +spa_ld_prepare_for_reload(spa_t *spa) +{ + int mode = spa->spa_mode; + int async_suspended = spa->spa_async_suspended; + + spa_unload(spa); + spa_deactivate(spa); + spa_activate(spa, mode); + + /* + * We save the value of spa_async_suspended as it gets reset to 0 by + * spa_unload(). We want to restore it back to the original value before + * returning as we might be calling spa_async_resume() later. + */ + spa->spa_async_suspended = async_suspended; +} + /* * Load an existing storage pool, using the config provided. This config * describes which vdevs are part of the pool and is later validated against @@ -3158,32 +3290,35 @@ spa_ld_check_for_config_update(spa_t *spa, uint64_t co * config stored in the MOS. */ static int -spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, - char **ereport) +spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport, + boolean_t reloading) { int error = 0; - uint64_t config_cache_txg = spa->spa_config_txg; - int orig_mode = spa->spa_mode; boolean_t missing_feat_write = B_FALSE; ASSERT(MUTEX_HELD(&spa_namespace_lock)); + ASSERT(spa->spa_config_source != SPA_CONFIG_SRC_NONE); - spa->spa_load_state = state; - spa_load_note(spa, "LOADING"); - /* - * If this is an untrusted config, first access the pool in read-only - * mode. We will then retrieve a trusted copy of the config from the MOS - * and use it to reopen the pool in read-write mode. + * Never trust the config that is provided unless we are assembling + * a pool following a split. + * This means don't trust blkptrs and the vdev tree in general. This + * also effectively puts the spa in read-only mode since + * spa_writeable() checks for spa_trust_config to be true. + * We will later load a trusted config from the MOS. */ - if (!trust_config) - spa->spa_mode = FREAD; + if (type != SPA_IMPORT_ASSEMBLE) + spa->spa_trust_config = B_FALSE; + if (reloading) + spa_load_note(spa, "RELOADING"); + else + spa_load_note(spa, "LOADING"); + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 02:24:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 777ADF1ABBD; Thu, 22 Feb 2018 02:24:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 297BF82742; Thu, 22 Feb 2018 02:24:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24310211DD; Thu, 22 Feb 2018 02:24:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2OJVI068262; Thu, 22 Feb 2018 02:24:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2OHTT068244; Thu, 22 Feb 2018 02:24:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802220224.w1M2OHTT068244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Feb 2018 02:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329794 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Commit-Revision: 329794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:24:19 -0000 Author: emaste Date: Thu Feb 22 02:24:17 2018 New Revision: 329794 URL: https://svnweb.freebsd.org/changeset/base/329794 Log: Correct proper nouns in the Linuxulator - Capitalize Linux - Spell FreeBSD out in full - Address some style(9) on changed lines Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_socket.c head/sys/i386/linux/imgact_linux.c head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/linux_machdep.c head/sys/i386/linux/linux_ptrace.c head/sys/i386/linux/linux_sysvec.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux/linux_dummy.c Thu Feb 22 02:24:17 2018 (r329794) @@ -44,15 +44,15 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(epoll_ctl_old); UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(get_thread_area); UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */ +UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */ +UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); UNIMPLEMENTED(tuxcall); @@ -84,74 +84,74 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); -/* linux 2.6.11: */ +/* Linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); -/* linux 2.6.13: */ +/* Linux 2.6.13: */ DUMMY(ioprio_set); DUMMY(ioprio_get); DUMMY(inotify_init); DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); -/* linux 2.6.16: */ +/* Linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); -/* linux 2.6.17: */ +/* Linux 2.6.17: */ DUMMY(splice); DUMMY(tee); DUMMY(sync_file_range); DUMMY(vmsplice); -/* linux 2.6.18: */ +/* Linux 2.6.18: */ DUMMY(move_pages); -/* linux 2.6.22: */ +/* Linux 2.6.22: */ DUMMY(signalfd); -/* linux 2.6.27: */ +/* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.31: */ +/* Linux 2.6.31: */ DUMMY(perf_event_open); -/* linux 2.6.38: */ +/* Linux 2.6.38: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.39: */ +/* Linux 2.6.39: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); DUMMY(clock_adjtime); -/* linux 3.0: */ +/* Linux 3.0: */ DUMMY(setns); DUMMY(getcpu); -/* linux 3.2: */ +/* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); -/* linux 3.5: */ +/* Linux 3.5: */ DUMMY(kcmp); -/* linux 3.8: */ +/* Linux 3.8: */ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* linux 3.14: */ +/* Linux 3.14: */ DUMMY(renameat2); -/* linux 3.15: */ +/* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); DUMMY(kexec_file_load); -/* linux 3.18: */ +/* Linux 3.18: */ DUMMY(bpf); -/* linux 3.19: */ +/* Linux 3.19: */ DUMMY(execveat); -/* linux 4.2: */ +/* Linux 4.2: */ DUMMY(userfaultfd); -/* linux 4.3: */ +/* Linux 4.3: */ DUMMY(membarrier); -/* linux 4.4: */ +/* Linux 4.4: */ DUMMY(mlock2); -/* linux 4.5: */ +/* Linux 4.5: */ DUMMY(copy_file_range); -/* linux 4.6: */ +/* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); -/* linux 4.8: */ +/* Linux 4.8: */ DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux/linux_sysvec.c Thu Feb 22 02:24:17 2018 (r329794) @@ -705,9 +705,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse } /* - * If a linux binary is exec'ing something, try this image activator + * If a Linux binary is exec'ing something, try this image activator * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a linux + * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ static int exec_linux_imgact_try(struct image_params *iparams); @@ -720,9 +720,9 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a linux binary needs + * The interpreter for shell scripts run from a Linux binary needs * to be located in /compat/linux if possible in order to recursively - * maintain linux path emulation. + * maintain Linux path emulation. */ if (((const short *)head)[0] == SHELLMAGIC) { /* @@ -881,7 +881,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel return (FALSE); /* - * For linux we encode osrel as follows (see linux_mib.c): + * For Linux we encode osrel as follows (see linux_mib.c): * VVVMMMIII (version, major, minor), see linux_mib.c. */ *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; Modified: head/sys/amd64/linux/syscalls.master ============================================================================== --- head/sys/amd64/linux/syscalls.master Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux/syscalls.master Thu Feb 22 02:24:17 2018 (r329794) @@ -487,7 +487,7 @@ struct l_itimerspec *old_value); } 288 AUE_ACCEPT STD { int linux_accept4(l_int s, l_uintptr_t addr, \ l_uintptr_t namelen, int flags); } -; linux 2.6.27: +; Linux 2.6.27: 289 AUE_NULL STD { int linux_signalfd4(void); } 290 AUE_NULL STD { int linux_eventfd2(l_uint initval, l_int flags); } 291 AUE_NULL STD { int linux_epoll_create1(l_int flags); } @@ -495,41 +495,41 @@ l_int newfd, l_int flags); } 293 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 294 AUE_NULL STD { int linux_inotify_init1(l_int flags); } -; linux 2.6.30: +; Linux 2.6.30: 295 AUE_NULL STD { int linux_preadv(l_ulong fd, \ struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h); } 296 AUE_NULL STD { int linux_pwritev(l_ulong fd, \ struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h); } -; linux 2.6.31: +; Linux 2.6.31: 297 AUE_NULL STD { int linux_rt_tgsigqueueinfo(l_pid_t tgid, \ l_pid_t tid, l_int sig, l_siginfo_t *uinfo); } 298 AUE_NULL STD { int linux_perf_event_open(void); } -; linux 2.6.33: +; Linux 2.6.33: 299 AUE_NULL STD { int linux_recvmmsg(l_int s, \ struct l_mmsghdr *msg, l_uint vlen, \ l_uint flags, struct l_timespec *timeout); } -; linux 2.6.37: +; Linux 2.6.37: 300 AUE_NULL STD { int linux_fanotify_init(void); } 301 AUE_NULL STD { int linux_fanotify_mark(void); } -; linux 2.6.36: +; Linux 2.6.36: 302 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, l_uint resource, \ struct rlimit *new, struct rlimit *old); } -; linux 2.6.39 (glibc 2.14): +; Linux 2.6.39 (glibc 2.14): 303 AUE_NULL STD { int linux_name_to_handle_at(void); } 304 AUE_NULL STD { int linux_open_by_handle_at(void); } 305 AUE_NULL STD { int linux_clock_adjtime(void); } 306 AUE_SYNC STD { int linux_syncfs(l_int fd); } -; linux 3.0 (glibc 2.14): +; Linux 3.0 (glibc 2.14): 307 AUE_NULL STD { int linux_sendmmsg(l_int s, \ struct l_mmsghdr *msg, l_uint vlen, \ l_uint flags); } 308 AUE_NULL STD { int linux_setns(l_int fd, l_int nstype); } -; linux 2.6.19 (no glibc wrapper): +; Linux 2.6.19 (no glibc wrapper): 309 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ void *cache); } -; linux 3.2 (glibc 2.15): +; Linux 3.2 (glibc 2.15): 310 AUE_NULL STD { int linux_process_vm_readv(l_pid_t pid, \ const struct iovec *lvec, l_ulong liovcnt, \ const struct iovec *rvec, l_ulong riovcnt, \ @@ -538,22 +538,22 @@ const struct iovec *lvec, l_ulong liovcnt, \ const struct iovec *rvec, l_ulong riovcnt, \ l_ulong flags); } -; linux 3.5 (no glibc wrapper): +; Linux 3.5 (no glibc wrapper): 312 AUE_NULL STD { int linux_kcmp(l_pid_t pid1, l_pid_t pid2, \ l_int type, l_ulong idx1, l_ulong idx); } -; linux 3.8 (no glibc wrapper): +; Linux 3.8 (no glibc wrapper): 313 AUE_NULL STD { int linux_finit_module(l_int fd, \ const char *uargs, l_int flags); } -; linux 3.14: +; Linux 3.14: 314 AUE_NULL STD { int linux_sched_setattr(l_pid_t pid, \ void *attr, l_uint flags); } 315 AUE_NULL STD { int linux_sched_getattr(l_pid_t pid, \ void *attr, l_uint size, l_uint flags); } -; linux 3.15: +; Linux 3.15: 316 AUE_NULL STD { int linux_renameat2(l_int oldfd, \ const char *oldname, l_int newfd, \ const char *newname, unsigned int flags); } -; linux 3.17: +; Linux 3.17: 317 AUE_NULL STD { int linux_seccomp(l_uint op, l_uint flags, \ const char *uargs); } 318 AUE_NULL STD { int linux_getrandom(char *buf, \ @@ -563,33 +563,33 @@ 320 AUE_NULL STD { int linux_kexec_file_load(l_int kernel_fd, \ l_int initrd_fd, l_ulong cmdline_len, \ const char *cmdline_ptr, l_ulong flags); } -; linux 3.18: +; Linux 3.18: 321 AUE_NULL STD { int linux_bpf(l_int cmd, void *attr, \ l_uint size); } -; linux 3.19: +; Linux 3.19: 322 AUE_NULL STD { int linux_execveat(l_int dfd, \ const char *filename, const char **argv, \ const char **envp, l_int flags); } -; linux 4.2: +; Linux 4.2: 323 AUE_NULL STD { int linux_userfaultfd(l_int flags); } -; linux 4.3: +; Linux 4.3: 324 AUE_NULL STD { int linux_membarrier(l_int cmd, l_int flags); } -; linux 4.4: +; Linux 4.4: 325 AUE_NULL STD { int linux_mlock2(l_ulong start, l_size_t len, \ l_int flags); } -; linux 4.5: +; Linux 4.5: 326 AUE_NULL STD { int linux_copy_file_range(l_int fd_in, \ l_loff_t *off_in, l_int fd_out, \ l_loff_t *off_out, l_size_t len, \ l_uint flags); } -; linux 4.6: +; Linux 4.6: 327 AUE_NULL STD { int linux_preadv2(l_ulong fd, \ const struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h, l_int flags); } 328 AUE_NULL STD { int linux_pwritev2(l_ulong fd, \ const struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h, l_int flags); } -; linux 4.8: +; Linux 4.8: 329 AUE_NULL STD { int linux_pkey_mprotect(l_ulong start, \ l_size_t len, l_ulong prot, l_int pkey); } 330 AUE_NULL STD { int linux_pkey_alloc(l_ulong flags, \ Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux32/linux32_dummy.c Thu Feb 22 02:24:17 2018 (r329794) @@ -1,3 +1,4 @@ + sys/sys/sysent.2 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * @@ -47,19 +48,19 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); UNIMPLEMENTED(afs_syscall); UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */ +UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */ +UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); UNIMPLEMENTED(vserver); @@ -92,74 +93,74 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); -/* linux 2.6.11: */ +/* Linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); -/* linux 2.6.13: */ +/* Linux 2.6.13: */ DUMMY(ioprio_set); DUMMY(ioprio_get); DUMMY(inotify_init); DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); -/* linux 2.6.16: */ +/* Linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); -/* linux 2.6.17: */ +/* Linux 2.6.17: */ DUMMY(splice); DUMMY(sync_file_range); DUMMY(tee); DUMMY(vmsplice); -/* linux 2.6.18: */ +/* Linux 2.6.18: */ DUMMY(move_pages); -/* linux 2.6.19: */ +/* Linux 2.6.19: */ DUMMY(getcpu); -/* linux 2.6.22: */ +/* Linux 2.6.22: */ DUMMY(signalfd); -/* linux 2.6.27: */ +/* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.31: */ +/* Linux 2.6.31: */ DUMMY(perf_event_open); -/* linux 2.6.33: */ +/* Linux 2.6.33: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.39: */ +/* Linux 2.6.39: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); DUMMY(clock_adjtime); -/* linux 3.0: */ +/* Linux 3.0: */ DUMMY(setns); -/* linux 3.2: */ +/* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); -/* linux 3.5: */ +/* Linux 3.5: */ DUMMY(kcmp); -/* linux 3.8: */ +/* Linux 3.8: */ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* linux 3.14: */ +/* Linux 3.14: */ DUMMY(renameat2); -/* linux 3.15: */ +/* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); -/* linux 3.18: */ +/* Linux 3.18: */ DUMMY(bpf); -/* linux 3.19: */ +/* Linux 3.19: */ DUMMY(execveat); -/* linux 4.2: */ +/* Linux 4.2: */ DUMMY(userfaultfd); -/* linux 4.3: */ +/* Linux 4.3: */ DUMMY(membarrier); -/* linux 4.4: */ +/* Linux 4.4: */ DUMMY(mlock2); -/* linux 4.5: */ +/* Linux 4.5: */ DUMMY(copy_file_range); -/* linux 4.6: */ +/* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); -/* linux 4.8: */ +/* Linux 4.8: */ DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Feb 22 02:24:17 2018 (r329794) @@ -759,9 +759,9 @@ linux32_fetch_syscall_args(struct thread *td) } /* - * If a linux binary is exec'ing something, try this image activator + * If a Linux binary is exec'ing something, try this image activator * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a linux + * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ static int exec_linux_imgact_try(struct image_params *iparams); @@ -774,9 +774,9 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a linux binary needs + * The interpreter for shell scripts run from a Linux binary needs * to be located in /compat/linux if possible in order to recursively - * maintain linux path emulation. + * maintain Linux path emulation. */ if (((const short *)head)[0] == SHELLMAGIC) { /* @@ -1096,7 +1096,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr return (FALSE); /* - * For linux we encode osrel as follows (see linux_mib.c): + * For Linux we encode osrel as follows (see linux_mib.c): * VVVMMMIII (version, major, minor), see linux_mib.c. */ *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/amd64/linux32/syscalls.master Thu Feb 22 02:24:17 2018 (r329794) @@ -463,7 +463,7 @@ 274 AUE_NULL STD { int linux_mbind(void); } 275 AUE_NULL STD { int linux_get_mempolicy(void); } 276 AUE_NULL STD { int linux_set_mempolicy(void); } -; linux 2.6.6: +; Linux 2.6.6: 277 AUE_NULL STD { int linux_mq_open(void); } 278 AUE_NULL STD { int linux_mq_unlink(void); } 279 AUE_NULL STD { int linux_mq_timedsend(void); } @@ -475,17 +475,17 @@ l_siginfo_t *info, int options, \ struct l_rusage *rusage); } 285 AUE_NULL UNIMPL -; linux 2.6.11: +; Linux 2.6.11: 286 AUE_NULL STD { int linux_add_key(void); } 287 AUE_NULL STD { int linux_request_key(void); } 288 AUE_NULL STD { int linux_keyctl(void); } -; linux 2.6.13: +; Linux 2.6.13: 289 AUE_NULL STD { int linux_ioprio_set(void); } 290 AUE_NULL STD { int linux_ioprio_get(void); } 291 AUE_NULL STD { int linux_inotify_init(void); } 292 AUE_NULL STD { int linux_inotify_add_watch(void); } 293 AUE_NULL STD { int linux_inotify_rm_watch(void); } -; linux 2.6.16: +; Linux 2.6.16: 294 AUE_NULL STD { int linux_migrate_pages(void); } 295 AUE_OPEN_RWTC STD { int linux_openat(l_int dfd, const char *filename, \ l_int flags, l_int mode); } @@ -519,7 +519,7 @@ 309 AUE_POLL STD { int linux_ppoll(struct pollfd *fds, uint32_t nfds, \ struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); } 310 AUE_NULL STD { int linux_unshare(void); } -; linux 2.6.17: +; Linux 2.6.17: 311 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \ l_size_t len); } 312 AUE_NULL STD { int linux_get_robust_list(l_int pid, \ @@ -528,29 +528,29 @@ 314 AUE_NULL STD { int linux_sync_file_range(void); } 315 AUE_NULL STD { int linux_tee(void); } 316 AUE_NULL STD { int linux_vmsplice(void); } -; linux 2.6.18: +; Linux 2.6.18: 317 AUE_NULL STD { int linux_move_pages(void); } -; linux 2.6.19: +; Linux 2.6.19: 318 AUE_NULL STD { int linux_getcpu(void); } 319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } -; linux 2.6.22: +; Linux 2.6.22: 320 AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, const char *pathname, \ const struct l_timespec *times, l_int flags); } 321 AUE_NULL STD { int linux_signalfd(void); } 322 AUE_NULL STD { int linux_timerfd_create(l_int clockid, l_int flags); } 323 AUE_NULL STD { int linux_eventfd(l_uint initval); } -; linux 2.6.23: +; Linux 2.6.23: 324 AUE_NULL STD { int linux_fallocate(l_int fd, l_int mode, \ l_loff_t offset, l_loff_t len); } -; linux 2.6.25: +; Linux 2.6.25: 325 AUE_NULL STD { int linux_timerfd_settime(l_int fd, l_int flags, \ const struct l_itimerspec *new_value, \ struct l_itimerspec *old_value); } 326 AUE_NULL STD { int linux_timerfd_gettime(l_int fd, \ struct l_itimerspec *old_value); } -; linux 2.6.27: +; Linux 2.6.27: 327 AUE_NULL STD { int linux_signalfd4(void); } 328 AUE_NULL STD { int linux_eventfd2(l_uint initval, l_int flags); } 329 AUE_NULL STD { int linux_epoll_create1(l_int flags); } @@ -558,39 +558,39 @@ l_int newfd, l_int flags); } 331 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 332 AUE_NULL STD { int linux_inotify_init1(void); } -; linux 2.6.30: +; Linux 2.6.30: 333 AUE_NULL STD { int linux_preadv(l_ulong fd, \ struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h); } 334 AUE_NULL STD { int linux_pwritev(l_ulong fd, \ struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h); } -; linux 2.6.31: +; Linux 2.6.31: 335 AUE_NULL STD { int linux_rt_tgsigqueueinfo(l_pid_t tgid, \ l_pid_t tid, l_int sig, l_siginfo_t *uinfo); } 336 AUE_NULL STD { int linux_perf_event_open(void); } -; linux 2.6.33: +; Linux 2.6.33: 337 AUE_NULL STD { int linux_recvmmsg(l_int s, \ struct l_mmsghdr *msg, l_uint vlen, \ l_uint flags, struct l_timespec *timeout); } 338 AUE_NULL STD { int linux_fanotify_init(void); } 339 AUE_NULL STD { int linux_fanotify_mark(void); } -; linux 2.6.36: +; Linux 2.6.36: 340 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ l_uint resource, \ struct rlimit *new, \ struct rlimit *old); } -; linux 2.6.39: +; Linux 2.6.39: 341 AUE_NULL STD { int linux_name_to_handle_at(void); } 342 AUE_NULL STD { int linux_open_by_handle_at(void); } 343 AUE_NULL STD { int linux_clock_adjtime(void); } 344 AUE_SYNC STD { int linux_syncfs(l_int fd); } -; linux 3.0: +; Linux 3.0: 345 AUE_NULL STD { int linux_sendmmsg(l_int s, \ struct l_mmsghdr *msg, l_uint vlen, \ l_uint flags); } 346 AUE_NULL STD { int linux_setns(void); } -; linux 3.2 (glibc 2.15): +; Linux 3.2 (glibc 2.15): 347 AUE_NULL STD { int linux_process_vm_readv(l_pid_t pid, \ const struct iovec *lvec, l_ulong liovcnt, \ const struct iovec *rvec, l_ulong riovcnt, \ @@ -599,36 +599,36 @@ const struct iovec *lvec, l_ulong liovcnt, \ const struct iovec *rvec, l_ulong riovcnt, \ l_ulong flags); } -; linux 3.5 (no glibc wrapper): +; Linux 3.5 (no glibc wrapper): 349 AUE_NULL STD { int linux_kcmp(l_pid_t pid1, l_pid_t pid2, \ l_int type, l_ulong idx1, l_ulong idx); } -; linux 3.8 (no glibc wrapper): +; Linux 3.8 (no glibc wrapper): 350 AUE_NULL STD { int linux_finit_module(l_int fd, \ const char *uargs, l_int flags); } -; linux 3.14: +; Linux 3.14: 351 AUE_NULL STD { int linux_sched_setattr(l_pid_t pid, \ void *attr, l_uint flags); } 352 AUE_NULL STD { int linux_sched_getattr(l_pid_t pid, \ void *attr, l_uint size, l_uint flags); } -; linux 3.15: +; Linux 3.15: 353 AUE_NULL STD { int linux_renameat2(l_int oldfd, \ const char *oldname, l_int newfd, \ const char *newname, unsigned int flags); } -; linux 3.17: +; Linux 3.17: 354 AUE_NULL STD { int linux_seccomp(l_uint op, l_uint flags, \ const char *uargs); } 355 AUE_NULL STD { int linux_getrandom(char *buf, \ l_size_t count, l_uint flags); } 356 AUE_NULL STD { int linux_memfd_create(const char *uname_ptr, \ l_uint flags); } -; linux 3.18: +; Linux 3.18: 357 AUE_NULL STD { int linux_bpf(l_int cmd, void *attr, \ l_uint size); } -; linux 3.19: +; Linux 3.19: 358 AUE_NULL STD { int linux_execveat(l_int dfd, \ const char *filename, const char **argv, \ const char **envp, l_int flags); } -; linux 4.3: sockets now direct system calls: +; Linux 4.3: sockets now direct system calls: 359 AUE_SOCKET STD { int linux_socket(l_int domain, l_int type, \ l_int protocol); } 360 AUE_SOCKETPAIR STD { int linux_socketpair(l_int domain, \ @@ -662,26 +662,26 @@ l_int flags); } 373 AUE_NULL STD { int linux_shutdown(l_int s, l_int how); } ; -; linux 4.2: +; Linux 4.2: 374 AUE_NULL STD { int linux_userfaultfd(l_int flags); } -; linux 4.3: +; Linux 4.3: 375 AUE_NULL STD { int linux_membarrier(l_int cmd, l_int flags); } -; linux 4.4: +; Linux 4.4: 376 AUE_NULL STD { int linux_mlock2(l_ulong start, l_size_t len, \ l_int flags); } -; linux 4.5: +; Linux 4.5: 377 AUE_NULL STD { int linux_copy_file_range(l_int fd_in, \ l_loff_t *off_in, l_int fd_out, \ l_loff_t *off_out, l_size_t len, \ l_uint flags); } -; linux 4.6: +; Linux 4.6: 378 AUE_NULL STD { int linux_preadv2(l_ulong fd, \ const struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h, l_int flags); } 379 AUE_NULL STD { int linux_pwritev2(l_ulong fd, \ const struct iovec *vec, l_ulong vlen, \ l_ulong pos_l, l_ulong pos_h, l_int flags); } -; linux 4.8: +; Linux 4.8: 380 AUE_NULL STD { int linux_pkey_mprotect(l_ulong start, \ l_size_t len, l_ulong prot, l_int pkey); } 381 AUE_NULL STD { int linux_pkey_alloc(l_ulong flags, \ Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_emul.c Thu Feb 22 02:24:17 2018 (r329794) @@ -193,7 +193,7 @@ linux_common_execve(struct thread *td, struct image_ar /* * In a case of transition from Linux binary execing to - * FreeBSD binary we destroy linux emuldata thread & proc entries. + * FreeBSD binary we destroy Linux emuldata thread & proc entries. */ if (SV_CURPROC_ABI() != SV_ABI_LINUX) { PROC_LOCK(p); @@ -228,7 +228,7 @@ linux_proc_exec(void *arg __unused, struct proc *p, st #endif /* - * In a case of execing from linux binary properly detach + * In a case of execing from Linux binary properly detach * other threads from the user space. */ if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { @@ -239,7 +239,7 @@ linux_proc_exec(void *arg __unused, struct proc *p, st } /* - * In a case of execing to linux binary we create linux + * In a case of execing to Linux binary we create Linux * emuldata thread entry. */ if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_file.c Thu Feb 22 02:24:17 2018 (r329794) @@ -525,7 +525,7 @@ linux_access(struct thread *td, struct linux_access_ar char *path; int error; - /* linux convention */ + /* Linux convention. */ if (args->amode & ~(F_OK | X_OK | W_OK | R_OK)) return (EINVAL); @@ -548,7 +548,7 @@ linux_faccessat(struct thread *td, struct linux_facces char *path; int error, dfd; - /* linux convention */ + /* Linux convention. */ if (args->amode & ~(F_OK | X_OK | W_OK | R_OK)) return (EINVAL); @@ -991,7 +991,7 @@ linux_pread(struct thread *td, struct linux_pread_args error = kern_pread(td, uap->fd, uap->buf, uap->nbyte, uap->offset); if (error == 0) { - /* This seems to violate POSIX but linux does it */ + /* This seems to violate POSIX but Linux does it. */ error = fgetvp(td, uap->fd, cap_rights_init(&rights, CAP_PREAD), &vp); if (error != 0) Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_ioctl.c Thu Feb 22 02:24:17 2018 (r329794) @@ -171,7 +171,7 @@ struct handler_element static TAILQ_HEAD(, handler_element) handlers = TAILQ_HEAD_INITIALIZER(handlers); static struct sx linux_ioctl_sx; -SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "linux ioctl handlers"); +SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "Linux ioctl handlers"); /* * hdio related ioctls for VMWare support @@ -1340,7 +1340,7 @@ bsd_to_linux_dvd_struct(struct dvd_struct *bp, l_dvd_s lp->manufact.len = bp->length; memcpy(lp->manufact.value, bp->data, sizeof(lp->manufact.value)); - /* lp->manufact.layer_num is unused in linux (redhat 7.0) */ + /* lp->manufact.layer_num is unused in Linux (redhat 7.0). */ break; default: return (EINVAL); @@ -2902,7 +2902,7 @@ linux_v4l_clip_copy(void *lvc, struct video_clip **ppv linux_to_bsd_v4l_clip(&l_vclip, &vclip); /* XXX: If there can be no concurrency: s/M_NOWAIT/M_WAITOK/ */ if ((*ppvc = malloc(sizeof(**ppvc), M_LINUX, M_NOWAIT)) == NULL) - return (ENOMEM); /* XXX: linux has no ENOMEM here */ + return (ENOMEM); /* XXX: Linux has no ENOMEM here. */ memcpy(*ppvc, &vclip, sizeof(vclip)); (*ppvc)->next = NULL; return (0); Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_mib.c Thu Feb 22 02:24:17 2018 (r329794) @@ -434,7 +434,7 @@ linux_osd_jail_register(void) linux_osd_jail_slot = osd_jail_register(linux_prison_destructor, methods); - /* Copy the system linux info to any current prisons. */ + /* Copy the system Linux info to any current prisons. */ sx_slock(&allprison_lock); TAILQ_FOREACH(pr, &allprison, pr_list) linux_alloc_prison(pr, NULL); Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_misc.c Thu Feb 22 02:24:17 2018 (r329794) @@ -1997,7 +1997,7 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_NAME: /* * To be on the safe side we need to make sure to not - * overflow the size a linux program expects. We already + * overflow the size a Linux program expects. We already * do this here in the copyin, so that we don't need to * check on copyout. */ Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/compat/linux/linux_socket.c Thu Feb 22 02:24:17 2018 (r329794) @@ -83,7 +83,7 @@ static int linux_recvmsg_common(struct thread *, l_int static int linux_set_socket_flags(int, int *); /* - * Reads a linux sockaddr and does any necessary translation. + * Reads a Linux sockaddr and does any necessary translation. * Linux sockaddrs don't have a length field, only a family. * Copy the osockaddr structure pointed to by osa to kernel, adjust * family and convert to sockaddr. Modified: head/sys/i386/linux/imgact_linux.c ============================================================================== --- head/sys/i386/linux/imgact_linux.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/imgact_linux.c Thu Feb 22 02:24:17 2018 (r329794) @@ -235,5 +235,5 @@ fail: /* * Tell kern_execve.c about it, with a little help from the linker. */ -static struct execsw linux_execsw = { exec_linux_imgact, "linux a.out" }; +static struct execsw linux_execsw = { exec_linux_imgact, "Linux a.out" }; EXEC_SET(linuxaout, linux_execsw); Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/linux_dummy.c Thu Feb 22 02:24:17 2018 (r329794) @@ -47,19 +47,19 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); UNIMPLEMENTED(afs_syscall); UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */ +UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */ +UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); UNIMPLEMENTED(vserver); @@ -88,74 +88,74 @@ DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); DUMMY(kexec_load); -/* linux 2.6.11: */ +/* Linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); -/* linux 2.6.13: */ +/* Linux 2.6.13: */ DUMMY(ioprio_set); DUMMY(ioprio_get); DUMMY(inotify_init); DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); -/* linux 2.6.16: */ +/* Linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); -/* linux 2.6.17: */ +/* Linux 2.6.17: */ DUMMY(splice); DUMMY(sync_file_range); DUMMY(tee); DUMMY(vmsplice); -/* linux 2.6.18: */ +/* Linux 2.6.18: */ DUMMY(move_pages); -/* linux 2.6.19: */ +/* Linux 2.6.19: */ DUMMY(getcpu); -/* linux 2.6.22: */ +/* Linux 2.6.22: */ DUMMY(signalfd); -/* linux 2.6.27: */ +/* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.31: */ +/* Linux 2.6.31: */ DUMMY(perf_event_open); -/* linux 2.6.33: */ +/* Linux 2.6.33: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.39: */ +/* Linux 2.6.39: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); DUMMY(clock_adjtime); -/* linux 3.0: */ +/* Linux 3.0: */ DUMMY(setns); -/* linux 3.2: */ +/* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); -/* linux 3.5: */ +/* Linux 3.5: */ DUMMY(kcmp); -/* linux 3.8: */ +/* Linux 3.8: */ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* linux 3.14: */ +/* Linux 3.14: */ DUMMY(renameat2); -/* linux 3.15: */ +/* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); -/* linux 3.18: */ +/* Linux 3.18: */ DUMMY(bpf); -/* linux 3.19: */ +/* Linux 3.19: */ DUMMY(execveat); -/* linux 4.2: */ +/* Linux 4.2: */ DUMMY(userfaultfd); -/* linux 4.3: */ +/* Linux 4.3: */ DUMMY(membarrier); -/* linux 4.4: */ +/* Linux 4.4: */ DUMMY(mlock2); -/* linux 4.5: */ +/* Linux 4.5: */ DUMMY(copy_file_range); -/* linux 4.6: */ +/* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); -/* linux 4.8: */ +/* Linux 4.8: */ DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/linux_machdep.c Thu Feb 22 02:24:17 2018 (r329794) @@ -650,20 +650,20 @@ linux_set_thread_area(struct thread *td, struct linux_ idx = info.entry_number; /* - * Semantics of linux version: every thread in the system has array of + * Semantics of Linux version: every thread in the system has array of * 3 tls descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. This * syscall loads one of the selected tls decriptors with a value and * also loads GDT descriptors 6, 7 and 8 with the content of the * per-thread descriptors. * - * Semantics of fbsd version: I think we can ignore that linux has 3 + * Semantics of FreeBSD version: I think we can ignore that Linux has 3 * per-thread descriptors and use just the 1st one. The tls_array[] * is used only in set/get-thread_area() syscalls and for loading the - * GDT descriptors. In fbsd we use just one GDT descriptor for TLS so - * we will load just one. + * GDT descriptors. In FreeBSD we use just one GDT descriptor for TLS + * so we will load just one. * * XXX: this doesn't work when a user space process tries to use more - * than 1 TLS segment. Comment in the linux sources says wine might do + * than 1 TLS segment. Comment in the Linux sources says wine might do * this. */ Modified: head/sys/i386/linux/linux_ptrace.c ============================================================================== --- head/sys/i386/linux/linux_ptrace.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/linux_ptrace.c Thu Feb 22 02:24:17 2018 (r329794) @@ -412,7 +412,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar if (uap->addr < 0 || uap->addr & (sizeof(l_int) - 1)) break; /* - * Allow linux programs to access register values in + * Allow Linux programs to access register values in * user struct. We simulate this through PT_GET/SETREGS * as necessary. */ Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/linux_sysvec.c Thu Feb 22 02:24:17 2018 (r329794) @@ -880,9 +880,9 @@ linux_fetch_syscall_args(struct thread *td) } /* - * If a linux binary is exec'ing something, try this image activator + * If a Linux binary is exec'ing something, try this image activator * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a linux + * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ static int exec_linux_imgact_try(struct image_params *iparams); @@ -895,9 +895,9 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a linux binary needs + * The interpreter for shell scripts run from a Linux binary needs * to be located in /compat/linux if possible in order to recursively - * maintain linux path emulation. + * maintain Linux path emulation. */ if (((const short *)head)[0] == SHELLMAGIC) { /* @@ -1077,7 +1077,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel return (FALSE); /* - * For linux we encode osrel as follows (see linux_mib.c): + * For Linux we encode osrel as follows (see linux_mib.c): * VVVMMMIII (version, major, minor), see linux_mib.c. */ *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Thu Feb 22 02:21:03 2018 (r329793) +++ head/sys/i386/linux/syscalls.master Thu Feb 22 02:24:17 2018 (r329794) @@ -465,7 +465,7 @@ 274 AUE_NULL STD { int linux_mbind(void); } 275 AUE_NULL STD { int linux_get_mempolicy(void); } 276 AUE_NULL STD { int linux_set_mempolicy(void); } -; linux 2.6.6: +; Linux 2.6.6: 277 AUE_NULL STD { int linux_mq_open(const char *name, int oflag, mode_t mode, \ struct mq_attr *attr); } 278 AUE_NULL STD { int linux_mq_unlink(const char *name); } @@ -483,17 +483,17 @@ l_siginfo_t *info, int options, \ void *rusage); } 285 AUE_NULL UNIMPL *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 02:21:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6E65F1A5DC; Thu, 22 Feb 2018 02:21:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4881E8246D; Thu, 22 Feb 2018 02:21:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 436EF21046; Thu, 22 Feb 2018 02:21:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2L4Jq065452; Thu, 22 Feb 2018 02:21:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2L3dj065445; Thu, 22 Feb 2018 02:21:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220221.w1M2L3dj065445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 02:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329793 - in vendor/illumos/dist: cmd/zpool lib/libzfs/common lib/libzpool/common lib/libzpool/common/sys X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor/illumos/dist: cmd/zpool lib/libzfs/common lib/libzpool/common lib/libzpool/common/sys X-SVN-Commit-Revision: 329793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:21:04 -0000 Author: mav Date: Thu Feb 22 02:21:03 2018 New Revision: 329793 URL: https://svnweb.freebsd.org/changeset/base/329793 Log: 9075 Improve ZFS pool import/load process and corrupted pool recovery illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1 Some work has been done lately to improve the debugability of the ZFS pool load (and import) process. This includes: https://www.illumos.org/issues/7638: Refactor spa_load_impl into several functions https://www.illumos.org/issues/8961: SPA load/import should tell us why it failed https://www.illumos.org/issues/7277: zdb should be able to print zfs_dbgmsg's To iterate on top of that, there's a few changes that were made to make the import process more resilient and crash free. One of the first tasks during the pool load process is to parse a config provided from userland that describes what devices the pool is composed of. A vdev tree is generated from that config, and then all the vdevs are opened. The Meta Object Set (MOS) of the pool is accessed, and several metadata objects that are necessary to load the pool are read. The exact configuration of the pool is also stored inside the MOS. Since the configuration provided from userland is external and might not accurately describe the vdev tree of the pool at the txg that is being loaded, it cannot be relied upon to safely operate the pool. For that reason, the configuration in the MOS is read early on. In the past, the two configurations were compared together and if there was a mismatch then the load process was aborted and an error was returned. The latter was a good way to ensure a pool does not get corrupted, however it made the pool load process needlessly fragile in cases where the vdev configuration changed or the userland configuration was outdated. Since the MOS is stored in 3 copies, the configuration provided by userland doesn't have to be perfect in order to read its contents. Hence, a new approach has been adopted: The pool is first opened with the untrusted userland configuration just so that the real configuration can be read from the MOS. The trusted MOS configuration is then used to generate a new vdev tree and the pool is re-opened. When the pool is opened with an untrusted configuration, writes are disabled to avoid accidentally damaging it. During reads, some sanity checks are performed on block pointers to see if each DVA points to a known vdev; when the configuration is untrusted, instead of panicking the system if those checks fail we simply avoid issuing reads to the invalid DVAs. This new two-step pool load process now allows rewinding pools accross vdev tree changes such as device replacement, addition, etc. Loading a pool from an external config file in a clustering environment also becomes much safer now since the pool will import even if the config is outdated and didn't, for instance, register a recent device addition. With this code in place, it became relatively easy to implement a long-sought-after feature: the ability to import a pool with missing top level (i.e. non-redundant) devices. Note that since this almost guarantees some loss Of data, this feature is for now restricted to a read-only import. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Hans Rosenfeld Author: Pavel Zakharov Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Feb 22 02:21:03 2018 (r329793) @@ -1562,6 +1562,10 @@ print_status_config(zpool_handle_t *zhp, const char *n (void) printf(gettext("split into new pool")); break; + case VDEV_AUX_CHILDREN_OFFLINE: + (void) printf(gettext("all children offline")); + break; + default: (void) printf(gettext("corrupted data")); break; @@ -1649,6 +1653,10 @@ print_import_config(const char *name, nvlist_t *nv, in (void) printf(gettext("too many errors")); break; + case VDEV_AUX_CHILDREN_OFFLINE: + (void) printf(gettext("all children offline")); + break; + default: (void) printf(gettext("corrupted data")); break; @@ -2296,6 +2304,7 @@ zpool_do_import(int argc, char **argv) idata.poolname = searchname; idata.guid = searchguid; idata.cachefile = cachefile; + idata.policy = policy; pools = zpool_search_import(g_zfs, &idata); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Thu Feb 22 02:21:03 2018 (r329793) @@ -388,6 +388,7 @@ typedef struct importargs { int can_be_active : 1; /* can the pool be active? */ int unique : 1; /* does 'poolname' already exist? */ int exists : 1; /* set on return if pool already exists */ + nvlist_t *policy; /* rewind policy (rewind txg, etc.) */ } importargs_t; extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_import.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Thu Feb 22 02:21:03 2018 (r329793) @@ -412,7 +412,8 @@ vdev_is_hole(uint64_t *hole_array, uint_t holes, uint_ * return to the user. */ static nvlist_t * -get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok) +get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, + nvlist_t *policy) { pool_entry_t *pe; vdev_entry_t *ve; @@ -746,6 +747,12 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boo continue; } + if (policy != NULL) { + if (nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY, + policy) != 0) + goto nomem; + } + if ((nvl = refresh_config(hdl, config)) == NULL) { nvlist_free(config); config = NULL; @@ -1251,7 +1258,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importarg goto error; } - ret = get_configs(hdl, &pools, iarg->can_be_active); + ret = get_configs(hdl, &pools, iarg->can_be_active, iarg->policy); error: for (pe = pools.pools; pe != NULL; pe = penext) { @@ -1380,6 +1387,14 @@ zpool_find_import_cached(libzfs_handle_t *hdl, const c if (active) continue; + + if (nvlist_add_string(src, ZPOOL_CONFIG_CACHEFILE, + cachefile) != 0) { + (void) no_memory(hdl); + nvlist_free(raw); + nvlist_free(pools); + return (NULL); + } if ((dst = refresh_config(hdl, src)) == NULL) { nvlist_free(raw); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Thu Feb 22 02:21:03 2018 (r329793) @@ -1808,8 +1808,9 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *con nvlist_lookup_nvlist(nvinfo, ZPOOL_CONFIG_MISSING_DEVICES, &missing) == 0) { (void) printf(dgettext(TEXT_DOMAIN, - "The devices below are missing, use " - "'-m' to import the pool anyway:\n")); + "The devices below are missing or " + "corrupted, use '-m' to import the pool " + "anyway:\n")); print_vdev_tree(hdl, NULL, missing, 2); (void) printf("\n"); } Modified: vendor/illumos/dist/lib/libzpool/common/kernel.c ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/kernel.c Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/lib/libzpool/common/kernel.c Thu Feb 22 02:21:03 2018 (r329793) @@ -461,6 +461,16 @@ kernel_fini(void) system_taskq_fini(); } +/* ARGSUSED */ +uint32_t +zone_get_hostid(void *zonep) +{ + /* + * We're emulating the system's hostid in userland. + */ + return (strtoul(hw_serial, NULL, 10)); +} + int z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen) { Modified: vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Thu Feb 22 02:16:44 2018 (r329792) +++ vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h Thu Feb 22 02:21:03 2018 (r329793) @@ -317,6 +317,7 @@ typedef struct callb_cpr { #define zone_dataset_visible(x, y) (1) #define INGLOBALZONE(z) (1) +extern uint32_t zone_get_hostid(void *zonep); extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr); extern int zfs_secpolicy_rename_perms(const char *from, const char *to, From owner-svn-src-all@freebsd.org Thu Feb 22 02:39:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5E76F1C6F8; Thu, 22 Feb 2018 02:39:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73A69835E6; Thu, 22 Feb 2018 02:39:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55955213FB; Thu, 22 Feb 2018 02:39:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M2dXh0073344; Thu, 22 Feb 2018 02:39:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M2dXae073343; Thu, 22 Feb 2018 02:39:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802220239.w1M2dXae073343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 22 Feb 2018 02:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329797 - stable/11/share/misc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/misc X-SVN-Commit-Revision: 329797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 02:39:34 -0000 Author: eadler Date: Thu Feb 22 02:39:33 2018 New Revision: 329797 URL: https://svnweb.freebsd.org/changeset/base/329797 Log: MFC r326633 r327282 r328085 r329311: share: update pci_vendors to 2018.02.15 Modified: stable/11/share/misc/pci_vendors Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/pci_vendors ============================================================================== --- stable/11/share/misc/pci_vendors Thu Feb 22 02:26:29 2018 (r329796) +++ stable/11/share/misc/pci_vendors Thu Feb 22 02:39:33 2018 (r329797) @@ -1,10 +1,9 @@ # $FreeBSD$ -# # List of PCI ID's # -# Version: 2017.12.06 -# Date: 2017-12-06 03:15:02 +# Version: 2018.02.15 +# Date: 2018-02-15 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -44,6 +43,7 @@ # nee nCipher 0100 Thales e-Security 0123 General Dynamics +0128 Dell (wrong ID) # 018a is not LevelOne but there is a board misprogrammed 018a LevelOne 0106 FPC-0106TX misprogrammed [RTL81xx] @@ -251,6 +251,7 @@ 1028 1fd4 PERC H745P MX 1d49 0602 ThinkSystem RAID 930-16i 4GB Flash PCIe 12Gb Adapter 1d49 0604 ThinkSystem RAID 930-8e 4GB Flash PCIe 12Gb Adapter + 1d49 0607 ThinkSystem RAID 930-16i 8GB Flash PCIe 12Gb Adapter 8086 352d Integrated RAID Module RMSP3AD160F 8086 9460 RAID Controller RSP3TD160F 8086 9480 RAID Controller RSP3MD088F @@ -586,6 +587,7 @@ 0096 SAS3004 PCI-Express Fusion-MPT SAS-3 0097 SAS3008 PCI-Express Fusion-MPT SAS-3 1000 3090 SAS9311-8i + 1000 30a0 SAS9300-8e 1000 30e0 SAS9300-8i 1000 3130 SAS 9300-16i 1028 1f45 HBA330 Adapter @@ -751,7 +753,8 @@ 131b Kaveri [Radeon R4 Graphics] 131c Kaveri [Radeon R7 Graphics] 131d Kaveri [Radeon R6 Graphics] - 15dd Radeon Vega 8 Mobile + 15dd Vega [Radeon Vega 8 Mobile] + 15ff Vega [Radeon Vega 28 Mobile] 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -783,7 +786,7 @@ 18bc 0101 GC-R9600PRO (Primary) 4151 RV350 [Radeon 9600 Series] 1043 c004 A9600SE - 174b 7c37 Radeon 9600 SE + 174b 7c37 Radeon 9600SE 128M DDR V/D/VO 4152 RV360 [Radeon 9600/X1050 Series] 1002 0002 Radeon 9600XT 1002 4772 All-in-Wonder 9600 XT @@ -813,7 +816,7 @@ 18bc 0100 GC-R9600PRO (Secondary) 4171 RV350 [Radeon 9600] (Secondary) 1043 c005 A9600SE (Secondary) - 174b 7c36 Radeon 9600 SE (secondary) + 174b 7c36 Radeon 9600SE 128M DDR V/D/VO (secondary) 4172 RV350 [Radeon 9600/X1050 Series] (Secondary) 1002 0003 Radeon 9600XT (Secondary) 1002 4773 All-in-Wonder 9600 XT (Secondary) @@ -920,6 +923,7 @@ 1043 836c M4A785TD Motherboard 1043 8410 M4A89GTD PRO/USB3 Motherboard 1043 841b M5A88-V EVO + 1043 8445 M5A78L LE 105b 0e13 N15235/A74MX mainboard / AMD SB700 1179 ff50 Satellite P305D-S8995E 1458 a022 GA-MA770-DS3rev2.0 Motherboard @@ -1606,6 +1610,7 @@ 1028 0684 FirePro W4170M 6607 Mars LE [Radeon HD 8530M / R5 M240] 6608 Oland GL [FirePro W2100] + 13cc 3d28 MXRT-2600 6610 Oland XT [Radeon HD 8670 / R7 250/350] 1019 0030 Radeon HD 8670 1028 2120 Radeon R7 250 @@ -1638,6 +1643,7 @@ 1002 0b0c FirePro W4300 103c 0b0c Bonaire [FirePro W4300] 103c 230c FirePro W5100 + 13cc 3d2a MXRT-5600 6650 Bonaire 6651 Bonaire 6658 Bonaire XTX [Radeon R7 260X/360] @@ -1876,7 +1882,10 @@ 8086 2111 Radeon HD 6625M 6743 Whistler [Radeon E6760] 6749 Turks GL [FirePro V4900] + 15c3 2b06 MED-X4900 674a Turks GL [FirePro V3900] + 13cc 3d22 MXRT-2500 + 15c3 0106 MED-X3900 6750 Onega [Radeon HD 6650A/7650A] 1462 2670 Radeon HD 6670A 17aa 3079 Radeon HD 7650A @@ -2189,11 +2198,13 @@ 1043 3001 Tahiti XTL [ROG Matrix R9 280X] 1043 3006 Tahiti XTL [Radeon R9 280X DirectCU II TOP] 1043 9999 ARES II + 106b 0127 FirePro D700 + 106b 0128 FirePro D700 1092 3000 Tahiti XT2 [Radeon HD 7970 GHz Edition] 1458 2261 Tahiti XT2 [Radeon HD 7970 GHz Edition OC] # GV-R928XOC-3GD 1458 3001 Tahiti XTL [Radeon R9 280X OC] - 1462 2774 MSI R7970 TF 3GD5/OC BE + 1462 2774 HD 7970 TwinFrozr III Boost Edition OC 1682 3001 Tahiti XTL [Radeon R9 280X] 1682 3211 Double D HD 7970 Black Edition # FX-797A-TNBC @@ -2214,6 +2225,8 @@ 1462 8036 Radeon HD 8990 OEM 148c 8990 Radeon HD 8990 OEM 679e Tahiti LE [Radeon HD 7870 XT] + 106b 0125 FirePro D500 + 106b 0126 FirePro D500 1787 2328 Radeon HD 7870 Black Edition 2 GB GDDR5 [2GBD5-2DHV3E] 679f Tahiti 67a0 Hawaii XT GL [FirePro W9100] @@ -2268,7 +2281,8 @@ 174b e324 Sapphire Nitro R9 390 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE - 67c0 Ellesmere [Radeon Pro WX 7100] + 67c0 Ellesmere [Radeon Pro WX 7100 Mobile] + 67c2 Ellesmere [Radeon Pro V7300X / V7350x2] 67c4 Ellesmere [Radeon Pro WX 7100] 1002 0336 Radeon Pro Duo 1002 1336 Radeon Pro Duo @@ -2276,6 +2290,7 @@ 67ca Ellesmere [Polaris10] 67cc Ellesmere [Polaris10] 67cf Ellesmere [Polaris10] + 67d0 Ellesmere [Radeon Pro V7300X / V7350x2] 67df Ellesmere [Radeon RX 470/480/570/580] 1002 0b37 Radeon RX 480 1043 04a8 Radeon RX 480 @@ -2295,13 +2310,23 @@ 1787 a470 Radeon RX 470 1787 a480 Radeon RX 480 1da2 e353 Sapphire Radeon RX 580 Pulse 8GB - 1da2 e366 Radeon RX 570 - 67e0 Baffin [Polaris11] + 1da2 e366 Nitro+ Radeon RX 580 4GB + 67e0 Baffin [Radeon Pro WX 4170] + 103c 8270 Radeon Pro WX 4170 + 103c 8272 Radeon Pro WX 4170 67e1 Baffin [Polaris11] 67e3 Baffin [Radeon Pro WX 4100] - 67e8 Baffin [Polaris11] + 67e8 Baffin [Radeon Pro WX 4130/4150] + 1028 075d Radeon Pro WX 4150 + 1028 07b0 Radeon Pro WX 4130/4150 + 1028 07b1 Radeon Pro WX 4130 + 1028 175d Radeon Pro WX 4150 + 1028 17b0 Radeon Pro WX 4130/4150 + 1028 17b1 Radeon Pro WX 4130 + 103c 8275 Radeon Pro WX 4150 + 103c 8277 Radeon Pro WX 4150 67e9 Baffin [Polaris11] - 67eb Baffin [Polaris11] + 67eb Baffin [Radeon Pro V5300X] 67ef Baffin [Radeon RX 460/560D / Pro 450/455/460/560] 106b 0160 Radeon Pro 460 106b 0166 Radeon Pro 455 @@ -2324,8 +2349,14 @@ 6808 Pitcairn XT GL [FirePro W7000] 1002 0310 FirePro S7000 1002 0420 Radeon Sky 500 + 13cc 3d25 MXRT-7500 6809 Pitcairn LE GL [FirePro W5000] + 13cc 3d23 MXRT-5500 + 13cc 3d24 MXRT-5550 + 15c3 0b06 MED-X5000 6810 Curacao XT / Trinidad XT [Radeon R7 370 / R9 270X/370X] + 106b 012a FirePro D300 + 106b 012b FirePro D300 148c 0908 Radeon R9 370 OEM 1682 7370 Radeon R7 370 6811 Curacao PRO [Radeon R7 370 / R9 270/370 OEM] @@ -2345,6 +2376,7 @@ 1002 0b05 Radeon HD 8870 OEM 174b 8b04 Radeon HD 8860 6819 Pitcairn PRO [Radeon HD 7850 / R7 265 / R9 270 1024SP] + 1043 042c Radeon HD 7850 1682 7269 Radeon R9 270 1024SP 1682 9278 Radeon R9 270 1024SP 174b a008 Radeon R9 270 1024SP @@ -2370,6 +2402,7 @@ 6826 Chelsea LP [Radeon HD 7700M Series] 6827 Heathrow PRO [Radeon HD 7850M/8850M] 6828 Cape Verde PRO [FirePro W600] + 15c3 2b1e MED-X6000 6829 Cape Verde 682a Venus PRO 682b Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 M465X] @@ -2507,12 +2540,20 @@ 144d c0c7 Radeon HD 7550M 6842 Thames LE [Radeon HD 7000M Series] 6843 Thames [Radeon HD 7670M] + 6860 Vega 10 [Radeon Instinct MI25] + 106b 017c Radeon Pro Vega 64 6861 Vega 10 XT [Radeon PRO WX 9100] + 6862 Vega 10 XT [Radeon PRO SSG] 6863 Vega 10 XTX [Radeon Vega Frontier Edition] + 6864 Vega + 6867 Vega 10 XL [Radeon Pro Vega 56] + 6868 Vega + 686c Vega 10 [Radeon Instinct MI25 MxGPU] 687f Vega 10 XT [Radeon RX Vega 64] 6888 Cypress XT [FirePro V8800] 6889 Cypress PRO [FirePro V7800] 1002 0301 FirePro V7800P + 13cc 3d1f MXRT-7400 688a Cypress XT [FirePro V9800] 1002 030c FirePro V9800P 688c Cypress XT GL [FireStream 9370] @@ -2560,6 +2601,8 @@ 103c 159b Radeon HD 6850M 144d c0ad Radeon HD 6850M 68a9 Juniper XT [FirePro V5800] + 13cc 3d1e MXRT-5400 + 13cc 3d20 MXRT-5450 68b8 Juniper XT [Radeon HD 5770] 106b 00cf MacPro5,1 [Mac Pro 2.8GHz DDR3] 68b9 Juniper LE [Radeon HD 5670 640SP Edition] @@ -2721,6 +2764,7 @@ 1462 2246 Radeon HD 6550A 68c8 Redwood XT GL [FirePro V4800] 68c9 Redwood PRO GL [FirePro V3800] + 13cc 3d1d MXRT-2400 68d8 Redwood XT [Radeon HD 5670/5690/5730] 1028 68e0 Radeon HD 5670 174b 5690 Radeon HD 5690 @@ -3003,6 +3047,7 @@ 6921 Amethyst XT [Radeon R9 M295X] 6929 Tonga XT GL [FirePro S7150] 692b Tonga PRO GL [FirePro W7100] + 13cc 3d2b MXRT-7600 692f Tonga XTV GL [FirePro S7150V] 6938 Tonga XT / Amethyst XT [Radeon R9 380X / R9 M295X] 1043 04f5 Radeon R9 380X @@ -3017,11 +3062,12 @@ 148c 9380 Radeon R9 380 # Make naming scheme consistent 174b e308 Radeon R9 380 Nitro 4G D5 + 694c Vega [Radeon RX Vega M] 6980 Polaris12 6981 Polaris12 6985 Lexa XT [Radeon PRO WX 3100] 6986 Polaris12 - 6987 Polaris12 + 6987 Lexa [Radeon E9171 MCM] 6995 Lexa XT [Radeon PRO WX 2100] 699f Lexa PRO [Radeon RX 550] 148c 2380 Lexa XL [Radeon RX 550] @@ -3032,17 +3078,27 @@ 7101 R520/M58 [Mobility Radeon X1800 XT] 7102 R520/M58 [Mobility Radeon X1800] 7104 R520 GL [FireGL V7200] + 13cc 3d0a MXRT-5100 7109 R520 [Radeon X1800 XL] 1002 0322 All-in-Wonder X1800XL 1002 0d02 Radeon X1800 CrossFire Edition 710a R520 [Radeon X1800 GTO] 1002 0b12 Radeon X1800 GTO² 710b R520 [Radeon X1800 GTO] + 710e R520 GL [FireGL V7300] + 13cc 3d0c MXRT-5150 + 710f R520 GL [FireGL V7350] + 13cc 3d0e MXRT-7100 7120 R520 [Radeon X1800] (Secondary) 7124 R520 GL [FireGL V7200] (Secondary) + 13cc 3d0b MXRT-5100 (Secondary) 7129 R520 [Radeon X1800] (Secondary) 1002 0323 All-In-Wonder X1800 XL (Secondary) 1002 0d03 Radeon X1800 CrossFire Edition (Secondary) + 712e R520 GL [FireGL V7300] (Secondary) + 13cc 3d0d MXRT-5150 (Secondary) + 712f R520 GL [FireGL V7350] (Secondary) + 13cc 3d0f MXRT-7100 (Secondary) 7140 RV515 [Radeon X1300/X1550/X1600 Series] 7142 RV515 PRO [Radeon X1300/X1550 Series] 1002 0322 All-in-Wonder 2006 PCI-E Edition @@ -3082,12 +3138,16 @@ 7193 RV516 [Radeon X1550 Series] 7196 RV516/M62-S [Mobility Radeon X1350] 719b RV516 GL [FireMV 2250] + 13cc 3d12 MXRT-1150 + 13cc 3d14 MXRT-2150 719f RV516 [Radeon X1550 Series] 71a0 RV516 [Radeon X1300/X1550 Series] (Secondary) 71a1 RV516 [Radeon X1600/X1650 Series] (Secondary) 71a3 RV516 [Radeon X1300/X1550 Series] (Secondary) 71a7 RV516 [Radeon X1300/X1550 Series] (Secondary) 71bb RV516 GL [FireMV 2250] (Secondary) + 13cc 3d13 MXRT-1150 (Secondary) + 13cc 3d15 MXRT-2150 (Secondary) 71c0 RV530 [Radeon X1600 XT/X1650 GTO] 1002 e160 Radeon X1650 GTO 174b e160 Radeon X1650 GTO @@ -3106,6 +3166,7 @@ 1787 3000 PowerColor X1650 PRO AGP 71ce RV530 [Radeon X1300 XT/X1600 PRO] 71d2 RV530 GL [FireGL V3400] + 13cc 3d08 MXRT-2100 71d4 RV530/M66 GL [Mobility FireGL V5250] 71d5 RV530/M66-P [Mobility Radeon X1700] 71d6 RV530/M66-XT [Mobility Radeon X1700] @@ -3119,6 +3180,7 @@ 71e7 RV535 [Radeon X1650 PRO] (Secondary) 1787 3001 Radeon X1650 PRO AGP 71f2 RV530 GL [FireGL V3400] (Secondary) + 13cc 3d09 MXRT-2100 (Secondary) 7210 RV550/M71 [Mobility Radeon HD 2300] 7211 RV550/M71 [Mobility Radeon X2300 HD] 7240 R580+ [Radeon X1950 XTX] @@ -3195,6 +3257,7 @@ 9403 R600 [Radeon HD 2900 PRO] 9405 R600 [Radeon HD 2900 GT] 940a R600 GL [FireGL V8650] + 13cc 3d16 MXRT-7200 940b R600 GL [FireGL V8600] 940f R600 GL [FireGL V7600] 9440 RV770 [Radeon HD 4870] @@ -3232,6 +3295,7 @@ 174b 0028 Radeon HD 4650 AGP DDR2 9498 RV730 PRO [Radeon HD 4650] 949c RV730 GL [FirePro V7750] + 13cc 3d1b MXRT-7300 949e RV730 GL [FirePro V5700] 949f RV730 GL [FirePro V3750] 94a0 RV740/M97 [Mobility Radeon HD 4830] @@ -3318,6 +3382,7 @@ 958a RV630 [Radeon HD 2600 X2] 958b RV630/M76 [Mobility Radeon HD 2600 XT] 958c RV630 GL [FireGL V5600] + 13cc 3d18 MXRT-5200 958d RV630 GL [FireGL V3600] 9591 RV635/M86 [Mobility Radeon HD 3650] 1002 9591 Mobility Radeon HD 3650 @@ -3332,6 +3397,7 @@ 1043 3001 Radeon HD 4570 174b 3001 Radeon HD 3750 174b 4580 RV635 PRO [Radeon HD 4580] + 17af 3011 RV635 PRO [Radeon HD 4580] 9599 RV635 PRO [Radeon HD 3650 AGP] 95c0 RV620 PRO [Radeon HD 3470] 1002 95c0 Mobility Radeon HD 3470 @@ -3431,8 +3497,8 @@ 103c 194e ProBook 455 G1 Notebook 103c 1952 ProBook 455 G1 Notebook 9904 Trinity [Radeon HD 7560D] - 9905 Trinity [FirePro A300 Series Graphics] - 9906 Trinity [FirePro A300 Series Graphics] + 9905 Trinity GL [FirePro A300] + 9906 Trinity GL [FirePro A320] 9907 Trinity [Radeon HD 7620G] 9908 Trinity [Radeon HD 7600G] 9909 Trinity [Radeon HD 7500G] @@ -4043,6 +4109,11 @@ 1423 Family 15h (Models 30h-3fh) I/O Memory Management Unit 1424 Family 15h (Models 30h-3fh) Processor Root Port 1426 Family 15h (Models 30h-3fh) Processor Root Port + 142e Liverpool Processor Function 0 + 142f Liverpool Processor Function 1 + 1430 Liverpool Processor Function 2 + 1431 Liverpool Processor Function 3 + 1432 Liverpool Processor Function 4 1436 Liverpool Processor Root Complex 1437 Liverpool I/O Memory Management Unit 1438 Liverpool Processor Root Port @@ -4063,7 +4134,7 @@ 1463 Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 3 1464 Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 4 1465 Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 5 - 1466 Family 17h (Models 00h-0fh) Data Fabric Device 18h Function 6 + 1466 Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 6 1467 Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 7 1510 Family 14h Processor Root Complex 174b 1001 PURE Fusion Mini @@ -4080,6 +4151,17 @@ 1535 Family 16h Processor Function 5 1536 Family 16h Processor Root Complex 1538 Family 16h Processor Function 0 + 1570 Family 15h (Models 60h-6fh) Processor Function 0 + 1571 Family 15h (Models 60h-6fh) Processor Function 1 + 1572 Family 15h (Models 60h-6fh) Processor Function 2 + 1573 Family 15h (Models 60h-6fh) Processor Function 3 + 1574 Family 15h (Models 60h-6fh) Processor Function 4 + 1575 Family 15h (Models 60h-6fh) Processor Function 5 + 1576 Family 15h (Models 60h-6fh) Processor Root Complex + 1577 Family 15h (Models 60h-6fh) I/O Memory Management Unit + 157a Family 15h (Models 60h-6fh) Audio Controller + 157b Family 15h (Models 60h-6fh) Host Bridge + 157c Family 15h (Models 60h-6fh) Processor Root Port 1600 Family 15h Processor Function 0 1601 Family 15h Processor Function 1 1602 Family 15h Processor Function 2 @@ -4149,8 +4231,11 @@ 43a1 Hudson PCI to PCI bridge (PCIE port 1) 43a2 Hudson PCI to PCI bridge (PCIE port 2) 43a3 Hudson PCI to PCI bridge (PCIE port 3) + 43b1 X399 Series Chipset PCIe Bridge 43b4 300 Series Chipset PCIe Port + 43b6 X399 Series Chipset SATA Controller 43b7 300 Series Chipset SATA Controller + 43ba X399 Series Chipset USB 3.1 xHCI Controller 43bb 300 Series Chipset USB 3.1 xHCI Controller 7006 AMD-751 [Irongate] System Controller 7007 AMD-751 [Irongate] AGP Bridge @@ -4607,7 +4692,7 @@ 103c 3381 iLO4 0534 G200eR2 0536 Integrated Matrox G200eW3 Graphics Controller - 0538 G200eH + 0538 MGA G200eH3 1590 00e4 iLO5 VGA 0540 M91XX 102b 2080 M9140 LP PCIe x16 @@ -5293,7 +5378,7 @@ c824 82C824 c825 82C825 [Firebridge 2] c832 82C832 - c861 82C861 + c861 82C861 OHCI USB Host c881 82C881 [FireLink] 1394 OHCI Link Controller c895 82C895 c935 EV1935 ECTIVA MachOne PCIAudio @@ -5441,10 +5526,11 @@ 1028 014e PCI7410,7510,7610 OHCI-Lynx Controller (Latitude D800) 802e PCI7x20 1394a-2000 OHCI Two-Port PHY/Link-Layer Controller 1028 018d Inspiron 700m/710m - 8031 PCIxx21/x515 Cardbus Controller + 8031 PCIxx21/PCIxx11/PCIx515 PC Card Controller 1025 0064 Extensa 3000 series laptop 1025 0080 Aspire 5024WLMi 103c 0934 Compaq nw8240/nx8220 + 103c 0944 Compaq nc6220 Notebook PC 103c 099c NX6110/NC6120 103c 308b MX6125 8032 OHCI Compliant IEEE 1394 Host Controller @@ -5453,19 +5539,22 @@ 103c 0934 Compaq nw8240/nx8220 103c 099c NX6110/NC6120 103c 308b MX6125 - 8033 PCIxx21 Integrated FlashMedia Controller + 8033 PCIxx21/PCIxx11 Flash Media Controller 1025 0064 Extensa 3000 series laptop 1025 0080 Aspire 5024WLMi 103c 0934 Compaq nw8240/nx8220 + 103c 0944 Compaq nc6220 Notebook PC 103c 099c NX6110/NC6120 103c 308b MX6125 - 8034 PCI6411/6421/6611/6621/7411/7421/7611/7621 Secure Digital Controller + 8034 PCIxx21/PCIxx11 SD Host Controller 1025 0080 Aspire 5024WLMi 103c 0934 Compaq nw8240/nx8220 + 103c 0944 Compaq nc6220 Notebook PC 103c 099c NX6110/NC6120 103c 308b MX6125 - 8035 PCI6411/6421/6611/6621/7411/7421/7611/7621 Smart Card Controller + 8035 PCIxx21/PCIxx11 Smart Card Controller 103c 0934 Compaq nw8240/nx8220 + 103c 0944 Compaq nc6220 Notebook PC 103c 099c NX6110/NC6120 8036 PCI6515 Cardbus Controller 8038 PCI6515 SmartCard Controller @@ -5479,7 +5568,7 @@ 103c 30a1 NC2400 103c 30a3 Compaq nw8440 104d 902d VAIO VGN-NR120E - 803b 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD) + 803b PCIxx12 Flash Media Controller 103c 309f nx9420 103c 30a3 Compaq nw8440 104d 8212 VAIO VGN-N21E @@ -5652,6 +5741,22 @@ 90a3 Aeolia Memory (DDR3/SPM) 90a4 Aeolia USB 3.0 xHCI Host Controller 90bc SxS Pro+ memory card + 90c8 Belize ACPI + 90c9 Belize Ethernet Controller + 90ca Belize SATA AHCI Controller + 90cb Belize SD/MMC Host Controller + 90cc Belize PCI Express Glue and Miscellaneous Devices + 90cd Belize DMA Controller + 90ce Belize Memory (DDR3/SPM) + 90cf Belize USB 3.0 xHCI Host Controller + 90d7 Baikal ACPI + 90d8 Baikal Ethernet Controller + 90d9 Baikal SATA AHCI Controller + 90da Baikal SD/MMC Host Controller + 90db Baikal PCI Express Glue and Miscellaneous Devices + 90dc Baikal DMA Controller + 90dd Baikal Memory (DDR3/SPM) + 90de Baikal USB 3.0 xHCI Host Controller 104e Oak Technology, Inc 0017 OTI-64017 0107 OTI-107 [Spitfire] @@ -6232,6 +6337,10 @@ 8070 FastLinQ QL41000 Series 10/25/40/50GbE Controller 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 0005 QLogic 4x10GE QL41164HMRJ CNA + 1077 0006 QLogic 4x10GE QL41164HMCU CNA + 1077 0007 QLogic 2x1GE+2x10GE QL41264HMCU CNA + 1077 0009 QLogic 2x1GE+2x10GE QL41162HMRJ CNA 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 0011 FastLinQ QL41212H 25GbE Adapter 1077 0012 FastLinQ QL41112H 10GbE Adapter @@ -6242,19 +6351,34 @@ 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 0005 QLogic 4x10GE QL41164HMRJ CNA + 1077 0006 QLogic 4x10GE QL41164HMCU CNA + 1077 0007 QLogic 2x1GE+2x10GE QL41264HMCU CNA + 1077 0009 QLogic 2x1GE+2x10GE QL41162HMRJ CNA 1077 000b 25GE 2P QL41262HxCU-DE Adapter + 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter 1077 000e FastLinQ QL41162H 10GbE FCoE Adapter 8084 FastLinQ QL41000 Series 10/25/40/50GbE Controller (iSCSI) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 0005 QLogic 4x10GE QL41164HMRJ CNA + 1077 0006 QLogic 4x10GE QL41164HMCU CNA + 1077 0007 QLogic 2x25GE QL41262HMCU CNA + 1077 0009 QLogic 2x1GE+2x10GE QL41162HMRJ CNA 1077 000b 25GE 2P QL41262HxCU-DE Adapter + 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE iSCSI Adapter 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter 8090 FastLinQ QL41000 Series Gigabit Ethernet Controller (SR-IOV VF) 1077 0001 25GE 2P QL41262HxCU-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 0005 QLogic 4x10GE QL41164HMRJ CNA + 1077 0006 QLogic 4x10GE QL41164HMCU CNA + 1077 0007 QLogic 2x1GE+2x10GE QL41264HMCU CNA + 1077 0009 QLogic 2x1GE+2x10GE QL41162HMRJ CNA 1077 000b 25GE 2P QL41262HxCU-DE Adapter + 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter (SR-IOV VF) 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF) 1077 0011 FastLinQ QL41212H 25GbE Adapter (SR-IOV VF) @@ -9238,6 +9362,7 @@ 0424 G86 [GeForce 8400 GS] 0425 G86M [GeForce 8600M GS] 1025 0121 Aspire 5920G + 1043 1514 F3SV 0426 G86M [GeForce 8400M GT] 0427 G86M [GeForce 8400M GS] 103c 30cc Pavilion dv6700 @@ -9409,6 +9534,7 @@ 1682 2385 GeForce 9600 GSO 768mb 0611 G92 [GeForce 8800 GT] 107d 2ab0 Winfast PX8800 GT PCI-E + 1462 1170 NX8800GT series model V117 2xDVI+TV 19da 1040 ZT-88TES2P-FSP 0612 G92 [GeForce 9800 GTX / 9800 GTX+] 0613 G92 [GeForce 9800 GTX+] @@ -10193,8 +10319,10 @@ 102a GK110BGL [Tesla K40t] 102d GK210GL [Tesla K80] 102e GK110BGL [Tesla K40d] + 102f GK110BGL [Tesla Stella Solo] 103a GK110GL [Quadro K6000] 103c GK110GL [Quadro K5200] + 103f GK110BGL [Tesla Stella SXM] 1040 GF119 [GeForce GT 520] 1043 83a0 ENGT520 SILENT 1042 GF119 [GeForce 510] @@ -10648,6 +10776,7 @@ 11a3 GK104M [GeForce GTX 680MX] 106b 010d iMac 13,2 11a7 GK104M [GeForce GTX 675MX] + 11af GK104GLM [GRID IceCube] # GRID K2 Quadro USM 11b0 GK104GL [GRID K240Q\K260Q vGPU] 10de 101a GRID K240Q @@ -10827,6 +10956,7 @@ 13bd GM107GL [Tesla M10] 10de 110a GRID M40 10de 1160 Tesla M10 + 10de 11d2 GRID M10-8Q 13c0 GM204 [GeForce GTX 980] 1043 8504 GTX980-4GD5 13c1 GM204 @@ -10836,11 +10966,16 @@ 13d8 GM204M [GeForce GTX 970M] 13d9 GM204M [GeForce GTX 965M] 13da GM204M [GeForce GTX 980 Mobile] - 13e7 GM204 [GeForce GTX 980 Engineering Sample] + 13e7 GM204GL [GeForce GTX 980 Engineering Sample] 13f0 GM204GL [Quadro M5000] 13f1 GM204GL [Quadro M4000] 13f2 GM204GL [Tesla M60] + 10de 114d GRID M60-1Q + 10de 114e GRID M60-2Q + 10de 1150 GRID M60-8Q + 10de 11b0 GRID M60-4A 13f3 GM204GL [Tesla M6] + 10de 1184 GRID M6-8Q 13f8 GM204GLM [Quadro M5000M / M5000 SE] 13f9 GM204GLM [Quadro M4000M] 13fa GM204GLM [Quadro M3000M] @@ -10869,6 +11004,7 @@ 172f GP100 174d GM108M [GeForce MX130] 174e GM108M [GeForce MX110] + 1789 GM107GL [GRID M3-3020] 17c2 GM200 [GeForce GTX TITAN X] 17c8 GM200 [GeForce GTX 980 Ti] 17f0 GM200GL [Quadro M6000] @@ -10904,6 +11040,7 @@ 1bb7 GP104GLM [Quadro P4000 Mobile] 1462 11e9 Quadro P4000 Max-Q 1bb8 GP104GLM [Quadro P3000 Mobile] + 1bc7 GP104 [P104-101] 1be0 GP104M [GeForce GTX 1080 Mobile] 1028 07c0 GeForce GTX 1080 Max-Q 1458 355b GeForce GTX 1080 Max-Q @@ -10912,6 +11049,8 @@ 1c01 GP106 1c02 GP106 [GeForce GTX 1060 3GB] 1c03 GP106 [GeForce GTX 1060 6GB] + 1c04 GP106 [GeForce GTX 1060 5GB] + 1c06 GP106 [GeForce GTX 1060 6GB Rev. 2] 1c07 GP106 [P106-100] 1c09 GP106 [P106-090] 1c20 GP106M [GeForce GTX 1060 Mobile] @@ -10937,11 +11076,13 @@ 1cb1 GP107GL [Quadro P1000] 1cb2 GP107GL [Quadro P600] 1cb3 GP107GL [Quadro P400] + 1cb6 GP107GL [Quadro P620] 1d01 GP108 [GeForce GT 1030] 1d10 GP108M [GeForce MX150] - 1d81 GV100 - 1db1 GV100 [Tesla V100 SXM2] - 1db4 GV100 [Tesla V100 PCIe] + 1d33 GP108GL [Quadro P500] + 1d81 GV100 [TITAN V] + 1db1 GV100GL [Tesla V100 SXM2] + 1db4 GV100GL [Tesla V100 PCIe] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -10967,6 +11108,7 @@ e180 Proteus-X: LightPulse IOV Fibre Channel Host Adapter e200 LightPulse LPe16002 1014 03f1 PCIe2 16 Gb 2-port Fibre Channel Adapter (FC EL5B; CCIN 577F) + 10df e282 Flex System FC5054 4-port 16Gb FC Adapter e208 LightPulse 16Gb Fibre Channel Host Adapter (Lancer-VF) e220 OneConnect NIC (Lancer) 17aa 1054 ThinkServer LPm16002B-M6-L AnyFabric @@ -11141,13 +11283,14 @@ 8129 RTL-8129 10ec 8129 RT8129 Fast Ethernet Adapter 11ec 8129 RTL8111/8168 PCIe Gigabit Ethernet (misconfigured) - 8136 RTL8101/2/6E PCI Express Fast Ethernet controller + 8136 RTL810xE PCI Express Fast Ethernet controller 103c 1985 RTL8106E on Pavilion 17-e163sg Notebook PC 103c 2a8c Compaq 500B Microtower 103c 2ab1 Pavilion p6774 103c 30cc Pavilion dv6700 1179 ff64 RTL8102E PCI-E Fast Ethernet NIC 17c0 1053 RTL8101e Medion WIM 2210 Notebook PC [MD96850] + 8137 RTL8104E PCIe Fast Ethernet Controller 8138 RT8139 (B/C) Cardbus Fast Ethernet Adapter 10ec 8138 RT8139 (B/C) Fast Ethernet Adapter 8139 RTL-8100/8101L/8139 PCI Fast Ethernet Adapter @@ -11218,7 +11361,7 @@ 1043 16d5 U6V/U31J laptop 1043 81aa P5B 1043 82c6 M3A78 Series Motherboard - 1043 83a3 M4A785TD Motherboard + 1043 83a3 M4A785/P7P55 Motherboard 1043 8432 P8P67 and other motherboards 1043 8505 P8 series motherboard 105b 0d7c D270S/D250S Motherboard @@ -11226,6 +11369,7 @@ 144d c652 RTL8168 on a NP300E5C series laptop 1458 e000 Onboard Ethernet 1462 238c Onboard RTL8111b on MSI P965 Platinum Mainboard + 1462 345c RTL8111B on MS-7345 Motherboard 1462 368c K9AG Neo2 1462 4180 Wind PC MS-7418 1462 7522 X58 Pro-E @@ -13242,9 +13386,47 @@ 117c 802f ExpressPCI UL5D Low Profile 0033 SAS Adapter 0041 ExpressSAS R30F + 0042 ExpressSAS 6Gb/s SAS/SATA HBA + 117c 0042 ExpressSAS H680 + 117c 0043 ExpressSAS H608 + 117c 0044 ExpressSAS H60F + 117c 0045 ExpressSAS H6F0 + 117c 0046 ExpressSAS H644 + 117c 004f ExpressSAS M608 + 117c 0057 ExpressSAS M680 + 117c 0058 ExpressSAS M644 + 117c 0059 ExpressSAS W608 + 117c 005a ExpressSAS W680 + 117c 005b ExpressSAS W644 + 0049 ExpressSAS 6Gb SAS/SATA RAID Adapter + 117c 0049 ExpressSAS R680 + 117c 004a ExpressSAS R608 + 117c 004b ExpressSAS R60F + 117c 004c ExpressSAS R6F0 + 117c 004d ExpressSAS R644 + 117c 004e ExpressSAS R648 + 0064 Celerity FC 16Gb/s Gen 5 Fibre Channel HBA + 117c 0063 Celerity FC-161E + 117c 0064 Celerity FC-162E + 117c 0065 Celerity FC-164E + 0094 Celerity FC 16/32Gb/s Gen 6 Fibre Channel HBA + 117c 0094 Celerity FC-162P + 117c 00a0 Celerity FC-161P + 117c 00a1 Celerity FC-164P + 117c 00a2 Celerity FC-321E + 117c 00a3 Celerity FC-322E + 117c 00ac Celerity FC-324E 8013 ExpressPCI UL4D 8014 ExpressPCI UL4S 8027 ExpressPCI UL5D + 8070 ExpressSAS 12Gb/s SAS/SATA HBA + 117c 0070 ExpressSAS H1280 + 117c 0071 ExpressSAS H1208 + 117c 0080 ExpressSAS H1244 + 8072 ExpressSAS 12Gb/s SAS/SATA HBA + 117c 0072 ExpressSAS H12F0 + 117c 0073 ExpressSAS H120F + 117c 0082 ExpressSAS H1288 117d Becton & Dickinson 117e T/R Systems 117f Integrated Circuit Systems @@ -13299,6 +13481,7 @@ 1025 0121 Aspire 5920G 1028 01d7 XPS M1210 1028 01f3 Inspiron 1420 + 1028 022f Inspiron 1525 103c 30b5 Presario V3242AU 103c 30b7 Presario V6133CL 103c 30cc Pavilion dv6700 @@ -13316,6 +13499,7 @@ 1028 01a2 Inspiron 9200 1028 01d7 XPS M1210 1028 01f3 Inspiron 1420 + 1028 022f Inspiron 1525 103c 03b5 Presario V3242AU 103c 30b7 Presario V6133CL 103c 30c1 Compaq 6910p @@ -13332,6 +13516,7 @@ 1025 0121 Aspire 5920G 1028 01d7 XPS M1210 1028 01f3 Inspiron 1420 + 1028 022f Inspiron 1525 1028 024d Latitude E4300 103c 30b5 Presario V3242AU 103c 30b7 Presario V6133CL @@ -13354,6 +13539,7 @@ 0852 xD-Picture Card Controller 1025 0121 Aspire 5920G 1028 01f3 Inspiron 1420 + 1028 022f Inspiron 1525 103c 30b5 Presario V3242AU 103c 30b7 Presario V6133CL 103c 30cc Pavilion dv6700 @@ -13605,6 +13791,7 @@ 4353 88E8039 PCI-E Fast Ethernet Controller 104d 902d VAIO VGN-NR120E 4354 88E8040 PCI-E Fast Ethernet Controller + 1028 022f Inspiron 1525 144d c06a R730 Laptop 144d c072 Notebook N150P 4355 88E8040T PCI-E Fast Ethernet Controller @@ -13700,8 +13887,9 @@ 6081 MV88SX6081 8-port SATA II PCI-X Controller 6101 88SE6101/6102 single-port PATA133 interface 1043 82e0 P5K PRO Motherboard - 6111 88SE6111 1-port PATA133(IDE) and 1-port SATA II Controllers - 6121 88SE6121 SATA II / PATA Controller + 6121 88SE6111/6121 SATA II / PATA Controller +# 6111: 1 SATA port; 6121: 2 SATA ports + 11ab 6121 88SE6111/6121 1/2 port SATA II + 1 port PATA Controller 6141 88SE614x SATA II PCI-E controller 6145 88SE6145 SATA II PCI-E controller 6180 88F6180 [Kirkwood] ARM SoC @@ -14027,6 +14215,7 @@ 8000 PM8000 [SPC - SAS Protocol Controller] 8009 PM8009 SPCve 8x6G 8032 ATTO Celerity FC8xEN + 117c 003a Celerity FC-81EN Fibre Channel Adapter 117c 003b Celerity FC-82EN Fibre Channel Adapter 117c 003c Celerity FC-84EN Fibre Channel Adapter 8053 PM8053 SXP 12G 24-port SAS/SATA expander @@ -14047,41 +14236,70 @@ 11fc Silicon Magic 11fd High Street Consultants 11fe Comtrol Corporation - 0001 RocketPort 32 port w/external I/F - 0002 RocketPort 8 port w/external I/F - 0003 RocketPort 16 port w/external I/F - 0004 RocketPort 4 port w/quad cable - 0005 RocketPort 8 port w/octa cable - 0006 RocketPort 8 port w/RJ11 connectors - 0007 RocketPort 4 port w/RJ11 connectors - 0008 RocketPort 8 port w/ DB78 SNI (Siemens) connector - 0009 RocketPort 16 port w/ DB78 SNI (Siemens) connector - 000a RocketPort Plus 4 port - 000b RocketPort Plus 8 port - 000c RocketModem 6 port + 0001 RocketPort PCI 32-port w/external I/F + 0002 RocketPort PCI 8-port w/external I/F + 0003 RocketPort PCI 16-port w/external I/F + 0004 RocketPort PCI 4-port w/Quad Cable + 0005 RocketPort PCI 8-port w/Octa Cable + 0006 RocketPort PCI 8-port w/RJ11 connectors + 0007 RocketPort PCI 4-port w/RJ45 connectors + 0008 RocketPort PCI 8-port w/DB78 SNI connector (Siemens) + 0009 RocketPort PCI 16-port w/DB78 SNI connector (Siemens) + 000a RocketPort PCI Plus 4-port w/Quad Cable + 000b RocketPort PCI Plus 8-port w/Octa Cable + 000c RocketModem II 6-port 000d RocketModem 4-port - 000e RocketPort Plus 2 port RS232 - 000f RocketPort Plus 2 port RS422 - 0040 RocketPort Infinity Octa, 8port, RJ45 - 0041 RocketPort Infinity 32port, External Interface - 0042 RocketPort Infinity 8port, External Interface - 0043 RocketPort Infinity 16port, External Interface - 0044 RocketPort Infinity Quad, 4port, DB - 0045 RocketPort Infinity Octa, 8port, DB - 0047 RocketPort Infinity 4port, RJ45 - 004f RocketPort Infinity 2port, SMPTE - 0052 RocketPort Infinity Octa, 8port, SMPTE - 0801 RocketPort UPCI 32 port w/external I/F - 0802 RocketPort UPCI 8 port w/external I/F - 0803 RocketPort UPCI 16 port w/external I/F - 0805 RocketPort UPCI 8 port w/octa cable - 080c RocketModem III 8 port - 080d RocketModem III 4 port - 0810 RocketPort UPCI Plus 4 port RS232 - 0811 RocketPort UPCI Plus 8 port RS232 - 0812 RocketPort UPCI Plus 8 port RS422 + 000e RocketPort PCI Plus 2-port RS-232 w/DB9 connectors + 000f RocketPort PCI Plus 2-port SMPTE w/DB9 connectors + 0040 RocketPort INFINITY 8-port w/Octa Cable RJ45 + 0041 RocketPort INFINITY 32-port w/external I/F + 0042 RocketPort INFINITY 8-port w/external I/F + 0043 RocketPort INFINITY 16-port w/external I/F + 0044 RocketPort INFINITY 4-port w/Quad Cable DB + 0045 RocketPort INFINITY 8-port w/Octa Cable DB + 0046 RocketPort INFINITY 4-port w/external I/F + 0047 RocketPort INFINITY 4J (4-port) w/RJ45 connectors + 0048 RocketPort INFINITY 4J (4-port) w/RJ45 connectors + 004a RocketPort INFINITY Plus 4-port + 004b RocketPort INFINITY Plus 8-port + 004c RocketModem INFINITY III 8-port + 004d RocketModem INFINITY III 4-port + 004e RocketPort INFINITY Plus 2-port + 004f RocketPort INFINITY 2-port SMPTE w/DB9 connectors + 0050 RocketPort INFINITY Plus 4-port RJ45 + 0051 RocketPort INFINITY Plus 8-port RJ11 + 0052 RocketPort INFINITY 8-port SMPTE w/DB9 Connectors + 0060 RocketPort EXPRESS 8-port w/Octa Cable + 0061 RocketPort EXPRESS 32-port w/external I/F + 0062 RocketPort EXPRESS 8-Port w/external I/F + 0063 RocketPort EXPRESS 16-port w/external I/F + 0064 RocketPort EXPRESS 4-port w/Quad Cable + 0065 RocketPort EXPRESS 8-port w/Octa Cable + 0066 RocketPort EXPRESS 4-port w/external I/F + 0067 RocketPort EXPRESS 4J (4-port) w/RJ45 connectors + 0068 RocketPort EXPRESS 8J (8-port) w/RJ11 connectors + 006f RocketPort EXPRESS SMPTE 2-port + 0072 RocketPort EXPRESS SMPTE 8-port w/external I/F + 0801 RocketPort uPCI 32-port w/external I/F + 0802 RocketPort uPCI 8-port w/external I/F + 0803 RocketPort uPCI 16-port w/external I/F + 0805 RocketPort uPCI 8-port w/Octa Cable + 080b RocketPort Plus uPCI 8-port w/Octa Cable + 080c RocketModem III 8-port + 080d RocketModem III 4-port + 080e RocketPort uPCI 2-port RS232 w/DB9 connectors + 080f RocketPort uPCI SMPTE 2-port + 0810 RocketPort Plus uPCI 4J (4-port) w/RJ45 connectors + 0811 RocketPort Plus uPCI 8J (8-port) w/RJ11 connectors + 0812 RocketPort Plus uPCI 422 8-port + 0813 RocketModem IV uPCI 8-port + 0814 RocketModem IV uPCI 4-port 0903 RocketPort Compact PCI 16 port w/external I/F - 8015 RocketPort 4-port UART 16954 +# 16954 UART + 8015 RocketPort 550 4-port + 8805 RocketPort uPCI 4-port w/Quad Cable + 880b RocketPort Plus uPCI 4-port w/Quad Cable + 8812 RocketPort Plus uPCI 4-port RS422 w/Quad Cable 11ff Scion Corporation 0003 AG-5 1200 CSS Corporation @@ -15644,6 +15862,7 @@ 0252 XR17V252 Dual UART PCI controller 0254 XR17V254 Quad UART PCI controller 0258 XR17V258 Octal UART PCI controller + 0352 XR17V3521 Dual PCIe UART 13a9 Siemens Medical Systems, Ultrasound Group 13aa Broadband Networks Inc 13ab Arcom Control Systems Ltd @@ -16243,6 +16462,7 @@ 4887 T440T-4087 Unified Wire Ethernet Controller [VF] 4888 T440-4088 Unified Wire Ethernet Controller [VF] 5001 T520-CR Unified Wire Ethernet Controller + 193d 1001 510F-B 5002 T522-CR Unified Wire Ethernet Controller 5003 T540-CR Unified Wire Ethernet Controller 5004 T520-BCH Unified Wire Ethernet Controller @@ -16304,6 +16524,7 @@ 50a9 T580-50A9 Unified Wire Ethernet Controller 50aa T580-50AA Unified Wire Ethernet Controller 50ab T520-50AB Unified Wire Ethernet Controller + 50ac T540-50AC Unified Wire Ethernet Controller 5401 T520-CR Unified Wire Ethernet Controller 5402 T522-CR Unified Wire Ethernet Controller 5403 T540-CR Unified Wire Ethernet Controller @@ -16366,6 +16587,7 @@ 54a9 T580-50A9 Unified Wire Ethernet Controller 54aa T580-50AA Unified Wire Ethernet Controller 54ab T520-50AB Unified Wire Ethernet Controller + 54ac T540-50AC Unified Wire Ethernet Controller 5501 T520-CR Unified Wire Storage Controller 5502 T522-CR Unified Wire Storage Controller 5503 T540-CR Unified Wire Storage Controller @@ -16426,6 +16648,9 @@ 55a7 T580-50A7 Unified Wire Storage Controller 55a8 T580-50A8 Unified Wire Storage Controller 55a9 T580-50A9 Unified Wire Storage Controller + 55aa T580-50AA Unified Wire Storage Controller + 55ab T520-50AB Unified Wire Storage Controller + 55ac T540-50AC Unified Wire Storage Controller 5601 T520-CR Unified Wire Storage Controller 5602 T522-CR Unified Wire Storage Controller 5603 T540-CR Unified Wire Storage Controller @@ -16488,6 +16713,7 @@ 56a9 T580-50A9 Unified Wire Storage Controller 56aa T580-50AA Unified Wire Storage Controller 56ab T520-50AB Unified Wire Storage Controller + 56ac T540-50AC Unified Wire Storage Controller 5701 T520-CR Unified Wire Ethernet Controller 5702 T522-CR Unified Wire Ethernet Controller 5703 T540-CR Unified Wire Ethernet Controller @@ -16589,6 +16815,7 @@ 58a9 T580-50A9 Unified Wire Ethernet Controller [VF] 58aa T580-50AA Unified Wire Ethernet Controller [VF] 58ab T520-50AB Unified Wire Ethernet Controller [VF] + 58ac T540-50AC Unified Wire Ethernet Controller [VF] 6001 T6225-CR Unified Wire Ethernet Controller 6002 T6225-SO-CR Unified Wire Ethernet Controller 6003 T6425-CR Unified Wire Ethernet Controller @@ -16609,6 +16836,7 @@ 6084 T64100-6084 Unified Wire Ethernet Controller 6085 T6240-6085 Unified Wire Ethernet Controller 6086 T6225-6086 Unified Wire Ethernet Controller + 6087 T6225-6087 Unified Wire Ethernet Controller 6401 T6225-CR Unified Wire Ethernet Controller 6402 T6225-SO-CR Unified Wire Ethernet Controller 6403 T6425-CR Unified Wire Ethernet Controller @@ -16629,6 +16857,7 @@ 6484 T64100-6084 Unified Wire Ethernet Controller 6485 T6240-6085 Unified Wire Ethernet Controller 6486 T6225-6086 Unified Wire Ethernet Controller + 6487 T6225-6087 Unified Wire Ethernet Controller 6501 T6225-CR Unified Wire Storage Controller 6502 T6225-SO-CR Unified Wire Storage Controller 6503 T6425-CR Unified Wire Storage Controller @@ -16649,6 +16878,7 @@ 6584 T64100-6084 Unified Wire Storage Controller 6585 T6240-6085 Unified Wire Storage Controller 6586 T6225-6086 Unified Wire Storage Controller + 6587 T6225-6087 Unified Wire Storage Controller 6601 T6225-CR Unified Wire Storage Controller 6602 T6225-SO-CR Unified Wire Storage Controller 6603 T6425-CR Unified Wire Storage Controller @@ -16669,6 +16899,7 @@ 6684 T64100-6084 Unified Wire Storage Controller 6685 T6240-6085 Unified Wire Storage Controller 6686 T6225-6086 Unified Wire Storage Controller + 6687 T6225-6087 Unified Wire Storage Controller 6801 T6225-CR Unified Wire Ethernet Controller [VF] 6802 T6225-SO-CR Unified Wire Ethernet Controller [VF] 6803 T6425-CR Unified Wire Ethernet Controller [VF] @@ -16689,6 +16920,7 @@ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 03:03:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A70A4F1FDC3; Thu, 22 Feb 2018 03:03:49 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DCBE84FEA; Thu, 22 Feb 2018 03:03:49 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-it0-x230.google.com with SMTP id o13so4592906ito.2; Wed, 21 Feb 2018 19:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TXNGTqA4AMIeBH8S6sRW7XS9QpkKNIgxk+L9x/04q24=; b=sYga6ICiIXoK3X3HKfLoCHvtmmoaVuUr1d8odDCX0xmBADWr/GCICYVZDXrdSAA3S8 zG7T1/6sfrJ0isML+6Ax3gDST+VvWjwbwcsnKvV6kegUIraZ25Urf7BUE36OtPTEIKxq 57XJ+MlDS2Pf8MiZ7lCssxyK8YPnD0SnZRhE4Pz2UROZCetCYJPlJn4Bijif7fC+uhCl VEeJ+b3FrFuGrGrVb+HlfaVBpszXOjd/8tB4n2vLZK4ev0bAdcNN7YGaWv10p0GngCRZ 22CMiW5Q2lYo061p5OJ+3kE8FWlnZJSHDeQK3P2hai8MD5+KF/BUKTY+vn28f+z9fMyT eSZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TXNGTqA4AMIeBH8S6sRW7XS9QpkKNIgxk+L9x/04q24=; b=F0hAuLgyRlTc3pVD9SwdsRulPQXj9rDXPJ+G1prt4Oy9+1ACQa0qPE9PaGt7DfmSPO 4NCqOCR2eunC4EnpoqcB3Q5dMilaHr+eYyGu3B0s25HN6Cf8EioeB9myMxmdsOPMPB3Y 2/6Q+Vk+7mc1AEM2QCskAEmwKxtAlcB2ckv3I6/WNjB5QtoMIC5CuSZSOOyYWmhI93lD sBrEWmBlUKJMLrwPqoNms4jgjQCk813/D+yUVslo2m6TAMV5/0m3jByv0tMR34Ym3Q/R P/HI+gRpa4+bC8u1/ESAgz2i3yNaIOmQ0QD6KhDHSnEeQygzP+a5qhnsyiAXKq9U2DUK QaLQ== X-Gm-Message-State: APf1xPCJUC4beem2u1yJwTatGIWQFG7lmzmlpqYMfDh//bBgH/+KeL68 IMt504evWD4d0DYrLwW3m+ciZlZb X-Google-Smtp-Source: AG47ELtlJu7xqbUzr1JISXuPu2tdbBlCxQLY23cwhtIaGKfx5C9AjgC0UN7xkFjl8aUZlJIQepIDIA== X-Received: by 10.36.151.197 with SMTP id k188mr6444362ite.45.1519268628256; Wed, 21 Feb 2018 19:03:48 -0800 (PST) Received: from spectre.mavhome.dp.ua ([2600:1700:3580:3560:205:1bff:fee0:411b]) by smtp.gmail.com with ESMTPSA id j2sm10446356iob.43.2018.02.21.19.03.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 19:03:47 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r329770 - vendor-sys/illumos/dist/uts/common/fs/zfs/lua To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org References: <201802220104.w1M14uHQ088614@pdx.rh.CN85.dnsmgr.net> From: Alexander Motin Message-ID: <56dda9e2-e9ea-83b9-1e54-6569d478615a@FreeBSD.org> Date: Wed, 21 Feb 2018 22:03:47 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802220104.w1M14uHQ088614@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:03:50 -0000 On 21.02.2018 20:04, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> Author: mav >> Date: Thu Feb 22 00:46:24 2018 >> New Revision: 329770 >> URL: https://svnweb.freebsd.org/changeset/base/329770 >> >> Log: >> 9035 zfs: this statement may fall through >> >> illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553 >> >> Reviewed by: Yuri Pankov >> Reviewed by: Andy Fiddaman >> Reviewed by: Matthew Ahrens >> Approved by: Dan McDonald >> Author: Toomas Soome >> >> Modified: >> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c >> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c >> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c >> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c >> >> Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c >> ============================================================================== >> --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:42:12 2018 (r329769) >> +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb 22 00:46:24 2018 (r329770) >> @@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) { >> case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; >> case LUA_TSHRSTR: >> G(L)->strt.nuse--; >> - /* go through */ >> + /* FALLTHROUGH */ >> case LUA_TLNGSTR: { >> luaM_freemem(L, o, sizestring(gco2ts(o))); >> break; >> >> Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c >> ============================================================================== >> --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:42:12 2018 (r329769) >> +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb 22 00:46:24 2018 (r329770) >> @@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { >> else if (!lisdigit(ls->current)) return '.'; >> /* else go through */ > ^^^^^^^^^^^^^^^^^^^^^^^ Wasnt this already marked, perhaps in the > wrong place with the wrong string? As I understand GCC 7 parses comments like that to decide whether generate warnings or not, but this informal text is out of his understanding. -- Alexander Motin From owner-svn-src-all@freebsd.org Thu Feb 22 03:15:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32BFCF20F20; Thu, 22 Feb 2018 03:15:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6E338599D; Thu, 22 Feb 2018 03:15:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D193321B82; Thu, 22 Feb 2018 03:15:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3FaNK094075; Thu, 22 Feb 2018 03:15:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3FaID094067; Thu, 22 Feb 2018 03:15:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220315.w1M3FaID094067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:15:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329798 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/commo... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/op... X-SVN-Commit-Revision: 329798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:15:37 -0000 Author: mav Date: Thu Feb 22 03:15:35 2018 New Revision: 329798 URL: https://svnweb.freebsd.org/changeset/base/329798 Log: MFV r329793, r329795: 9075 Improve ZFS pool import/load process and corrupted pool recovery illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1 Some work has been done lately to improve the debugability of the ZFS pool load (and import) process. This includes: https://www.illumos.org/issues/7638: Refactor spa_load_impl into several functions https://www.illumos.org/issues/8961: SPA load/import should tell us why it failed https://www.illumos.org/issues/7277: zdb should be able to print zfs_dbgmsg's To iterate on top of that, there's a few changes that were made to make the import process more resilient and crash free. One of the first tasks during the pool load process is to parse a config provided from userland that describes what devices the pool is composed of. A vdev tree is generated from that config, and then all the vdevs are opened. The Meta Object Set (MOS) of the pool is accessed, and several metadata objects that are necessary to load the pool are read. The exact configuration of the pool is also stored inside the MOS. Since the configuration provided from userland is external and might not accurately describe the vdev tree of the pool at the txg that is being loaded, it cannot be relied upon to safely operate the pool. For that reason, the configuration in the MOS is read early on. In the past, the two configurations were compared together and if there was a mismatch then the load process was aborted and an error was returned. The latter was a good way to ensure a pool does not get corrupted, however it made the pool load process needlessly fragile in cases where the vdev configuration changed or the userland configuration was outdated. Since the MOS is stored in 3 copies, the configuration provided by userland doesn't have to be perfect in order to read its contents. Hence, a new approach has been adopted: The pool is first opened with the untrusted userland configuration just so that the real configuration can be read from the MOS. The trusted MOS configuration is then used to generate a new vdev tree and the pool is re-opened. When the pool is opened with an untrusted configuration, writes are disabled to avoid accidentally damaging it. During reads, some sanity checks are performed on block pointers to see if each DVA points to a known vdev; when the configuration is untrusted, instead of panicking the system if those checks fail we simply avoid issuing reads to the invalid DVAs. This new two-step pool load process now allows rewinding pools accross vdev tree changes such as device replacement, addition, etc. Loading a pool from an external config file in a clustering environment also becomes much safer now since the pool will import even if the config is outdated and didn't, for instance, register a recent device addition. With this code in place, it became relatively easy to implement a long-sought-after feature: the ability to import a pool with missing top level (i.e. non-redundant) devices. Note that since this almost guarantees some loss Of data, this feature is for now restricted to a read-only import. Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Andrew Stormont Approved by: Hans Rosenfeld Author: Pavel Zakharov Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Feb 22 03:15:35 2018 (r329798) @@ -1582,6 +1582,10 @@ print_status_config(zpool_handle_t *zhp, const char *n (void) printf(gettext("split into new pool")); break; + case VDEV_AUX_CHILDREN_OFFLINE: + (void) printf(gettext("all children offline")); + break; + default: (void) printf(gettext("corrupted data")); break; @@ -1675,6 +1679,10 @@ print_import_config(const char *name, nvlist_t *nv, in (void) printf(gettext("too many errors")); break; + case VDEV_AUX_CHILDREN_OFFLINE: + (void) printf(gettext("all children offline")); + break; + default: (void) printf(gettext("corrupted data")); break; @@ -2328,6 +2336,7 @@ zpool_do_import(int argc, char **argv) idata.poolname = searchname; idata.guid = searchguid; idata.cachefile = cachefile; + idata.policy = policy; pools = zpool_search_import(g_zfs, &idata); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Feb 22 03:15:35 2018 (r329798) @@ -391,6 +391,7 @@ typedef struct importargs { int can_be_active : 1; /* can the pool be active? */ int unique : 1; /* does 'poolname' already exist? */ int exists : 1; /* set on return if pool already exists */ + nvlist_t *policy; /* rewind policy (rewind txg, etc.) */ } importargs_t; extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Feb 22 03:15:35 2018 (r329798) @@ -440,7 +440,8 @@ vdev_is_hole(uint64_t *hole_array, uint_t holes, uint_ * return to the user. */ static nvlist_t * -get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok) +get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, + nvlist_t *policy) { pool_entry_t *pe; vdev_entry_t *ve; @@ -774,6 +775,12 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boo continue; } + if (policy != NULL) { + if (nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY, + policy) != 0) + goto nomem; + } + if ((nvl = refresh_config(hdl, config)) == NULL) { nvlist_free(config); config = NULL; @@ -1412,7 +1419,7 @@ skipdir: goto error; } - ret = get_configs(hdl, &pools, iarg->can_be_active); + ret = get_configs(hdl, &pools, iarg->can_be_active, iarg->policy); error: for (pe = pools.pools; pe != NULL; pe = penext) { @@ -1541,6 +1548,14 @@ zpool_find_import_cached(libzfs_handle_t *hdl, const c if (active) continue; + + if (nvlist_add_string(src, ZPOOL_CONFIG_CACHEFILE, + cachefile) != 0) { + (void) no_memory(hdl); + nvlist_free(raw); + nvlist_free(pools); + return (NULL); + } if ((dst = refresh_config(hdl, src)) == NULL) { nvlist_free(raw); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Feb 22 03:15:35 2018 (r329798) @@ -1809,8 +1809,9 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *con nvlist_lookup_nvlist(nvinfo, ZPOOL_CONFIG_MISSING_DEVICES, &missing) == 0) { (void) printf(dgettext(TEXT_DOMAIN, - "The devices below are missing, use " - "'-m' to import the pool anyway:\n")); + "The devices below are missing or " + "corrupted, use '-m' to import the pool " + "anyway:\n")); print_vdev_tree(hdl, NULL, missing, 2); (void) printf("\n"); } Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Feb 22 03:15:35 2018 (r329798) @@ -1007,6 +1007,16 @@ kernel_fini(void) urandom_fd = -1; } +/* ARGSUSED */ +uint32_t +zone_get_hostid(void *zonep) +{ + /* + * We're emulating the system's hostid in userland. + */ + return (strtoul(hw_serial, NULL, 10)); +} + int z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen) { Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Feb 22 02:39:33 2018 (r329797) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Feb 22 03:15:35 2018 (r329798) @@ -609,6 +609,7 @@ typedef struct callb_cpr { #define zone_dataset_visible(x, y) (1) #define INGLOBALZONE(z) (1) +extern uint32_t zone_get_hostid(void *zonep); extern char *kmem_asprintf(const char *fmt, ...); #define strfree(str) kmem_free((str), strlen(str) + 1) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 02:39:33 2018 (r329797) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 03:15:35 2018 (r329798) @@ -163,9 +163,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); static boolean_t spa_has_active_shared_spare(spa_t *spa); -static int spa_load_impl(spa_t *spa, uint64_t, nvlist_t *config, - spa_load_state_t state, spa_import_type_t type, boolean_t trust_config, - char **ereport); +static int spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport, + boolean_t reloading); static void spa_vdev_resilver_done(spa_t *spa); uint_t zio_taskq_batch_pct = 75; /* 1 thread per cpu in pset */ @@ -193,6 +192,68 @@ boolean_t spa_load_verify_dryrun = B_FALSE; #define TRYIMPORT_NAME "$import" /* + * For debugging purposes: print out vdev tree during pool import. + */ +int spa_load_print_vdev_tree = B_FALSE; + +/* + * A non-zero value for zfs_max_missing_tvds means that we allow importing + * pools with missing top-level vdevs. This is strictly intended for advanced + * pool recovery cases since missing data is almost inevitable. Pools with + * missing devices can only be imported read-only for safety reasons, and their + * fail-mode will be automatically set to "continue". + * + * With 1 missing vdev we should be able to import the pool and mount all + * datasets. User data that was not modified after the missing device has been + * added should be recoverable. This means that snapshots created prior to the + * addition of that device should be completely intact. + * + * With 2 missing vdevs, some datasets may fail to mount since there are + * dataset statistics that are stored as regular metadata. Some data might be + * recoverable if those vdevs were added recently. + * + * With 3 or more missing vdevs, the pool is severely damaged and MOS entries + * may be missing entirely. Chances of data recovery are very low. Note that + * there are also risks of performing an inadvertent rewind as we might be + * missing all the vdevs with the latest uberblocks. + */ +uint64_t zfs_max_missing_tvds = 0; + +/* + * The parameters below are similar to zfs_max_missing_tvds but are only + * intended for a preliminary open of the pool with an untrusted config which + * might be incomplete or out-dated. + * + * We are more tolerant for pools opened from a cachefile since we could have + * an out-dated cachefile where a device removal was not registered. + * We could have set the limit arbitrarily high but in the case where devices + * are really missing we would want to return the proper error codes; we chose + * SPA_DVAS_PER_BP - 1 so that some copies of the MOS would still be available + * and we get a chance to retrieve the trusted config. + */ +uint64_t zfs_max_missing_tvds_cachefile = SPA_DVAS_PER_BP - 1; +/* + * In the case where config was assembled by scanning device paths (/dev/dsks + * by default) we are less tolerant since all the existing devices should have + * been detected and we want spa_load to return the right error codes. + */ +uint64_t zfs_max_missing_tvds_scan = 0; + + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_print_vdev_tree, CTLFLAG_RWTUN, + &spa_load_print_vdev_tree, 0, + "print out vdev tree during pool import"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, max_missing_tvds, CTLFLAG_RWTUN, + &zfs_max_missing_tvds, 0, + "allow importing pools with missing top-level vdevs"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, max_missing_tvds_cachefile, CTLFLAG_RWTUN, + &zfs_max_missing_tvds_cachefile, 0, + "allow importing pools with missing top-level vdevs in cache file"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, max_missing_tvds_scan, CTLFLAG_RWTUN, + &zfs_max_missing_tvds_scan, 0, + "allow importing pools with missing top-level vdevs during scan"); + +/* * ========================================================================== * SPA properties routines * ========================================================================== @@ -1692,13 +1753,34 @@ load_nvlist(spa_t *spa, uint64_t obj, nvlist_t **value } /* + * Concrete top-level vdevs that are not missing and are not logs. At every + * spa_sync we write new uberblocks to at least SPA_SYNC_MIN_VDEVS core tvds. + */ +static uint64_t +spa_healthy_core_tvds(spa_t *spa) +{ + vdev_t *rvd = spa->spa_root_vdev; + uint64_t tvds = 0; + + for (uint64_t i = 0; i < rvd->vdev_children; i++) { + vdev_t *vd = rvd->vdev_child[i]; + if (vd->vdev_islog) + continue; + if (vdev_is_concrete(vd) && !vdev_is_dead(vd)) + tvds++; + } + + return (tvds); +} + +/* * Checks to see if the given vdev could not be opened, in which case we post a * sysevent to notify the autoreplace code that the device has been removed. */ static void spa_check_removed(vdev_t *vd) { - for (int c = 0; c < vd->vdev_children; c++) + for (uint64_t c = 0; c < vd->vdev_children; c++) spa_check_removed(vd->vdev_child[c]); if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) && @@ -1708,38 +1790,14 @@ spa_check_removed(vdev_t *vd) } } -static void -spa_config_valid_zaps(vdev_t *vd, vdev_t *mvd) +static int +spa_check_for_missing_logs(spa_t *spa) { - ASSERT3U(vd->vdev_children, ==, mvd->vdev_children); + vdev_t *rvd = spa->spa_root_vdev; - vd->vdev_top_zap = mvd->vdev_top_zap; - vd->vdev_leaf_zap = mvd->vdev_leaf_zap; - - for (uint64_t i = 0; i < vd->vdev_children; i++) { - spa_config_valid_zaps(vd->vdev_child[i], mvd->vdev_child[i]); - } -} - -/* - * Validate the current config against the MOS config - */ -static boolean_t -spa_config_valid(spa_t *spa, nvlist_t *config) -{ - vdev_t *mrvd, *rvd = spa->spa_root_vdev; - nvlist_t *nv; - - VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nv) == 0); - - spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - VERIFY(spa_config_parse(spa, &mrvd, nv, NULL, 0, VDEV_ALLOC_LOAD) == 0); - - ASSERT3U(rvd->vdev_children, ==, mrvd->vdev_children); - /* * If we're doing a normal import, then build up any additional - * diagnostic information about missing devices in this config. + * diagnostic information about missing log devices. * We'll pass this up to the user for further processing. */ if (!(spa->spa_import_flags & ZFS_IMPORT_MISSING_LOG)) { @@ -1750,109 +1808,52 @@ spa_config_valid(spa_t *spa, nvlist_t *config) KM_SLEEP); VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0); - for (int c = 0; c < rvd->vdev_children; c++) { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; - vdev_t *mtvd = mrvd->vdev_child[c]; - if (tvd->vdev_ops == &vdev_missing_ops && - mtvd->vdev_ops != &vdev_missing_ops && - mtvd->vdev_islog) - child[idx++] = vdev_config_generate(spa, mtvd, - B_FALSE, 0); + /* + * We consider a device as missing only if it failed + * to open (i.e. offline or faulted is not considered + * as missing). + */ + if (tvd->vdev_islog && + tvd->vdev_state == VDEV_STATE_CANT_OPEN) { + child[idx++] = vdev_config_generate(spa, tvd, + B_FALSE, VDEV_CONFIG_MISSING); + } } - if (idx) { - VERIFY(nvlist_add_nvlist_array(nv, - ZPOOL_CONFIG_CHILDREN, child, idx) == 0); - VERIFY(nvlist_add_nvlist(spa->spa_load_info, - ZPOOL_CONFIG_MISSING_DEVICES, nv) == 0); + if (idx > 0) { + fnvlist_add_nvlist_array(nv, + ZPOOL_CONFIG_CHILDREN, child, idx); + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_MISSING_DEVICES, nv); - for (int i = 0; i < idx; i++) + for (uint64_t i = 0; i < idx; i++) nvlist_free(child[i]); } nvlist_free(nv); kmem_free(child, rvd->vdev_children * sizeof (char **)); - } - /* - * Compare the root vdev tree with the information we have - * from the MOS config (mrvd). Check each top-level vdev - * with the corresponding MOS config top-level (mtvd). - */ - for (int c = 0; c < rvd->vdev_children; c++) { - vdev_t *tvd = rvd->vdev_child[c]; - vdev_t *mtvd = mrvd->vdev_child[c]; + if (idx > 0) { + spa_load_failed(spa, "some log devices are missing"); + return (SET_ERROR(ENXIO)); + } + } else { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; - /* - * Resolve any "missing" vdevs in the current configuration. - * Also trust the MOS config about any "indirect" vdevs. - * If we find that the MOS config has more accurate information - * about the top-level vdev then use that vdev instead. - */ - if ((tvd->vdev_ops == &vdev_missing_ops && - mtvd->vdev_ops != &vdev_missing_ops) || - (mtvd->vdev_ops == &vdev_indirect_ops && - tvd->vdev_ops != &vdev_indirect_ops)) { - - /* - * Device specific actions. - */ - if (mtvd->vdev_islog) { - if (!(spa->spa_import_flags & - ZFS_IMPORT_MISSING_LOG)) { - continue; - } - + if (tvd->vdev_islog && + tvd->vdev_state == VDEV_STATE_CANT_OPEN) { spa_set_log_state(spa, SPA_LOG_CLEAR); - } else if (mtvd->vdev_ops != &vdev_indirect_ops) { - continue; + spa_load_note(spa, "some log devices are " + "missing, ZIL is dropped."); + break; } - - /* - * Swap the missing vdev with the data we were - * able to obtain from the MOS config. - */ - vdev_remove_child(rvd, tvd); - vdev_remove_child(mrvd, mtvd); - - vdev_add_child(rvd, mtvd); - vdev_add_child(mrvd, tvd); - - vdev_reopen(rvd); - } else { - if (mtvd->vdev_islog) { - /* - * Load the slog device's state from the MOS - * config since it's possible that the label - * does not contain the most up-to-date - * information. - */ - vdev_load_log_state(tvd, mtvd); - vdev_reopen(tvd); - } - - /* - * Per-vdev ZAP info is stored exclusively in the MOS. - */ - spa_config_valid_zaps(tvd, mtvd); } - - /* - * Never trust this info from userland; always use what's - * in the MOS. This prevents it from getting out of sync - * with the rest of the info in the MOS. - */ - tvd->vdev_removing = mtvd->vdev_removing; - tvd->vdev_indirect_config = mtvd->vdev_indirect_config; } - vdev_free(mrvd); - spa_config_exit(spa, SCL_ALL, FTAG); - - /* - * Ensure we were able to validate the config. - */ - return (rvd->vdev_guid_sum == spa->spa_uberblock.ub_guid_sum); + return (0); } /* @@ -2249,55 +2250,17 @@ spa_try_repair(spa_t *spa, nvlist_t *config) } static int -spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type, - boolean_t trust_config) +spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type) { - nvlist_t *config = spa->spa_config; char *ereport = FM_EREPORT_ZFS_POOL; - char *comment; int error; - uint64_t pool_guid; - nvlist_t *nvl; - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid)) - return (SET_ERROR(EINVAL)); + spa->spa_load_state = state; - ASSERT(spa->spa_comment == NULL); - if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) - spa->spa_comment = spa_strdup(comment); + gethrestime(&spa->spa_loaded_ts); + error = spa_load_impl(spa, type, &ereport, B_FALSE); /* - * Versioning wasn't explicitly added to the label until later, so if - * it's not present treat it as the initial version. - */ - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, - &spa->spa_ubsync.ub_version) != 0) - spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; - - (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, - &spa->spa_config_txg); - - if ((state == SPA_LOAD_IMPORT || state == SPA_LOAD_TRYIMPORT) && - spa_guid_exists(pool_guid, 0)) { - error = SET_ERROR(EEXIST); - } else { - spa->spa_config_guid = pool_guid; - - if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_SPLIT, - &nvl) == 0) { - VERIFY(nvlist_dup(nvl, &spa->spa_config_splitting, - KM_SLEEP) == 0); - } - - nvlist_free(spa->spa_load_info); - spa->spa_load_info = fnvlist_alloc(); - - gethrestime(&spa->spa_loaded_ts); - error = spa_load_impl(spa, pool_guid, config, state, type, - trust_config, &ereport); - } - - /* * Don't count references from objsets that are already closed * and are making their way through the eviction process. */ @@ -2347,23 +2310,87 @@ vdev_count_verify_zaps(vdev_t *vd) } static int -spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config, - spa_import_type_t type) +spa_verify_host(spa_t *spa, nvlist_t *mos_config) { + uint64_t hostid; + char *hostname; + uint64_t myhostid = 0; + + if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_HOSTID, &hostid) == 0) { + hostname = fnvlist_lookup_string(mos_config, + ZPOOL_CONFIG_HOSTNAME); + + myhostid = zone_get_hostid(NULL); + + if (hostid != 0 && myhostid != 0 && hostid != myhostid) { + cmn_err(CE_WARN, "pool '%s' could not be " + "loaded as it was last accessed by " + "another system (host: %s hostid: 0x%llx). " + "See: http://illumos.org/msg/ZFS-8000-EY", + spa_name(spa), hostname, (u_longlong_t)hostid); + spa_load_failed(spa, "hostid verification failed: pool " + "last accessed by host: %s (hostid: 0x%llx)", + hostname, (u_longlong_t)hostid); + return (SET_ERROR(EBADF)); + } + } + + return (0); +} + +static int +spa_ld_parse_config(spa_t *spa, spa_import_type_t type) +{ int error = 0; - nvlist_t *nvtree = NULL; + nvlist_t *nvtree, *nvl, *config = spa->spa_config; int parse; vdev_t *rvd; + uint64_t pool_guid; + char *comment; + /* + * Versioning wasn't explicitly added to the label until later, so if + * it's not present treat it as the initial version. + */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &spa->spa_ubsync.ub_version) != 0) + spa->spa_ubsync.ub_version = SPA_VERSION_INITIAL; + + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid)) { + spa_load_failed(spa, "invalid config provided: '%s' missing", + ZPOOL_CONFIG_POOL_GUID); + return (SET_ERROR(EINVAL)); + } + + if ((spa->spa_load_state == SPA_LOAD_IMPORT || spa->spa_load_state == + SPA_LOAD_TRYIMPORT) && spa_guid_exists(pool_guid, 0)) { + spa_load_failed(spa, "a pool with guid %llu is already open", + (u_longlong_t)pool_guid); + return (SET_ERROR(EEXIST)); + } + + spa->spa_config_guid = pool_guid; + + nvlist_free(spa->spa_load_info); + spa->spa_load_info = fnvlist_alloc(); + + ASSERT(spa->spa_comment == NULL); + if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) + spa->spa_comment = spa_strdup(comment); + + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, + &spa->spa_config_txg); + + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_SPLIT, &nvl) == 0) + spa->spa_config_splitting = fnvlist_dup(nvl); + if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) { spa_load_failed(spa, "invalid config provided: '%s' missing", ZPOOL_CONFIG_VDEV_TREE); return (SET_ERROR(EINVAL)); } - parse = (type == SPA_IMPORT_EXISTING ? - VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); - /* * Create "The Godfather" zio to hold all async IOs */ @@ -2381,6 +2408,8 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv * configuration requires knowing the version number. */ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + parse = (type == SPA_IMPORT_EXISTING ? + VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT); error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse); spa_config_exit(spa, SCL_ALL, FTAG); @@ -2401,71 +2430,105 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv return (0); } +/* + * Recursively open all vdevs in the vdev tree. This function is called twice: + * first with the untrusted config, then with the trusted config. + */ static int spa_ld_open_vdevs(spa_t *spa) { int error = 0; + /* + * spa_missing_tvds_allowed defines how many top-level vdevs can be + * missing/unopenable for the root vdev to be still considered openable. + */ + if (spa->spa_trust_config) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds; + } else if (spa->spa_config_source == SPA_CONFIG_SRC_CACHEFILE) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds_cachefile; + } else if (spa->spa_config_source == SPA_CONFIG_SRC_SCAN) { + spa->spa_missing_tvds_allowed = zfs_max_missing_tvds_scan; + } else { + spa->spa_missing_tvds_allowed = 0; + } + + spa->spa_missing_tvds_allowed = + MAX(zfs_max_missing_tvds, spa->spa_missing_tvds_allowed); + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); error = vdev_open(spa->spa_root_vdev); spa_config_exit(spa, SCL_ALL, FTAG); + + if (spa->spa_missing_tvds != 0) { + spa_load_note(spa, "vdev tree has %lld missing top-level " + "vdevs.", (u_longlong_t)spa->spa_missing_tvds); + if (spa->spa_trust_config && (spa->spa_mode & FWRITE)) { + /* + * Although theoretically we could allow users to open + * incomplete pools in RW mode, we'd need to add a lot + * of extra logic (e.g. adjust pool space to account + * for missing vdevs). + * This limitation also prevents users from accidentally + * opening the pool in RW mode during data recovery and + * damaging it further. + */ + spa_load_note(spa, "pools with missing top-level " + "vdevs can only be opened in read-only mode."); + error = SET_ERROR(ENXIO); + } else { + spa_load_note(spa, "current settings allow for maximum " + "%lld missing top-level vdevs at this stage.", + (u_longlong_t)spa->spa_missing_tvds_allowed); + } + } if (error != 0) { spa_load_failed(spa, "unable to open vdev tree [error=%d]", error); } + if (spa->spa_missing_tvds != 0 || error != 0) + vdev_dbgmsg_print_tree(spa->spa_root_vdev, 2); return (error); } +/* + * We need to validate the vdev labels against the configuration that + * we have in hand. This function is called twice: first with an untrusted + * config, then with a trusted config. The validation is more strict when the + * config is trusted. + */ static int -spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type, - boolean_t trust_config) +spa_ld_validate_vdevs(spa_t *spa) { int error = 0; vdev_t *rvd = spa->spa_root_vdev; - /* - * We need to validate the vdev labels against the configuration that - * we have in hand, which is dependent on the setting of trust_config. - * If trust_config is true then we're validating the vdev labels based - * on that config. Otherwise, we're validating against the cached - * config (zpool.cache) that was read when we loaded the zfs module, and - * then later we will recursively call spa_load() and validate against - * the vdev config. - * - * If we're assembling a new pool that's been split off from an - * existing pool, the labels haven't yet been updated so we skip - * validation for now. - */ - if (type != SPA_IMPORT_ASSEMBLE) { - spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = vdev_validate(rvd, trust_config); - spa_config_exit(spa, SCL_ALL, FTAG); + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + error = vdev_validate(rvd); + spa_config_exit(spa, SCL_ALL, FTAG); - if (error != 0) { - spa_load_failed(spa, "vdev_validate failed [error=%d]", - error); - return (error); - } + if (error != 0) { + spa_load_failed(spa, "vdev_validate failed [error=%d]", error); + return (error); + } - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { - spa_load_failed(spa, "cannot open vdev tree after " - "invalidating some vdevs"); - return (SET_ERROR(ENXIO)); - } + if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { + spa_load_failed(spa, "cannot open vdev tree after invalidating " + "some vdevs"); + vdev_dbgmsg_print_tree(rvd, 2); + return (SET_ERROR(ENXIO)); } return (0); } static int -spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, spa_import_type_t type, - boolean_t trust_config) +spa_ld_select_uberblock(spa_t *spa, spa_import_type_t type) { vdev_t *rvd = spa->spa_root_vdev; nvlist_t *label; uberblock_t *ub = &spa->spa_uberblock; - uint64_t children; /* * Find the best uberblock. @@ -2558,26 +2621,9 @@ spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, nvlist_free(unsup_feat); } - /* - * If the vdev guid sum doesn't match the uberblock, we have an - * incomplete configuration. We first check to see if the pool - * is aware of the complete config (i.e ZPOOL_CONFIG_VDEV_CHILDREN). - * If it is, defer the vdev_guid_sum check till later so we - * can handle missing vdevs. - */ - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, - &children) != 0 && trust_config && type != SPA_IMPORT_ASSEMBLE && - rvd->vdev_guid_sum != ub->ub_guid_sum) { - spa_load_failed(spa, "guid sum in config doesn't match guid " - "sum in uberblock (%llu != %llu)", - (u_longlong_t)rvd->vdev_guid_sum, - (u_longlong_t)ub->ub_guid_sum); - return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); - } - if (type != SPA_IMPORT_ASSEMBLE && spa->spa_config_splitting) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - spa_try_repair(spa, config); + spa_try_repair(spa, spa->spa_config); spa_config_exit(spa, SCL_ALL, FTAG); nvlist_free(spa->spa_config_splitting); spa->spa_config_splitting = NULL; @@ -2616,49 +2662,167 @@ spa_ld_open_rootbp(spa_t *spa) } static int -spa_ld_validate_config(spa_t *spa, spa_import_type_t type) +spa_ld_load_trusted_config(spa_t *spa, spa_import_type_t type, + boolean_t reloading) { - vdev_t *rvd = spa->spa_root_vdev; + vdev_t *mrvd, *rvd = spa->spa_root_vdev; + nvlist_t *nv, *mos_config, *policy; + int error = 0, copy_error; + uint64_t healthy_tvds, healthy_tvds_mos; + uint64_t mos_config_txg; if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object, B_TRUE) != 0) return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* - * Validate the config, using the MOS config to fill in any - * information which might be missing. If we fail to validate - * the config then declare the pool unfit for use. If we're - * assembling a pool from a split, the log is not transferred - * over. + * If we're assembling a pool from a split, the config provided is + * already trusted so there is nothing to do. */ - if (type != SPA_IMPORT_ASSEMBLE) { - nvlist_t *mos_config; - if (load_nvlist(spa, spa->spa_config_object, &mos_config) - != 0) { - spa_load_failed(spa, "unable to retrieve MOS config"); - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } + if (type == SPA_IMPORT_ASSEMBLE) + return (0); - if (!spa_config_valid(spa, mos_config)) { + healthy_tvds = spa_healthy_core_tvds(spa); + + if (load_nvlist(spa, spa->spa_config_object, &mos_config) + != 0) { + spa_load_failed(spa, "unable to retrieve MOS config"); + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + } + + /* + * If we are doing an open, pool owner wasn't verified yet, thus do + * the verification here. + */ + if (spa->spa_load_state == SPA_LOAD_OPEN) { + error = spa_verify_host(spa, mos_config); + if (error != 0) { nvlist_free(mos_config); - spa_load_failed(spa, "mismatch between config provided " - "and config stored in MOS"); - return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, - ENXIO)); + return (error); } - nvlist_free(mos_config); + } + nv = fnvlist_lookup_nvlist(mos_config, ZPOOL_CONFIG_VDEV_TREE); + + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + + /* + * Build a new vdev tree from the trusted config + */ + VERIFY(spa_config_parse(spa, &mrvd, nv, NULL, 0, VDEV_ALLOC_LOAD) == 0); + + /* + * Vdev paths in the MOS may be obsolete. If the untrusted config was + * obtained by scanning /dev/dsk, then it will have the right vdev + * paths. We update the trusted MOS config with this information. + * We first try to copy the paths with vdev_copy_path_strict, which + * succeeds only when both configs have exactly the same vdev tree. + * If that fails, we fall back to a more flexible method that has a + * best effort policy. + */ + copy_error = vdev_copy_path_strict(rvd, mrvd); + if (copy_error != 0 || spa_load_print_vdev_tree) { + spa_load_note(spa, "provided vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + spa_load_note(spa, "MOS vdev tree:"); + vdev_dbgmsg_print_tree(mrvd, 2); + } + if (copy_error != 0) { + spa_load_note(spa, "vdev_copy_path_strict failed, falling " + "back to vdev_copy_path_relaxed"); + vdev_copy_path_relaxed(rvd, mrvd); + } + + vdev_close(rvd); + vdev_free(rvd); + spa->spa_root_vdev = mrvd; + rvd = mrvd; + spa_config_exit(spa, SCL_ALL, FTAG); + + /* + * We will use spa_config if we decide to reload the spa or if spa_load + * fails and we rewind. We must thus regenerate the config using the + * MOS information with the updated paths. Rewind policy is an import + * setting and is not in the MOS. We copy it over to our new, trusted + * config. + */ + mos_config_txg = fnvlist_lookup_uint64(mos_config, + ZPOOL_CONFIG_POOL_TXG); + nvlist_free(mos_config); + mos_config = spa_config_generate(spa, NULL, mos_config_txg, B_FALSE); + if (nvlist_lookup_nvlist(spa->spa_config, ZPOOL_REWIND_POLICY, + &policy) == 0) + fnvlist_add_nvlist(mos_config, ZPOOL_REWIND_POLICY, policy); + spa_config_set(spa, mos_config); + spa->spa_config_source = SPA_CONFIG_SRC_MOS; + + /* + * Now that we got the config from the MOS, we should be more strict + * in checking blkptrs and can make assumptions about the consistency + * of the vdev tree. spa_trust_config must be set to true before opening + * vdevs in order for them to be writeable. + */ + spa->spa_trust_config = B_TRUE; + + /* + * Open and validate the new vdev tree + */ + error = spa_ld_open_vdevs(spa); + if (error != 0) + return (error); + + error = spa_ld_validate_vdevs(spa); + if (error != 0) + return (error); + + if (copy_error != 0 || spa_load_print_vdev_tree) { + spa_load_note(spa, "final vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + } + + if (spa->spa_load_state != SPA_LOAD_TRYIMPORT && + !spa->spa_extreme_rewind && zfs_max_missing_tvds == 0) { /* - * Now that we've validated the config, check the state of the - * root vdev. If it can't be opened, it indicates one or - * more toplevel vdevs are faulted. + * Sanity check to make sure that we are indeed loading the + * latest uberblock. If we missed SPA_SYNC_MIN_VDEVS tvds + * in the config provided and they happened to be the only ones + * to have the latest uberblock, we could involuntarily perform + * an extreme rewind. */ - if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) { - spa_load_failed(spa, "some top vdevs are unavailable"); - return (SET_ERROR(ENXIO)); + healthy_tvds_mos = spa_healthy_core_tvds(spa); + if (healthy_tvds_mos - healthy_tvds >= + SPA_SYNC_MIN_VDEVS) { + spa_load_note(spa, "config provided misses too many " + "top-level vdevs compared to MOS (%lld vs %lld). ", + (u_longlong_t)healthy_tvds, + (u_longlong_t)healthy_tvds_mos); + spa_load_note(spa, "vdev tree:"); + vdev_dbgmsg_print_tree(rvd, 2); + if (reloading) { + spa_load_failed(spa, "config was already " + "provided from MOS. Aborting."); + return (spa_vdev_err(rvd, + VDEV_AUX_CORRUPT_DATA, EIO)); + } + spa_load_note(spa, "spa must be reloaded using MOS " + "config"); + return (SET_ERROR(EAGAIN)); } } + error = spa_check_for_missing_logs(spa); + if (error != 0) + return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO)); + + if (rvd->vdev_guid_sum != spa->spa_uberblock.ub_guid_sum) { + spa_load_failed(spa, "uberblock guid sum doesn't match MOS " + "guid sum (%llu != %llu)", + (u_longlong_t)spa->spa_uberblock.ub_guid_sum, + (u_longlong_t)rvd->vdev_guid_sum); + return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, + ENXIO)); + } + return (0); } @@ -2825,62 +2989,6 @@ spa_ld_load_special_directories(spa_t *spa) } static int -spa_ld_prepare_for_reload(spa_t *spa, int orig_mode) -{ - vdev_t *rvd = spa->spa_root_vdev; - - uint64_t hostid; - nvlist_t *policy = NULL; - nvlist_t *mos_config; - - if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) { - spa_load_failed(spa, "unable to retrieve MOS config"); - return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); - } - - if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config, - ZPOOL_CONFIG_HOSTID, &hostid) == 0) { - char *hostname; - unsigned long myhostid = 0; - - VERIFY(nvlist_lookup_string(mos_config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); - -#ifdef _KERNEL - myhostid = zone_get_hostid(NULL); -#else /* _KERNEL */ - /* - * We're emulating the system's hostid in userland, so - * we can't use zone_get_hostid(). - */ - (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); -#endif /* _KERNEL */ - if (check_hostid && hostid != 0 && myhostid != 0 && - hostid != myhostid) { - nvlist_free(mos_config); - cmn_err(CE_WARN, "pool '%s' could not be " - "loaded as it was last accessed by " - "another system (host: %s hostid: 0x%lx). " - "See: http://illumos.org/msg/ZFS-8000-EY", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 03:22:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67757F21DA7; Thu, 22 Feb 2018 03:22:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18D228643C; Thu, 22 Feb 2018 03:22:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13C2B21D3B; Thu, 22 Feb 2018 03:22:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3MR8a098829; Thu, 22 Feb 2018 03:22:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3MR7t098824; Thu, 22 Feb 2018 03:22:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220322.w1M3MR7t098824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329799 - in vendor-sys/illumos/dist/uts/common: . fs/zfs fs/zfs/sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: . fs/zfs fs/zfs/sys X-SVN-Commit-Revision: 329799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:22:28 -0000 Author: mav Date: Thu Feb 22 03:22:27 2018 New Revision: 329799 URL: https://svnweb.freebsd.org/changeset/base/329799 Log: 9079 race condition in starting and ending condesing thread for indirect vdevs illumos/illumos-gate@667ec66f1b4f491d5e839644e0912cad1c9e7122 The timeline of the race condition is the following: [1] Thread A is about to finish condesing the first vdev in spa_condense_indirect_thread(), so it calls the spa_condense_indirect_complete_sync() sync task which sets the spa_condensing_indirect field to NULL. Waiting for the sync task to finish, thread A sleeps until the txg is done. When this happens, thread A will acquire spa_async_lock and set spa_condense_thread to NULL. [2] While thread A waits for the txg to finish, thread B which is running spa_sync() checks whether it should condense the second vdev in vdev_indirect_should_condense() by checking the spa_condensing_indirect field which was set to NULL by spa_condense_indirect_thread() from thread A. So it goes on and tries to spawn a new condensing thread in spa_condense_indirect_start_sync() and the aforementioned assertions fails because thread A has not set spa_condense_thread to NULL (which is basically the last thing it does before returning). The main issue here is that we rely on both spa_condensing_indirect and spa_condense_thread to signify whether a condensing thread is running. Ideally we would only use one throughout the codebase. In addition, for managing spa_condense_thread we currently use spa_async_lock which basically tights condensing to scrubing when it comes to pausing and resuming those actions during spa export. Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Approved by: Hans Rosenfeld Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Modified: vendor-sys/illumos/dist/uts/common/Makefile.files ============================================================================== --- vendor-sys/illumos/dist/uts/common/Makefile.files Thu Feb 22 03:15:35 2018 (r329798) +++ vendor-sys/illumos/dist/uts/common/Makefile.files Thu Feb 22 03:22:27 2018 (r329799) @@ -1421,7 +1421,8 @@ ZFS_COMMON_OBJS += \ zio_compress.o \ zio_inject.o \ zle.o \ - zrlock.o + zrlock.o \ + zthr.o ZFS_SHARED_OBJS += \ zfeature_common.o \ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 03:15:35 2018 (r329798) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Feb 22 03:22:27 2018 (r329799) @@ -1338,6 +1338,12 @@ spa_unload(spa_t *spa) spa->spa_vdev_removal = NULL; } + if (spa->spa_condense_zthr != NULL) { + ASSERT(!zthr_isrunning(spa->spa_condense_zthr)); + zthr_destroy(spa->spa_condense_zthr); + spa->spa_condense_zthr = NULL; + } + spa_condense_fini(spa); bpobj_close(&spa->spa_deferred_bpobj); @@ -2079,6 +2085,16 @@ spa_vdev_err(vdev_t *vdev, vdev_aux_t aux, int err) return (SET_ERROR(err)); } +static void +spa_spawn_aux_threads(spa_t *spa) +{ + ASSERT(spa_writeable(spa)); + + ASSERT(MUTEX_HELD(&spa_namespace_lock)); + + spa_start_indirect_condensing_thread(spa); +} + /* * Fix up config after a partly-completed split. This is done with the * ZPOOL_CONFIG_SPLIT nvlist. Both the splitting pool and the split-off @@ -3486,18 +3502,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char ASSERT(spa->spa_load_state != SPA_LOAD_TRYIMPORT); /* - * We must check this before we start the sync thread, because - * we only want to start a condense thread for condense - * operations that were in progress when the pool was - * imported. Once we start syncing, spa_sync() could - * initiate a condense (and start a thread for it). In - * that case it would be wrong to start a second - * condense thread. - */ - boolean_t condense_in_progress = - (spa->spa_condensing_indirect != NULL); - - /* * Traverse the ZIL and claim all blocks. */ spa_ld_claim_log_blocks(spa); @@ -3549,15 +3553,9 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char */ dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool); - /* - * Note: unlike condensing, we don't need an analogous - * "removal_in_progress" dance because no other thread - * can start a removal while we hold the spa_namespace_lock. - */ spa_restart_removal(spa); - if (condense_in_progress) - spa_condense_indirect_restart(spa); + spa_spawn_aux_threads(spa); } spa_load_note(spa, "LOADED"); @@ -4466,6 +4464,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ */ txg_wait_synced(spa->spa_dsl_pool, txg); + spa_spawn_aux_threads(spa); + spa_write_cachefile(spa, B_FALSE, B_TRUE); spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); @@ -6405,12 +6405,15 @@ spa_async_suspend(spa_t *spa) { mutex_enter(&spa->spa_async_lock); spa->spa_async_suspended++; - while (spa->spa_async_thread != NULL || - spa->spa_condense_thread != NULL) + while (spa->spa_async_thread != NULL) cv_wait(&spa->spa_async_cv, &spa->spa_async_lock); mutex_exit(&spa->spa_async_lock); spa_vdev_remove_suspend(spa); + + zthr_t *condense_thread = spa->spa_condense_zthr; + if (condense_thread != NULL && zthr_isrunning(condense_thread)) + VERIFY0(zthr_cancel(condense_thread)); } void @@ -6421,6 +6424,10 @@ spa_async_resume(spa_t *spa) spa->spa_async_suspended--; mutex_exit(&spa->spa_async_lock); spa_restart_removal(spa); + + zthr_t *condense_thread = spa->spa_condense_zthr; + if (condense_thread != NULL && !zthr_isrunning(condense_thread)) + zthr_resume(condense_thread); } static boolean_t Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Thu Feb 22 03:15:35 2018 (r329798) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Thu Feb 22 03:22:27 2018 (r329799) @@ -43,6 +43,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -278,7 +279,7 @@ struct spa { spa_condensing_indirect_phys_t spa_condensing_indirect_phys; spa_condensing_indirect_t *spa_condensing_indirect; - kthread_t *spa_condense_thread; /* thread doing condense. */ + zthr_t *spa_condense_zthr; /* zthr doing condense. */ char *spa_root; /* alternate root directory */ uint64_t spa_ena; /* spa-wide ereport ENA */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h Thu Feb 22 03:15:35 2018 (r329798) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_removal.h Thu Feb 22 03:22:27 2018 (r329799) @@ -76,7 +76,7 @@ extern int spa_remove_init(spa_t *); extern void spa_restart_removal(spa_t *); extern int spa_condense_init(spa_t *); extern void spa_condense_fini(spa_t *); -extern void spa_condense_indirect_restart(spa_t *); +extern void spa_start_indirect_condensing_thread(spa_t *); extern void spa_vdev_condense_suspend(spa_t *); extern int spa_vdev_remove(spa_t *, uint64_t, boolean_t); extern void free_from_removing_vdev(vdev_t *, uint64_t, uint64_t, uint64_t); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:15:35 2018 (r329798) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:22:27 2018 (r329799) @@ -30,6 +30,8 @@ #include #include #include +#include +#include /* * An indirect vdev corresponds to a vdev that has been removed. Since @@ -475,7 +477,7 @@ spa_condense_indirect_commit_entry(spa_t *spa, static void spa_condense_indirect_generate_new_mapping(vdev_t *vd, - uint32_t *obsolete_counts, uint64_t start_index) + uint32_t *obsolete_counts, uint64_t start_index, zthr_t *zthr) { spa_t *spa = vd->vdev_spa; uint64_t mapi = start_index; @@ -490,7 +492,15 @@ spa_condense_indirect_generate_new_mapping(vdev_t *vd, (u_longlong_t)vd->vdev_id, (u_longlong_t)mapi); - while (mapi < old_num_entries && !spa_shutting_down(spa)) { + while (mapi < old_num_entries) { + + if (zthr_iscancelled(zthr)) { + zfs_dbgmsg("pausing condense of vdev %llu " + "at index %llu", (u_longlong_t)vd->vdev_id, + (u_longlong_t)mapi); + break; + } + vdev_indirect_mapping_entry_phys_t *entry = &old_mapping->vim_entries[mapi]; uint64_t entry_size = DVA_GET_ASIZE(&entry->vimep_dst); @@ -508,18 +518,30 @@ spa_condense_indirect_generate_new_mapping(vdev_t *vd, mapi++; } - if (spa_shutting_down(spa)) { - zfs_dbgmsg("pausing condense of vdev %llu at index %llu", - (u_longlong_t)vd->vdev_id, - (u_longlong_t)mapi); - } } -static void -spa_condense_indirect_thread(void *arg) +/* ARGSUSED */ +static boolean_t +spa_condense_indirect_thread_check(void *arg, zthr_t *zthr) { - vdev_t *vd = arg; - spa_t *spa = vd->vdev_spa; + spa_t *spa = arg; + + return (spa->spa_condensing_indirect != NULL); +} + +/* ARGSUSED */ +static int +spa_condense_indirect_thread(void *arg, zthr_t *zthr) +{ + spa_t *spa = arg; + vdev_t *vd; + + ASSERT3P(spa->spa_condensing_indirect, !=, NULL); + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + vd = vdev_lookup_top(spa, spa->spa_condensing_indirect_phys.scip_vdev); + ASSERT3P(vd, !=, NULL); + spa_config_exit(spa, SCL_VDEV, FTAG); + spa_condensing_indirect_t *sci = spa->spa_condensing_indirect; spa_condensing_indirect_phys_t *scip = &spa->spa_condensing_indirect_phys; @@ -593,25 +615,24 @@ spa_condense_indirect_thread(void *arg) } } - spa_condense_indirect_generate_new_mapping(vd, counts, start_index); + spa_condense_indirect_generate_new_mapping(vd, counts, + start_index, zthr); vdev_indirect_mapping_free_obsolete_counts(old_mapping, counts); /* - * We may have bailed early from generate_new_mapping(), if - * the spa is shutting down. In this case, do not complete - * the condense. + * If the zthr has received a cancellation signal while running + * in generate_new_mapping() or at any point after that, then bail + * early. We don't want to complete the condense if the spa is + * shutting down. */ - if (!spa_shutting_down(spa)) { - VERIFY0(dsl_sync_task(spa_name(spa), NULL, - spa_condense_indirect_complete_sync, sci, 0, - ZFS_SPACE_CHECK_NONE)); - } + if (zthr_iscancelled(zthr)) + return (0); - mutex_enter(&spa->spa_async_lock); - spa->spa_condense_thread = NULL; - cv_broadcast(&spa->spa_async_cv); - mutex_exit(&spa->spa_async_lock); + VERIFY0(dsl_sync_task(spa_name(spa), NULL, + spa_condense_indirect_complete_sync, sci, 0, ZFS_SPACE_CHECK_NONE)); + + return (0); } /* @@ -664,9 +685,7 @@ spa_condense_indirect_start_sync(vdev_t *vd, dmu_tx_t (u_longlong_t)scip->scip_prev_obsolete_sm_object, (u_longlong_t)scip->scip_next_mapping_object); - ASSERT3P(spa->spa_condense_thread, ==, NULL); - spa->spa_condense_thread = thread_create(NULL, 0, - spa_condense_indirect_thread, vd, 0, &p0, TS_RUN, minclsyspri); + zthr_wakeup(spa->spa_condense_zthr); } /* @@ -743,24 +762,12 @@ spa_condense_fini(spa_t *spa) } } -/* - * Restart the condense - called when the pool is opened. - */ void -spa_condense_indirect_restart(spa_t *spa) +spa_start_indirect_condensing_thread(spa_t *spa) { - vdev_t *vd; - ASSERT(spa->spa_condensing_indirect != NULL); - spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); - vd = vdev_lookup_top(spa, - spa->spa_condensing_indirect_phys.scip_vdev); - ASSERT(vd != NULL); - spa_config_exit(spa, SCL_VDEV, FTAG); - - ASSERT3P(spa->spa_condense_thread, ==, NULL); - spa->spa_condense_thread = thread_create(NULL, 0, - spa_condense_indirect_thread, vd, 0, &p0, TS_RUN, - minclsyspri); + ASSERT3P(spa->spa_condense_zthr, ==, NULL); + spa->spa_condense_zthr = zthr_create(spa_condense_indirect_thread_check, + spa_condense_indirect_thread, spa); } /* From owner-svn-src-all@freebsd.org Thu Feb 22 03:49:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EFD7F2405C; Thu, 22 Feb 2018 03:49:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FAC08779F; Thu, 22 Feb 2018 03:49:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39EA12213D; Thu, 22 Feb 2018 03:49:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3n7t4009486; Thu, 22 Feb 2018 03:49:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3n60q009478; Thu, 22 Feb 2018 03:49:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220349.w1M3n60q009478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329802 - in head/sys: cddl/contrib/opensolaris/uts/common cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/fs/zfs/sys conf X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/fs/zfs/sys conf X-SVN-Commit-Revision: 329802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:49:07 -0000 Author: mav Date: Thu Feb 22 03:49:06 2018 New Revision: 329802 URL: https://svnweb.freebsd.org/changeset/base/329802 Log: MFV r329799, r329800: 9079 race condition in starting and ending condesing thread for indirect vdevs illumos/illumos-gate@667ec66f1b4f491d5e839644e0912cad1c9e7122 The timeline of the race condition is the following: [1] Thread A is about to finish condesing the first vdev in spa_condense_indirect_thread(), so it calls the spa_condense_indirect_complete_sync() sync task which sets the spa_condensing_indirect field to NULL. Waiting for the sync task to finish, thread A sleeps until the txg is done. When this happens, thread A will acquire spa_async_lock and set spa_condense_thread to NULL. [2] While thread A waits for the txg to finish, thread B which is running spa_sync() checks whether it should condense the second vdev in vdev_indirect_should_condense() by checking the spa_condensing_indirect field which was set to NULL by spa_condense_indirect_thread() from thread A. So it goes on and tries to spawn a new condensing thread in spa_condense_indirect_start_sync() and the aforementioned assertions fails because thread A has not set spa_condense_thread to NULL (which is basically the last thing it does before returning). The main issue here is that we rely on both spa_condensing_indirect and spa_condense_thread to signify whether a condensing thread is running. Ideally we would only use one throughout the codebase. In addition, for managing spa_condense_thread we currently use spa_async_lock which basically tights condensing to scrubing when it comes to pausing and resuming those actions during spa export. Reviewed by: Matt Ahrens Reviewed by: Pavel Zakharov Approved by: Hans Rosenfeld Author: Serapheim Dimitropoulos Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h - copied unchanged from r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c - copied unchanged from r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c head/sys/conf/files Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Feb 22 03:49:06 2018 (r329802) @@ -148,7 +148,8 @@ ZFS_COMMON_OBJS += \ zio_compress.o \ zio_inject.o \ zle.o \ - zrlock.o + zrlock.o \ + zthr.o ZFS_SHARED_OBJS += \ zfeature_common.o \ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Feb 22 03:49:06 2018 (r329802) @@ -1411,6 +1411,12 @@ spa_unload(spa_t *spa) spa->spa_vdev_removal = NULL; } + if (spa->spa_condense_zthr != NULL) { + ASSERT(!zthr_isrunning(spa->spa_condense_zthr)); + zthr_destroy(spa->spa_condense_zthr); + spa->spa_condense_zthr = NULL; + } + spa_condense_fini(spa); bpobj_close(&spa->spa_deferred_bpobj); @@ -2167,6 +2173,16 @@ spa_vdev_err(vdev_t *vdev, vdev_aux_t aux, int err) return (SET_ERROR(err)); } +static void +spa_spawn_aux_threads(spa_t *spa) +{ + ASSERT(spa_writeable(spa)); + + ASSERT(MUTEX_HELD(&spa_namespace_lock)); + + spa_start_indirect_condensing_thread(spa); +} + /* * Fix up config after a partly-completed split. This is done with the * ZPOOL_CONFIG_SPLIT nvlist. Both the splitting pool and the split-off @@ -3574,18 +3590,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char ASSERT(spa->spa_load_state != SPA_LOAD_TRYIMPORT); /* - * We must check this before we start the sync thread, because - * we only want to start a condense thread for condense - * operations that were in progress when the pool was - * imported. Once we start syncing, spa_sync() could - * initiate a condense (and start a thread for it). In - * that case it would be wrong to start a second - * condense thread. - */ - boolean_t condense_in_progress = - (spa->spa_condensing_indirect != NULL); - - /* * Traverse the ZIL and claim all blocks. */ spa_ld_claim_log_blocks(spa); @@ -3637,15 +3641,9 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char */ dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool); - /* - * Note: unlike condensing, we don't need an analogous - * "removal_in_progress" dance because no other thread - * can start a removal while we hold the spa_namespace_lock. - */ spa_restart_removal(spa); - if (condense_in_progress) - spa_condense_indirect_restart(spa); + spa_spawn_aux_threads(spa); } spa_load_note(spa, "LOADED"); @@ -4569,6 +4567,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ */ txg_wait_synced(spa->spa_dsl_pool, txg); + spa_spawn_aux_threads(spa); + spa_write_cachefile(spa, B_FALSE, B_TRUE); spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); @@ -6753,12 +6753,15 @@ spa_async_suspend(spa_t *spa) mutex_enter(&spa->spa_async_lock); spa->spa_async_suspended++; while (spa->spa_async_thread != NULL || - spa->spa_async_thread_vd != NULL || - spa->spa_condense_thread != NULL) + spa->spa_async_thread_vd != NULL) cv_wait(&spa->spa_async_cv, &spa->spa_async_lock); mutex_exit(&spa->spa_async_lock); spa_vdev_remove_suspend(spa); + + zthr_t *condense_thread = spa->spa_condense_zthr; + if (condense_thread != NULL && zthr_isrunning(condense_thread)) + VERIFY0(zthr_cancel(condense_thread)); } void @@ -6769,6 +6772,10 @@ spa_async_resume(spa_t *spa) spa->spa_async_suspended--; mutex_exit(&spa->spa_async_lock); spa_restart_removal(spa); + + zthr_t *condense_thread = spa->spa_condense_zthr; + if (condense_thread != NULL && !zthr_isrunning(condense_thread)) + zthr_resume(condense_thread); } static boolean_t Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Feb 22 03:49:06 2018 (r329802) @@ -44,6 +44,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -280,7 +281,7 @@ struct spa { spa_condensing_indirect_phys_t spa_condensing_indirect_phys; spa_condensing_indirect_t *spa_condensing_indirect; - kthread_t *spa_condense_thread; /* thread doing condense. */ + zthr_t *spa_condense_zthr; /* zthr doing condense. */ char *spa_root; /* alternate root directory */ uint64_t spa_ena; /* spa-wide ereport ENA */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h Thu Feb 22 03:49:06 2018 (r329802) @@ -76,7 +76,7 @@ extern int spa_remove_init(spa_t *); extern void spa_restart_removal(spa_t *); extern int spa_condense_init(spa_t *); extern void spa_condense_fini(spa_t *); -extern void spa_condense_indirect_restart(spa_t *); +extern void spa_start_indirect_condensing_thread(spa_t *); extern void spa_vdev_condense_suspend(spa_t *); extern int spa_vdev_remove(spa_t *, uint64_t, boolean_t); extern void free_from_removing_vdev(vdev_t *, uint64_t, uint64_t, uint64_t); Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h (from r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h Thu Feb 22 03:49:06 2018 (r329802, copy of r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h) @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_ZTHR_H +#define _SYS_ZTHR_H + +typedef struct zthr zthr_t; +typedef int (zthr_func_t)(void *, zthr_t *); +typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); + +struct zthr { + kthread_t *zthr_thread; + kmutex_t zthr_lock; + kcondvar_t zthr_cv; + boolean_t zthr_cancel; + + zthr_checkfunc_t *zthr_checkfunc; + zthr_func_t *zthr_func; + void *zthr_arg; + int zthr_rc; +}; + +extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, + zthr_func_t *func, void *arg); +extern void zthr_exit(zthr_t *t, int rc); +extern void zthr_destroy(zthr_t *t); + +extern void zthr_wakeup(zthr_t *t); +extern int zthr_cancel(zthr_t *t); +extern void zthr_resume(zthr_t *t); + +extern boolean_t zthr_iscancelled(zthr_t *t); +extern boolean_t zthr_isrunning(zthr_t *t); + +#endif /* _SYS_ZTHR_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:49:06 2018 (r329802) @@ -30,6 +30,8 @@ #include #include #include +#include +#include /* * An indirect vdev corresponds to a vdev that has been removed. Since @@ -475,7 +477,7 @@ spa_condense_indirect_commit_entry(spa_t *spa, static void spa_condense_indirect_generate_new_mapping(vdev_t *vd, - uint32_t *obsolete_counts, uint64_t start_index) + uint32_t *obsolete_counts, uint64_t start_index, zthr_t *zthr) { spa_t *spa = vd->vdev_spa; uint64_t mapi = start_index; @@ -490,7 +492,15 @@ spa_condense_indirect_generate_new_mapping(vdev_t *vd, (u_longlong_t)vd->vdev_id, (u_longlong_t)mapi); - while (mapi < old_num_entries && !spa_shutting_down(spa)) { + while (mapi < old_num_entries) { + + if (zthr_iscancelled(zthr)) { + zfs_dbgmsg("pausing condense of vdev %llu " + "at index %llu", (u_longlong_t)vd->vdev_id, + (u_longlong_t)mapi); + break; + } + vdev_indirect_mapping_entry_phys_t *entry = &old_mapping->vim_entries[mapi]; uint64_t entry_size = DVA_GET_ASIZE(&entry->vimep_dst); @@ -508,18 +518,30 @@ spa_condense_indirect_generate_new_mapping(vdev_t *vd, mapi++; } - if (spa_shutting_down(spa)) { - zfs_dbgmsg("pausing condense of vdev %llu at index %llu", - (u_longlong_t)vd->vdev_id, - (u_longlong_t)mapi); - } } -static void -spa_condense_indirect_thread(void *arg) +/* ARGSUSED */ +static boolean_t +spa_condense_indirect_thread_check(void *arg, zthr_t *zthr) { - vdev_t *vd = arg; - spa_t *spa = vd->vdev_spa; + spa_t *spa = arg; + + return (spa->spa_condensing_indirect != NULL); +} + +/* ARGSUSED */ +static int +spa_condense_indirect_thread(void *arg, zthr_t *zthr) +{ + spa_t *spa = arg; + vdev_t *vd; + + ASSERT3P(spa->spa_condensing_indirect, !=, NULL); + spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); + vd = vdev_lookup_top(spa, spa->spa_condensing_indirect_phys.scip_vdev); + ASSERT3P(vd, !=, NULL); + spa_config_exit(spa, SCL_VDEV, FTAG); + spa_condensing_indirect_t *sci = spa->spa_condensing_indirect; spa_condensing_indirect_phys_t *scip = &spa->spa_condensing_indirect_phys; @@ -593,25 +615,24 @@ spa_condense_indirect_thread(void *arg) } } - spa_condense_indirect_generate_new_mapping(vd, counts, start_index); + spa_condense_indirect_generate_new_mapping(vd, counts, + start_index, zthr); vdev_indirect_mapping_free_obsolete_counts(old_mapping, counts); /* - * We may have bailed early from generate_new_mapping(), if - * the spa is shutting down. In this case, do not complete - * the condense. + * If the zthr has received a cancellation signal while running + * in generate_new_mapping() or at any point after that, then bail + * early. We don't want to complete the condense if the spa is + * shutting down. */ - if (!spa_shutting_down(spa)) { - VERIFY0(dsl_sync_task(spa_name(spa), NULL, - spa_condense_indirect_complete_sync, sci, 0, - ZFS_SPACE_CHECK_NONE)); - } + if (zthr_iscancelled(zthr)) + return (0); - mutex_enter(&spa->spa_async_lock); - spa->spa_condense_thread = NULL; - cv_broadcast(&spa->spa_async_cv); - mutex_exit(&spa->spa_async_lock); + VERIFY0(dsl_sync_task(spa_name(spa), NULL, + spa_condense_indirect_complete_sync, sci, 0, ZFS_SPACE_CHECK_NONE)); + + return (0); thread_exit(); } @@ -665,9 +686,7 @@ spa_condense_indirect_start_sync(vdev_t *vd, dmu_tx_t (u_longlong_t)scip->scip_prev_obsolete_sm_object, (u_longlong_t)scip->scip_next_mapping_object); - ASSERT3P(spa->spa_condense_thread, ==, NULL); - spa->spa_condense_thread = thread_create(NULL, 0, - spa_condense_indirect_thread, vd, 0, &p0, TS_RUN, minclsyspri); + zthr_wakeup(spa->spa_condense_zthr); } /* @@ -744,24 +763,12 @@ spa_condense_fini(spa_t *spa) } } -/* - * Restart the condense - called when the pool is opened. - */ void -spa_condense_indirect_restart(spa_t *spa) +spa_start_indirect_condensing_thread(spa_t *spa) { - vdev_t *vd; - ASSERT(spa->spa_condensing_indirect != NULL); - spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); - vd = vdev_lookup_top(spa, - spa->spa_condensing_indirect_phys.scip_vdev); - ASSERT(vd != NULL); - spa_config_exit(spa, SCL_VDEV, FTAG); - - ASSERT3P(spa->spa_condense_thread, ==, NULL); - spa->spa_condense_thread = thread_create(NULL, 0, - spa_condense_indirect_thread, vd, 0, &p0, TS_RUN, - minclsyspri); + ASSERT3P(spa->spa_condense_zthr, ==, NULL); + spa->spa_condense_zthr = zthr_create(spa_condense_indirect_thread_check, + spa_condense_indirect_thread, spa); } /* Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c (from r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Thu Feb 22 03:49:06 2018 (r329802, copy of r329800, vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c) @@ -0,0 +1,319 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +/* + * ZTHR Infrastructure + * =================== + * + * ZTHR threads are used for isolated operations that span multiple txgs + * within a SPA. They generally exist from SPA creation/loading and until + * the SPA is exported/destroyed. The ideal requirements for an operation + * to be modeled with a zthr are the following: + * + * 1] The operation needs to run over multiple txgs. + * 2] There is be a single point of reference in memory or on disk that + * indicates whether the operation should run/is running or is + * stopped. + * + * If the operation satisfies the above then the following rules guarantee + * a certain level of correctness: + * + * 1] Any thread EXCEPT the zthr changes the work indicator from stopped + * to running but not the opposite. + * 2] Only the zthr can change the work indicator from running to stopped + * (e.g. when it is done) but not the opposite. + * + * This way a normal zthr cycle should go like this: + * + * 1] An external thread changes the work indicator from stopped to + * running and wakes up the zthr. + * 2] The zthr wakes up, checks the indicator and starts working. + * 3] When the zthr is done, it changes the indicator to stopped, allowing + * a new cycle to start. + * + * == ZTHR creation + * + * Every zthr needs three inputs to start running: + * + * 1] A user-defined checker function (checkfunc) that decides whether + * the zthr should start working or go to sleep. The function should + * return TRUE when the zthr needs to work or FALSE to let it sleep, + * and should adhere to the following signature: + * boolean_t checkfunc_name(void *args, zthr_t *t); + * + * 2] A user-defined ZTHR function (func) which the zthr executes when + * it is not sleeping. The function should adhere to the following + * signature type: + * int func_name(void *args, zthr_t *t); + * + * 3] A void args pointer that will be passed to checkfunc and func + * implicitly by the infrastructure. + * + * The reason why the above API needs two different functions, + * instead of one that both checks and does the work, has to do with + * the zthr's internal lock (zthr_lock) and the allowed cancellation + * windows. We want to hold the zthr_lock while running checkfunc + * but not while running func. This way the zthr can be cancelled + * while doing work and not while checking for work. + * + * To start a zthr: + * zthr_t *zthr_pointer = zthr_create(checkfunc, func, args); + * + * After that you should be able to wakeup, cancel, and resume the + * zthr from another thread using zthr_pointer. + * + * NOTE: ZTHR threads could potentially wake up spuriously and the + * user should take this into account when writing a checkfunc. + * [see ZTHR state transitions] + * + * == ZTHR cancellation + * + * ZTHR threads must be cancelled when their SPA is being exported + * or when they need to be paused so they don't interfere with other + * operations. + * + * To cancel a zthr: + * zthr_cancel(zthr_pointer); + * + * To resume it: + * zthr_resume(zthr_pointer); + * + * A zthr will implicitly check if it has received a cancellation + * signal every time func returns and everytime it wakes up [see ZTHR + * state transitions below]. + * + * At times, waiting for the zthr's func to finish its job may take + * time. This may be very time-consuming for some operations that + * need to cancel the SPA's zthrs (e.g spa_export). For this scenario + * the user can explicitly make their ZTHR function aware of incoming + * cancellation signals using zthr_iscancelled(). A common pattern for + * that looks like this: + * + * int + * func_name(void *args, zthr_t *t) + * { + * ... ... + * while (!work_done && !zthr_iscancelled(t)) { + * ... ... + * } + * return (0); + * } + * + * == ZTHR exit + * + * For the rare cases where the zthr wants to stop running voluntarily + * while running its ZTHR function (func), we provide zthr_exit(). + * When a zthr has voluntarily stopped running, it can be resumed with + * zthr_resume(), just like it would if it was cancelled by some other + * thread. + * + * == ZTHR cleanup + * + * Cancelling a zthr doesn't clean up its metadata (internal locks, + * function pointers to func and checkfunc, etc..). This is because + * we want to keep them around in case we want to resume the execution + * of the zthr later. Similarly for zthrs that exit themselves. + * + * To completely cleanup a zthr, cancel it first to ensure that it + * is not running and then use zthr_destroy(). + * + * == ZTHR state transitions + * + * zthr creation + * + + * | + * | woke up + * | +--------------+ sleep + * | | ^ + * | | | + * | | | FALSE + * | | | + * v v FALSE + + * cancelled? +---------> checkfunc? + * + ^ + + * | | | + * | | | TRUE + * | | | + * | | func returned v + * | +---------------+ func + * | + * | TRUE + * | + * v + * zthr stopped running + * + */ + +#include +#include + +void +zthr_exit(zthr_t *t, int rc) +{ + ASSERT3P(t->zthr_thread, ==, curthread); + mutex_enter(&t->zthr_lock); + t->zthr_thread = NULL; + t->zthr_rc = rc; + cv_broadcast(&t->zthr_cv); + mutex_exit(&t->zthr_lock); + thread_exit(); +} + +static void +zthr_procedure(void *arg) +{ + zthr_t *t = arg; + int rc = 0; + + mutex_enter(&t->zthr_lock); + while (!t->zthr_cancel) { + if (t->zthr_checkfunc(t->zthr_arg, t)) { + mutex_exit(&t->zthr_lock); + rc = t->zthr_func(t->zthr_arg, t); + mutex_enter(&t->zthr_lock); + } else { + /* go to sleep */ + cv_wait(&t->zthr_cv, &t->zthr_lock); + } + } + mutex_exit(&t->zthr_lock); + + zthr_exit(t, rc); +} + +zthr_t * +zthr_create(zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg) +{ + zthr_t *t = kmem_zalloc(sizeof (*t), KM_SLEEP); + mutex_init(&t->zthr_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&t->zthr_cv, NULL, CV_DEFAULT, NULL); + + mutex_enter(&t->zthr_lock); + t->zthr_checkfunc = checkfunc; + t->zthr_func = func; + t->zthr_arg = arg; + + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + mutex_exit(&t->zthr_lock); + + return (t); +} + +void +zthr_destroy(zthr_t *t) +{ + VERIFY3P(t->zthr_thread, ==, NULL); + mutex_destroy(&t->zthr_lock); + cv_destroy(&t->zthr_cv); + kmem_free(t, sizeof (*t)); +} + +/* + * Note: If the zthr is not sleeping and misses the wakeup + * (e.g it is running its ZTHR function), it will check if + * there is work to do before going to sleep using its checker + * function [see ZTHR state transition in ZTHR block comment]. + * Thus, missing the wakeup still yields the expected behavior. + */ +void +zthr_wakeup(zthr_t *t) +{ + ASSERT3P(t->zthr_thread, !=, NULL); + + mutex_enter(&t->zthr_lock); + cv_broadcast(&t->zthr_cv); + mutex_exit(&t->zthr_lock); +} + +/* + * Note: If the zthr is not running (e.g. has been cancelled + * already), this is a no-op. + */ +int +zthr_cancel(zthr_t *t) +{ + int rc = 0; + + mutex_enter(&t->zthr_lock); + + /* broadcast in case the zthr is sleeping */ + cv_broadcast(&t->zthr_cv); + + t->zthr_cancel = B_TRUE; + while (t->zthr_thread != NULL) + cv_wait(&t->zthr_cv, &t->zthr_lock); + t->zthr_cancel = B_FALSE; + rc = t->zthr_rc; + mutex_exit(&t->zthr_lock); + + return (rc); +} + +void +zthr_resume(zthr_t *t) +{ + ASSERT3P(t->zthr_thread, ==, NULL); + + mutex_enter(&t->zthr_lock); + + ASSERT3P(&t->zthr_checkfunc, !=, NULL); + ASSERT3P(&t->zthr_func, !=, NULL); + ASSERT(!t->zthr_cancel); + + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + + mutex_exit(&t->zthr_lock); +} + +/* + * This function is intended to be used by the zthr itself + * to check if another thread has signal it to stop running. + * + * returns TRUE if we are in the middle of trying to cancel + * this thread. + * + * returns FALSE otherwise. + */ +boolean_t +zthr_iscancelled(zthr_t *t) +{ + boolean_t cancelled; + + ASSERT3P(t->zthr_thread, ==, curthread); + + mutex_enter(&t->zthr_lock); + cancelled = t->zthr_cancel; + mutex_exit(&t->zthr_lock); + + return (cancelled); +} + +boolean_t +zthr_isrunning(zthr_t *t) +{ + boolean_t running; + + mutex_enter(&t->zthr_lock); + running = (t->zthr_thread != NULL); + mutex_exit(&t->zthr_lock); + + return (running); +} Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Feb 22 03:37:01 2018 (r329801) +++ head/sys/conf/files Thu Feb 22 03:49:06 2018 (r329802) @@ -261,6 +261,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compres cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zle.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/callb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/fm.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-all@freebsd.org Thu Feb 22 03:52:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F593F24434; Thu, 22 Feb 2018 03:52:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E5C587A7B; Thu, 22 Feb 2018 03:52:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3945E222B9; Thu, 22 Feb 2018 03:52:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3q4Vs011960; Thu, 22 Feb 2018 03:52:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3q4kN011959; Thu, 22 Feb 2018 03:52:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220352.w1M3q4kN011959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329803 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 329803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:52:04 -0000 Author: mav Date: Thu Feb 22 03:52:03 2018 New Revision: 329803 URL: https://svnweb.freebsd.org/changeset/base/329803 Log: 9080 recursive enter of vdev_indirect_rwlock from vdev_indirect_remap() illumos/illumos-gate@bdfded42e66b9fc1395ff2401aa2952f7c44ae34 A scenario came up where a callback executed by vdev_indirect_remap() on a vdev, calls vdev_indirect_remap() on the same vdev and tries to reacquire vdev_indirect_rwlock that was already acquired from the first call to vdev_indirect_remap(). The specific scenario, is that we want to remap a block pointer that is snapshoted but its dataset's remap_deadlist is not cached. So in order to add it we issue a read through a vdev_indirect_remap() on the same vdev, which brings up the aforementioned issue. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Hans Rosenfeld Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:49:06 2018 (r329802) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:52:03 2018 (r329803) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014, 2017 by Delphix. All rights reserved. */ #include @@ -852,6 +852,57 @@ rs_alloc(vdev_t *vd, uint64_t offset, uint64_t asize, } /* + * Given an indirect vdev and an extent on that vdev, it duplicates the + * physical entries of the indirect mapping that correspond to the extent + * to a new array and returns a pointer to it. In addition, copied_entries + * is populated with the number of mapping entries that were duplicated. + * + * Note that the function assumes that the caller holds vdev_indirect_rwlock. + * This ensures that the mapping won't change due to condensing as we + * copy over its contents. + * + * Finally, since we are doing an allocation, it is up to the caller to + * free the array allocated in this function. + */ +vdev_indirect_mapping_entry_phys_t * +vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *vd, uint64_t offset, + uint64_t asize, uint64_t *copied_entries) +{ + vdev_indirect_mapping_entry_phys_t *duplicate_mappings = NULL; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + uint64_t entries = 0; + + ASSERT(RW_READ_HELD(&vd->vdev_indirect_rwlock)); + + vdev_indirect_mapping_entry_phys_t *first_mapping = + vdev_indirect_mapping_entry_for_offset(vim, offset); + ASSERT3P(first_mapping, !=, NULL); + + vdev_indirect_mapping_entry_phys_t *m = first_mapping; + while (asize > 0) { + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + + ASSERT3U(offset, >=, DVA_MAPPING_GET_SRC_OFFSET(m)); + ASSERT3U(offset, <, DVA_MAPPING_GET_SRC_OFFSET(m) + size); + + uint64_t inner_offset = offset - DVA_MAPPING_GET_SRC_OFFSET(m); + uint64_t inner_size = MIN(asize, size - inner_offset); + + offset += inner_size; + asize -= inner_size; + entries++; + m++; + } + + size_t copy_length = entries * sizeof (*first_mapping); + duplicate_mappings = kmem_alloc(copy_length, KM_SLEEP); + bcopy(first_mapping, duplicate_mappings, copy_length); + *copied_entries = entries; + + return (duplicate_mappings); +} + +/* * Goes through the relevant indirect mappings until it hits a concrete vdev * and issues the callback. On the way to the concrete vdev, if any other * indirect vdevs are encountered, then the callback will also be called on @@ -891,24 +942,42 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0); rs != NULL; rs = list_remove_head(&stack)) { vdev_t *v = rs->rs_vd; + uint64_t num_entries = 0; + ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); + ASSERT(rs->rs_asize > 0); + /* - * Note: this can be called from open context - * (eg. zio_read()), so we need the rwlock to prevent - * the mapping from being changed by condensing. + * Note: As this function can be called from open context + * (e.g. zio_read()), we need the following rwlock to + * prevent the mapping from being changed by condensing. + * + * So we grab the lock and we make a copy of the entries + * that are relevant to the extent that we are working on. + * Once that is done, we drop the lock and iterate over + * our copy of the mapping. Once we are done with the with + * the remap segment and we free it, we also free our copy + * of the indirect mapping entries that are relevant to it. + * + * This way we don't need to wait until the function is + * finished with a segment, to condense it. In addition, we + * don't need a recursive rwlock for the case that a call to + * vdev_indirect_remap() needs to call itself (through the + * codepath of its callback) for the same vdev in the middle + * of its execution. */ rw_enter(&v->vdev_indirect_rwlock, RW_READER); vdev_indirect_mapping_t *vim = v->vdev_indirect_mapping; ASSERT3P(vim, !=, NULL); - ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); - ASSERT(rs->rs_asize > 0); - vdev_indirect_mapping_entry_phys_t *mapping = - vdev_indirect_mapping_entry_for_offset(vim, rs->rs_offset); + vdev_indirect_mapping_duplicate_adjacent_entries(v, + rs->rs_offset, rs->rs_asize, &num_entries); ASSERT3P(mapping, !=, NULL); + ASSERT3U(num_entries, >, 0); + rw_exit(&v->vdev_indirect_rwlock); - while (rs->rs_asize > 0) { + for (uint64_t i = 0; i < num_entries; i++) { /* * Note: the vdev_indirect_mapping can not change * while we are running. It only changes while the @@ -917,20 +986,23 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 * function is only called for frees, which also only * happen from syncing context. */ + vdev_indirect_mapping_entry_phys_t *m = &mapping[i]; - uint64_t size = DVA_GET_ASIZE(&mapping->vimep_dst); - uint64_t dst_offset = - DVA_GET_OFFSET(&mapping->vimep_dst); - uint64_t dst_vdev = DVA_GET_VDEV(&mapping->vimep_dst); + ASSERT3P(m, !=, NULL); + ASSERT3U(rs->rs_asize, >, 0); + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + uint64_t dst_offset = DVA_GET_OFFSET(&m->vimep_dst); + uint64_t dst_vdev = DVA_GET_VDEV(&m->vimep_dst); + ASSERT3U(rs->rs_offset, >=, - DVA_MAPPING_GET_SRC_OFFSET(mapping)); + DVA_MAPPING_GET_SRC_OFFSET(m)); ASSERT3U(rs->rs_offset, <, - DVA_MAPPING_GET_SRC_OFFSET(mapping) + size); + DVA_MAPPING_GET_SRC_OFFSET(m) + size); ASSERT3U(dst_vdev, !=, v->vdev_id); uint64_t inner_offset = rs->rs_offset - - DVA_MAPPING_GET_SRC_OFFSET(mapping); + DVA_MAPPING_GET_SRC_OFFSET(m); uint64_t inner_size = MIN(rs->rs_asize, size - inner_offset); @@ -971,10 +1043,10 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 rs->rs_offset += inner_size; rs->rs_asize -= inner_size; rs->rs_split_offset += inner_size; - mapping++; } + VERIFY0(rs->rs_asize); - rw_exit(&v->vdev_indirect_rwlock); + kmem_free(mapping, num_entries * sizeof (*mapping)); kmem_free(rs, sizeof (remap_segment_t)); } list_destroy(&stack); From owner-svn-src-all@freebsd.org Thu Feb 22 04:01:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04F71F254AF; Thu, 22 Feb 2018 04:01:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEBD968734; Thu, 22 Feb 2018 04:01:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A94E922388; Thu, 22 Feb 2018 04:01:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M41tfn018643; Thu, 22 Feb 2018 04:01:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M41tp8018641; Thu, 22 Feb 2018 04:01:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220401.w1M41tp8018641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 04:01:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329808 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 329808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:01:56 -0000 Author: mav Date: Thu Feb 22 04:01:55 2018 New Revision: 329808 URL: https://svnweb.freebsd.org/changeset/base/329808 Log: MFV r329807: 8940 Sending an intra-pool resumable send stream may result in EXDEV illumos/illumos-gate@544132fce3fa6583f01318f9559adc46614343a7 "zfs send -t " for an incremental send should be able to resume successfully when sending to the same pool: a subtle issue in zfs_iter_children() doesn't currently allow this. Because resuming from a token requires "guid" -> "dataset" mapping (guid_to_name()), we have to walk the whole hierarchy to find the right snapshots to send. When resuming an incremental send both source and destination live in the same pool and have the same guid: this is where zfs_iter_children() gets confused and picks up the wrong snapshot, so we end up trying to send an incremental "destination@snap1 -> source@snap2" stream instead of "source@snap1 -> source@snap2": this fails with an "Invalid cross-device link" (EXDEV) error. Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Hans Rosenfeld Author: loli10K Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Feb 22 04:01:05 2018 (r329807) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Feb 22 04:01:55 2018 (r329808) @@ -424,16 +424,20 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp /* * Iterate over all children, snapshots and filesystems + * Process snapshots before filesystems because they are nearer the input + * handle: this is extremely important when used with zfs_iter_f functions + * looking for data, following the logic that we would like to find it as soon + * and as close as possible. */ int zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data) { int ret; - if ((ret = zfs_iter_filesystems(zhp, func, data)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) return (ret); - return (zfs_iter_snapshots(zhp, B_FALSE, func, data)); + return (zfs_iter_filesystems(zhp, func, data)); } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Feb 22 04:01:05 2018 (r329807) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Feb 22 04:01:55 2018 (r329808) @@ -1585,6 +1585,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla int error = 0; char name[ZFS_MAX_DATASET_NAME_LEN]; enum lzc_send_flags lzc_flags = 0; + FILE *fout = (flags->verbose && flags->dryrun) ? stdout : stderr; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot resume send")); @@ -1599,9 +1600,9 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla return (zfs_error(hdl, EZFS_FAULT, errbuf)); } if (flags->verbose) { - (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + (void) fprintf(fout, dgettext(TEXT_DOMAIN, "resume token contents:\n")); - nvlist_print(stderr, resume_nvl); + nvlist_print(fout, resume_nvl); } if (nvlist_lookup_string(resume_nvl, "toname", &toname) != 0 || @@ -1658,7 +1659,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla lzc_flags, &size); if (error == 0) size = MAX(0, (int64_t)(size - bytes)); - send_print_verbose(stderr, zhp->zfs_name, fromname, + send_print_verbose(fout, zhp->zfs_name, fromname, size, flags->parsable); } From owner-svn-src-all@freebsd.org Thu Feb 22 03:23:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80180F21F1B; Thu, 22 Feb 2018 03:23:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 306E0865C3; Thu, 22 Feb 2018 03:23:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 298CA21D4A; Thu, 22 Feb 2018 03:23:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3NiXb098918; Thu, 22 Feb 2018 03:23:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3Nhjg098916; Thu, 22 Feb 2018 03:23:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220323.w1M3Nhjg098916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329800 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:23:44 -0000 Author: mav Date: Thu Feb 22 03:23:43 2018 New Revision: 329800 URL: https://svnweb.freebsd.org/changeset/base/329800 Log: Missed pieces of r329799. Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c (contents, props changed) Added: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zthr.h Thu Feb 22 03:23:43 2018 (r329800) @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +#ifndef _SYS_ZTHR_H +#define _SYS_ZTHR_H + +typedef struct zthr zthr_t; +typedef int (zthr_func_t)(void *, zthr_t *); +typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); + +struct zthr { + kthread_t *zthr_thread; + kmutex_t zthr_lock; + kcondvar_t zthr_cv; + boolean_t zthr_cancel; + + zthr_checkfunc_t *zthr_checkfunc; + zthr_func_t *zthr_func; + void *zthr_arg; + int zthr_rc; +}; + +extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, + zthr_func_t *func, void *arg); +extern void zthr_exit(zthr_t *t, int rc); +extern void zthr_destroy(zthr_t *t); + +extern void zthr_wakeup(zthr_t *t); +extern int zthr_cancel(zthr_t *t); +extern void zthr_resume(zthr_t *t); + +extern boolean_t zthr_iscancelled(zthr_t *t); +extern boolean_t zthr_isrunning(zthr_t *t); + +#endif /* _SYS_ZTHR_H */ Added: vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zthr.c Thu Feb 22 03:23:43 2018 (r329800) @@ -0,0 +1,319 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2017 by Delphix. All rights reserved. + */ + +/* + * ZTHR Infrastructure + * =================== + * + * ZTHR threads are used for isolated operations that span multiple txgs + * within a SPA. They generally exist from SPA creation/loading and until + * the SPA is exported/destroyed. The ideal requirements for an operation + * to be modeled with a zthr are the following: + * + * 1] The operation needs to run over multiple txgs. + * 2] There is be a single point of reference in memory or on disk that + * indicates whether the operation should run/is running or is + * stopped. + * + * If the operation satisfies the above then the following rules guarantee + * a certain level of correctness: + * + * 1] Any thread EXCEPT the zthr changes the work indicator from stopped + * to running but not the opposite. + * 2] Only the zthr can change the work indicator from running to stopped + * (e.g. when it is done) but not the opposite. + * + * This way a normal zthr cycle should go like this: + * + * 1] An external thread changes the work indicator from stopped to + * running and wakes up the zthr. + * 2] The zthr wakes up, checks the indicator and starts working. + * 3] When the zthr is done, it changes the indicator to stopped, allowing + * a new cycle to start. + * + * == ZTHR creation + * + * Every zthr needs three inputs to start running: + * + * 1] A user-defined checker function (checkfunc) that decides whether + * the zthr should start working or go to sleep. The function should + * return TRUE when the zthr needs to work or FALSE to let it sleep, + * and should adhere to the following signature: + * boolean_t checkfunc_name(void *args, zthr_t *t); + * + * 2] A user-defined ZTHR function (func) which the zthr executes when + * it is not sleeping. The function should adhere to the following + * signature type: + * int func_name(void *args, zthr_t *t); + * + * 3] A void args pointer that will be passed to checkfunc and func + * implicitly by the infrastructure. + * + * The reason why the above API needs two different functions, + * instead of one that both checks and does the work, has to do with + * the zthr's internal lock (zthr_lock) and the allowed cancellation + * windows. We want to hold the zthr_lock while running checkfunc + * but not while running func. This way the zthr can be cancelled + * while doing work and not while checking for work. + * + * To start a zthr: + * zthr_t *zthr_pointer = zthr_create(checkfunc, func, args); + * + * After that you should be able to wakeup, cancel, and resume the + * zthr from another thread using zthr_pointer. + * + * NOTE: ZTHR threads could potentially wake up spuriously and the + * user should take this into account when writing a checkfunc. + * [see ZTHR state transitions] + * + * == ZTHR cancellation + * + * ZTHR threads must be cancelled when their SPA is being exported + * or when they need to be paused so they don't interfere with other + * operations. + * + * To cancel a zthr: + * zthr_cancel(zthr_pointer); + * + * To resume it: + * zthr_resume(zthr_pointer); + * + * A zthr will implicitly check if it has received a cancellation + * signal every time func returns and everytime it wakes up [see ZTHR + * state transitions below]. + * + * At times, waiting for the zthr's func to finish its job may take + * time. This may be very time-consuming for some operations that + * need to cancel the SPA's zthrs (e.g spa_export). For this scenario + * the user can explicitly make their ZTHR function aware of incoming + * cancellation signals using zthr_iscancelled(). A common pattern for + * that looks like this: + * + * int + * func_name(void *args, zthr_t *t) + * { + * ... ... + * while (!work_done && !zthr_iscancelled(t)) { + * ... ... + * } + * return (0); + * } + * + * == ZTHR exit + * + * For the rare cases where the zthr wants to stop running voluntarily + * while running its ZTHR function (func), we provide zthr_exit(). + * When a zthr has voluntarily stopped running, it can be resumed with + * zthr_resume(), just like it would if it was cancelled by some other + * thread. + * + * == ZTHR cleanup + * + * Cancelling a zthr doesn't clean up its metadata (internal locks, + * function pointers to func and checkfunc, etc..). This is because + * we want to keep them around in case we want to resume the execution + * of the zthr later. Similarly for zthrs that exit themselves. + * + * To completely cleanup a zthr, cancel it first to ensure that it + * is not running and then use zthr_destroy(). + * + * == ZTHR state transitions + * + * zthr creation + * + + * | + * | woke up + * | +--------------+ sleep + * | | ^ + * | | | + * | | | FALSE + * | | | + * v v FALSE + + * cancelled? +---------> checkfunc? + * + ^ + + * | | | + * | | | TRUE + * | | | + * | | func returned v + * | +---------------+ func + * | + * | TRUE + * | + * v + * zthr stopped running + * + */ + +#include +#include + +void +zthr_exit(zthr_t *t, int rc) +{ + ASSERT3P(t->zthr_thread, ==, curthread); + mutex_enter(&t->zthr_lock); + t->zthr_thread = NULL; + t->zthr_rc = rc; + cv_broadcast(&t->zthr_cv); + mutex_exit(&t->zthr_lock); + thread_exit(); +} + +static void +zthr_procedure(void *arg) +{ + zthr_t *t = arg; + int rc = 0; + + mutex_enter(&t->zthr_lock); + while (!t->zthr_cancel) { + if (t->zthr_checkfunc(t->zthr_arg, t)) { + mutex_exit(&t->zthr_lock); + rc = t->zthr_func(t->zthr_arg, t); + mutex_enter(&t->zthr_lock); + } else { + /* go to sleep */ + cv_wait(&t->zthr_cv, &t->zthr_lock); + } + } + mutex_exit(&t->zthr_lock); + + zthr_exit(t, rc); +} + +zthr_t * +zthr_create(zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg) +{ + zthr_t *t = kmem_zalloc(sizeof (*t), KM_SLEEP); + mutex_init(&t->zthr_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&t->zthr_cv, NULL, CV_DEFAULT, NULL); + + mutex_enter(&t->zthr_lock); + t->zthr_checkfunc = checkfunc; + t->zthr_func = func; + t->zthr_arg = arg; + + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + mutex_exit(&t->zthr_lock); + + return (t); +} + +void +zthr_destroy(zthr_t *t) +{ + VERIFY3P(t->zthr_thread, ==, NULL); + mutex_destroy(&t->zthr_lock); + cv_destroy(&t->zthr_cv); + kmem_free(t, sizeof (*t)); +} + +/* + * Note: If the zthr is not sleeping and misses the wakeup + * (e.g it is running its ZTHR function), it will check if + * there is work to do before going to sleep using its checker + * function [see ZTHR state transition in ZTHR block comment]. + * Thus, missing the wakeup still yields the expected behavior. + */ +void +zthr_wakeup(zthr_t *t) +{ + ASSERT3P(t->zthr_thread, !=, NULL); + + mutex_enter(&t->zthr_lock); + cv_broadcast(&t->zthr_cv); + mutex_exit(&t->zthr_lock); +} + +/* + * Note: If the zthr is not running (e.g. has been cancelled + * already), this is a no-op. + */ +int +zthr_cancel(zthr_t *t) +{ + int rc = 0; + + mutex_enter(&t->zthr_lock); + + /* broadcast in case the zthr is sleeping */ + cv_broadcast(&t->zthr_cv); + + t->zthr_cancel = B_TRUE; + while (t->zthr_thread != NULL) + cv_wait(&t->zthr_cv, &t->zthr_lock); + t->zthr_cancel = B_FALSE; + rc = t->zthr_rc; + mutex_exit(&t->zthr_lock); + + return (rc); +} + +void +zthr_resume(zthr_t *t) +{ + ASSERT3P(t->zthr_thread, ==, NULL); + + mutex_enter(&t->zthr_lock); + + ASSERT3P(&t->zthr_checkfunc, !=, NULL); + ASSERT3P(&t->zthr_func, !=, NULL); + ASSERT(!t->zthr_cancel); + + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + + mutex_exit(&t->zthr_lock); +} + +/* + * This function is intended to be used by the zthr itself + * to check if another thread has signal it to stop running. + * + * returns TRUE if we are in the middle of trying to cancel + * this thread. + * + * returns FALSE otherwise. + */ +boolean_t +zthr_iscancelled(zthr_t *t) +{ + boolean_t cancelled; + + ASSERT3P(t->zthr_thread, ==, curthread); + + mutex_enter(&t->zthr_lock); + cancelled = t->zthr_cancel; + mutex_exit(&t->zthr_lock); + + return (cancelled); +} + +boolean_t +zthr_isrunning(zthr_t *t) +{ + boolean_t running; + + mutex_enter(&t->zthr_lock); + running = (t->zthr_thread != NULL); + mutex_exit(&t->zthr_lock); + + return (running); +} From owner-svn-src-all@freebsd.org Thu Feb 22 04:01:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D638F2534D; Thu, 22 Feb 2018 04:01:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1896168460; Thu, 22 Feb 2018 04:01:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1380122347; Thu, 22 Feb 2018 04:01:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M415fR016390; Thu, 22 Feb 2018 04:01:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M415FS016388; Thu, 22 Feb 2018 04:01:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220401.w1M415FS016388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 04:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329807 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 329807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:01:06 -0000 Author: mav Date: Thu Feb 22 04:01:05 2018 New Revision: 329807 URL: https://svnweb.freebsd.org/changeset/base/329807 Log: 8940 Sending an intra-pool resumable send stream may result in EXDEV illumos/illumos-gate@544132fce3fa6583f01318f9559adc46614343a7 "zfs send -t " for an incremental send should be able to resume successfully when sending to the same pool: a subtle issue in zfs_iter_children() doesn't currently allow this. Because resuming from a token requires "guid" -> "dataset" mapping (guid_to_name()), we have to walk the whole hierarchy to find the right snapshots to send. When resuming an incremental send both source and destination live in the same pool and have the same guid: this is where zfs_iter_children() gets confused and picks up the wrong snapshot, so we end up trying to send an incremental "destination@snap1 -> source@snap2" stream instead of "source@snap1 -> source@snap2": this fails with an "Invalid cross-device link" (EXDEV) error. Reviewed by: Paul Dagnelie Reviewed by: Matthew Ahrens Approved by: Hans Rosenfeld Author: loli10K Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c Thu Feb 22 03:55:02 2018 (r329806) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c Thu Feb 22 04:01:05 2018 (r329807) @@ -424,16 +424,20 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp /* * Iterate over all children, snapshots and filesystems + * Process snapshots before filesystems because they are nearer the input + * handle: this is extremely important when used with zfs_iter_f functions + * looking for data, following the logic that we would like to find it as soon + * and as close as possible. */ int zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data) { int ret; - if ((ret = zfs_iter_filesystems(zhp, func, data)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) return (ret); - return (zfs_iter_snapshots(zhp, B_FALSE, func, data)); + return (zfs_iter_filesystems(zhp, func, data)); } Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Thu Feb 22 03:55:02 2018 (r329806) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c Thu Feb 22 04:01:05 2018 (r329807) @@ -1577,6 +1577,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla int error = 0; char name[ZFS_MAX_DATASET_NAME_LEN]; enum lzc_send_flags lzc_flags = 0; + FILE *fout = (flags->verbose && flags->dryrun) ? stdout : stderr; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot resume send")); @@ -1591,9 +1592,9 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla return (zfs_error(hdl, EZFS_FAULT, errbuf)); } if (flags->verbose) { - (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + (void) fprintf(fout, dgettext(TEXT_DOMAIN, "resume token contents:\n")); - nvlist_print(stderr, resume_nvl); + nvlist_print(fout, resume_nvl); } if (nvlist_lookup_string(resume_nvl, "toname", &toname) != 0 || @@ -1650,7 +1651,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla lzc_flags, &size); if (error == 0) size = MAX(0, (int64_t)(size - bytes)); - send_print_verbose(stderr, zhp->zfs_name, fromname, + send_print_verbose(fout, zhp->zfs_name, fromname, size, flags->parsable); } From owner-svn-src-all@freebsd.org Thu Feb 22 03:53:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 283BFF245EC; Thu, 22 Feb 2018 03:53:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C68BC87CF2; Thu, 22 Feb 2018 03:53:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C163A222E7; Thu, 22 Feb 2018 03:53:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3rnSH014479; Thu, 22 Feb 2018 03:53:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3rnDp014478; Thu, 22 Feb 2018 03:53:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220353.w1M3rnDp014478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 03:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329804 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:53:50 -0000 Author: kevans Date: Thu Feb 22 03:53:49 2018 New Revision: 329804 URL: https://svnweb.freebsd.org/changeset/base/329804 Log: lualoader: Eliminate some unused locals Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Thu Feb 22 03:52:03 2018 (r329803) +++ head/stand/lua/menu.lua Thu Feb 22 03:53:49 2018 (r329804) @@ -36,10 +36,6 @@ local drawer = require("drawer") local menu = {} -local skip -local run -local autoboot - local OnOff = function(str, b) if b then return str .. color.escapef(color.GREEN) .. "On" .. From owner-svn-src-all@freebsd.org Thu Feb 22 03:55:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26F62F247C6; Thu, 22 Feb 2018 03:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D04C787E08; Thu, 22 Feb 2018 03:54:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB47E222EF; Thu, 22 Feb 2018 03:54:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3sxDa014575; Thu, 22 Feb 2018 03:54:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3sx6Q014574; Thu, 22 Feb 2018 03:54:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802220354.w1M3sx6Q014574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Feb 2018 03:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329805 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:55:00 -0000 Author: mav Date: Thu Feb 22 03:54:59 2018 New Revision: 329805 URL: https://svnweb.freebsd.org/changeset/base/329805 Log: MFV r329803: 9080 recursive enter of vdev_indirect_rwlock from vdev_indirect_remap() illumos/illumos-gate@bdfded42e66b9fc1395ff2401aa2952f7c44ae34 A scenario came up where a callback executed by vdev_indirect_remap() on a vdev, calls vdev_indirect_remap() on the same vdev and tries to reacquire vdev_indirect_rwlock that was already acquired from the first call to vdev_indirect_remap(). The specific scenario, is that we want to remap a block pointer that is snapshoted but its dataset's remap_deadlist is not cached. So in order to add it we issue a read through a vdev_indirect_remap() on the same vdev, which brings up the aforementioned issue. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Hans Rosenfeld Author: Serapheim Dimitropoulos Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:53:49 2018 (r329804) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Thu Feb 22 03:54:59 2018 (r329805) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014, 2017 by Delphix. All rights reserved. */ #include @@ -854,6 +854,57 @@ rs_alloc(vdev_t *vd, uint64_t offset, uint64_t asize, } /* + * Given an indirect vdev and an extent on that vdev, it duplicates the + * physical entries of the indirect mapping that correspond to the extent + * to a new array and returns a pointer to it. In addition, copied_entries + * is populated with the number of mapping entries that were duplicated. + * + * Note that the function assumes that the caller holds vdev_indirect_rwlock. + * This ensures that the mapping won't change due to condensing as we + * copy over its contents. + * + * Finally, since we are doing an allocation, it is up to the caller to + * free the array allocated in this function. + */ +vdev_indirect_mapping_entry_phys_t * +vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *vd, uint64_t offset, + uint64_t asize, uint64_t *copied_entries) +{ + vdev_indirect_mapping_entry_phys_t *duplicate_mappings = NULL; + vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; + uint64_t entries = 0; + + ASSERT(RW_READ_HELD(&vd->vdev_indirect_rwlock)); + + vdev_indirect_mapping_entry_phys_t *first_mapping = + vdev_indirect_mapping_entry_for_offset(vim, offset); + ASSERT3P(first_mapping, !=, NULL); + + vdev_indirect_mapping_entry_phys_t *m = first_mapping; + while (asize > 0) { + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + + ASSERT3U(offset, >=, DVA_MAPPING_GET_SRC_OFFSET(m)); + ASSERT3U(offset, <, DVA_MAPPING_GET_SRC_OFFSET(m) + size); + + uint64_t inner_offset = offset - DVA_MAPPING_GET_SRC_OFFSET(m); + uint64_t inner_size = MIN(asize, size - inner_offset); + + offset += inner_size; + asize -= inner_size; + entries++; + m++; + } + + size_t copy_length = entries * sizeof (*first_mapping); + duplicate_mappings = kmem_alloc(copy_length, KM_SLEEP); + bcopy(first_mapping, duplicate_mappings, copy_length); + *copied_entries = entries; + + return (duplicate_mappings); +} + +/* * Goes through the relevant indirect mappings until it hits a concrete vdev * and issues the callback. On the way to the concrete vdev, if any other * indirect vdevs are encountered, then the callback will also be called on @@ -893,24 +944,42 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0); rs != NULL; rs = list_remove_head(&stack)) { vdev_t *v = rs->rs_vd; + uint64_t num_entries = 0; + ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); + ASSERT(rs->rs_asize > 0); + /* - * Note: this can be called from open context - * (eg. zio_read()), so we need the rwlock to prevent - * the mapping from being changed by condensing. + * Note: As this function can be called from open context + * (e.g. zio_read()), we need the following rwlock to + * prevent the mapping from being changed by condensing. + * + * So we grab the lock and we make a copy of the entries + * that are relevant to the extent that we are working on. + * Once that is done, we drop the lock and iterate over + * our copy of the mapping. Once we are done with the with + * the remap segment and we free it, we also free our copy + * of the indirect mapping entries that are relevant to it. + * + * This way we don't need to wait until the function is + * finished with a segment, to condense it. In addition, we + * don't need a recursive rwlock for the case that a call to + * vdev_indirect_remap() needs to call itself (through the + * codepath of its callback) for the same vdev in the middle + * of its execution. */ rw_enter(&v->vdev_indirect_rwlock, RW_READER); vdev_indirect_mapping_t *vim = v->vdev_indirect_mapping; ASSERT3P(vim, !=, NULL); - ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); - ASSERT(rs->rs_asize > 0); - vdev_indirect_mapping_entry_phys_t *mapping = - vdev_indirect_mapping_entry_for_offset(vim, rs->rs_offset); + vdev_indirect_mapping_duplicate_adjacent_entries(v, + rs->rs_offset, rs->rs_asize, &num_entries); ASSERT3P(mapping, !=, NULL); + ASSERT3U(num_entries, >, 0); + rw_exit(&v->vdev_indirect_rwlock); - while (rs->rs_asize > 0) { + for (uint64_t i = 0; i < num_entries; i++) { /* * Note: the vdev_indirect_mapping can not change * while we are running. It only changes while the @@ -919,20 +988,23 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 * function is only called for frees, which also only * happen from syncing context. */ + vdev_indirect_mapping_entry_phys_t *m = &mapping[i]; - uint64_t size = DVA_GET_ASIZE(&mapping->vimep_dst); - uint64_t dst_offset = - DVA_GET_OFFSET(&mapping->vimep_dst); - uint64_t dst_vdev = DVA_GET_VDEV(&mapping->vimep_dst); + ASSERT3P(m, !=, NULL); + ASSERT3U(rs->rs_asize, >, 0); + uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); + uint64_t dst_offset = DVA_GET_OFFSET(&m->vimep_dst); + uint64_t dst_vdev = DVA_GET_VDEV(&m->vimep_dst); + ASSERT3U(rs->rs_offset, >=, - DVA_MAPPING_GET_SRC_OFFSET(mapping)); + DVA_MAPPING_GET_SRC_OFFSET(m)); ASSERT3U(rs->rs_offset, <, - DVA_MAPPING_GET_SRC_OFFSET(mapping) + size); + DVA_MAPPING_GET_SRC_OFFSET(m) + size); ASSERT3U(dst_vdev, !=, v->vdev_id); uint64_t inner_offset = rs->rs_offset - - DVA_MAPPING_GET_SRC_OFFSET(mapping); + DVA_MAPPING_GET_SRC_OFFSET(m); uint64_t inner_size = MIN(rs->rs_asize, size - inner_offset); @@ -973,10 +1045,10 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 rs->rs_offset += inner_size; rs->rs_asize -= inner_size; rs->rs_split_offset += inner_size; - mapping++; } + VERIFY0(rs->rs_asize); - rw_exit(&v->vdev_indirect_rwlock); + kmem_free(mapping, num_entries * sizeof (*mapping)); kmem_free(rs, sizeof (remap_segment_t)); } list_destroy(&stack); From owner-svn-src-all@freebsd.org Thu Feb 22 03:37:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DEB2F22D34; Thu, 22 Feb 2018 03:37:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF4BC86E3E; Thu, 22 Feb 2018 03:37:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4D3421F4E; Thu, 22 Feb 2018 03:37:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3b1pK004447; Thu, 22 Feb 2018 03:37:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3b1JV004446; Thu, 22 Feb 2018 03:37:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802220337.w1M3b1JV004446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Feb 2018 03:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329801 - head/sys/amd64/linux32 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/amd64/linux32 X-SVN-Commit-Revision: 329801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:37:02 -0000 Author: emaste Date: Thu Feb 22 03:37:01 2018 New Revision: 329801 URL: https://svnweb.freebsd.org/changeset/base/329801 Log: Remove accidental vim droppings Reported by: cy Modified: head/sys/amd64/linux32/linux32_dummy.c Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Thu Feb 22 03:23:43 2018 (r329800) +++ head/sys/amd64/linux32/linux32_dummy.c Thu Feb 22 03:37:01 2018 (r329801) @@ -1,4 +1,3 @@ - sys/sys/sysent.2 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * From owner-svn-src-all@freebsd.org Thu Feb 22 03:55:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D61FF247CF; Thu, 22 Feb 2018 03:55:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F01EE87E1D; Thu, 22 Feb 2018 03:55:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB222222F0; Thu, 22 Feb 2018 03:55:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M3t2hs014660; Thu, 22 Feb 2018 03:55:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M3t2F7014659; Thu, 22 Feb 2018 03:55:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220355.w1M3t2F7014659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 03:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329806 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:55:03 -0000 Author: kevans Date: Thu Feb 22 03:55:02 2018 New Revision: 329806 URL: https://svnweb.freebsd.org/changeset/base/329806 Log: lualoader: Consistently use double quotes Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Thu Feb 22 03:54:59 2018 (r329805) +++ head/stand/lua/core.lua Thu Feb 22 03:55:02 2018 (r329806) @@ -26,7 +26,7 @@ -- $FreeBSD$ -- -local config = require('config') +local config = require("config") local core = {} From owner-svn-src-all@freebsd.org Thu Feb 22 04:15:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDA32F264FD; Thu, 22 Feb 2018 04:15:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F83968FF6; Thu, 22 Feb 2018 04:15:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A6EA2269D; Thu, 22 Feb 2018 04:15:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M4F3UG024755; Thu, 22 Feb 2018 04:15:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M4F2iP024748; Thu, 22 Feb 2018 04:15:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220415.w1M4F2iP024748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 04:15:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329809 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:15:04 -0000 Author: kevans Date: Thu Feb 22 04:15:02 2018 New Revision: 329809 URL: https://svnweb.freebsd.org/changeset/base/329809 Log: lualoader: Address some 'luacheck' concerns luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assignments. Using '_' as a placeholder for values unused (whether it be parameters unused or return values unused, assuming multiple return values) feels clean and gets the point across, so I've adopted it. It also helps flag candidates for cleanup later in some of the lambdas I've created, giving me an easy way to re-evaluate later if we're still not using some of these features. Modified: head/stand/lua/cli.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/loader.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/cli.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -50,7 +50,7 @@ local parse_boot_args = function(argv, with_kernel) local kernel_name local argstr = "" - for k, v in ipairs(argv) do + for _, v in ipairs(argv) do if with_kernel and v:sub(1,1) ~= "-" then kernel_name = v else @@ -92,7 +92,7 @@ end -- Module exports function cli.boot(...) - local cmd_name, argv = cli.arguments(...) + local _, argv = cli.arguments(...) local kernel, argstr = parse_boot_args(argv) if kernel ~= nil then loader.perform("unload") @@ -102,7 +102,7 @@ function cli.boot(...) end function cli.autoboot(...) - local cmd_name, argv = cli.arguments(...) + local _, argv = cli.arguments(...) local argstr = parse_boot_args(argv, false) core.autoboot(argstr) end @@ -110,7 +110,7 @@ end -- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} - local cmd_name = "" + local cmd_name cmd_name, argv = core.popFrontTable(argv) return cmd_name, argv end Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/config.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -37,7 +37,7 @@ local carousel_choices = {} pattern_table = { [1] = { str = "^%s*(#.*)", - process = function(k, v) end + process = function(_, _) end }, -- module_load="value" [2] = { @@ -94,7 +94,7 @@ pattern_table = { -- exec="command" [9] = { str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", - process = function(k, v) + process = function(k, _) if loader.perform(k) ~= 0 then print("Failed to exec '" .. k .. "'") end @@ -283,11 +283,8 @@ function config.parse(name, silent) return silent end - local text - local r + local text, _ = io.read(f) - text, r = io.read(f) - if text == nil then if not silent then print("Failed to read config: '" .. name .. "'") @@ -302,7 +299,7 @@ function config.parse(name, silent) if line:match("^%s*$") == nil then local found = false - for i, val in ipairs(pattern_table) do + for _, val in ipairs(pattern_table) do local k, v, c = line:match(val.str) if k ~= nil then found = true @@ -339,7 +336,7 @@ function config.loadkernel(other_kernel) local try_load = function (names) for name in names:gmatch("([^;]+)%s*;?") do - r = loader.perform("load " .. flags .. " " .. name) + local r = loader.perform("load " .. flags .. " " .. name) if r == 0 then return name end @@ -376,7 +373,7 @@ function config.loadkernel(other_kernel) -- Use our cached module_path, so we don't end up with multiple -- automatically added kernel paths to our final module_path local module_path = config.module_path - local res = nil + local res if other_kernel ~= nil then kernel = other_kernel @@ -385,7 +382,7 @@ function config.loadkernel(other_kernel) -- then try load with module_path=${kernel} local paths = {"/boot/" .. kernel, kernel} - for k,v in pairs(paths) do + for _, v in pairs(paths) do loader.setenv("module_path", v) res = load_bootfile() @@ -452,7 +449,7 @@ end function config.loadelf() local kernel = config.kernel_selected or config.kernel_loaded - local loaded = false + local loaded print("Loading kernel...") loaded = config.loadkernel(kernel) Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/core.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -200,7 +200,6 @@ function core.bootenvList() local bootenv_count = tonumber(loader.getenv("bootenvs_count")) local bootenvs = {} local curenv - local curenv_idx = 0 local envcount = 0 local unique = {} Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/drawer.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -38,6 +38,7 @@ local fbsd_logo local beastie_color local beastie local fbsd_logo_v +local orb_color local orb local none local none_shifted = false @@ -178,7 +179,7 @@ drawer.menu_name_handlers = { -- This is designed so that everything, including menu separators, may -- have their names derived differently. The default action for entry -- types not specified here is to use entry.name directly. - [core.MENU_SEPARATOR] = function(drawing_menu, entry) + [core.MENU_SEPARATOR] = function(_, entry) if entry.name ~= nil then if type(entry.name) == "function" then return entry.name() @@ -187,7 +188,7 @@ drawer.menu_name_handlers = { end return "" end, - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + [core.MENU_CAROUSEL_ENTRY] = function(_, entry) local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) local choices = entry.items @@ -263,8 +264,8 @@ function drawer.drawscreen(menu_opts) end function drawer.drawmenu(m) - x = drawer.menu_position.x - y = drawer.menu_position.y + local x = drawer.menu_position.x + local y = drawer.menu_position.y -- print the menu and build the alias table local alias_table = {} @@ -288,7 +289,7 @@ function drawer.drawmenu(m) -- fill the alias table alias_table[tostring(entry_num)] = e if e.alias ~= nil then - for n, a in ipairs(e.alias) do + for _, a in ipairs(e.alias) do alias_table[a] = e end end @@ -303,10 +304,10 @@ end function drawer.drawbox() - x = drawer.box_pos_dim.x - y = drawer.box_pos_dim.y - w = drawer.box_pos_dim.w - h = drawer.box_pos_dim.h + local x = drawer.box_pos_dim.x + local y = drawer.box_pos_dim.y + local w = drawer.box_pos_dim.w + local h = drawer.box_pos_dim.h local hl = string.char(0xCD) local vl = string.char(0xBA) Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/loader.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -27,16 +27,15 @@ -- $FreeBSD$ -- -local cli = require("cli") +require("cli") local config = require("config") local menu = require("menu") local password = require("password") -local local_module -local result, errstr, errnoval = lfs.attributes("/boot/lua/local.lua") +local result, _, _ = lfs.attributes("/boot/lua/local.lua") -- Effectively discard any errors; we'll just act if it succeeds. if result ~= nil then - local_module = require("local") + require("local") end config.load() Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/menu.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -59,11 +59,11 @@ menu.handlers = { -- continue or not. The return value may be omitted if this entry should -- have no bearing on whether we continue or not, indicating that we -- should just continue after execution. - [core.MENU_ENTRY] = function(current_menu, entry) + [core.MENU_ENTRY] = function(_, entry) -- run function entry.func() end, - [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry) + [core.MENU_CAROUSEL_ENTRY] = function(_, entry) -- carousel (rotating) functionality local carid = entry.carousel_id local caridx = config.getCarouselIndex(carid) @@ -77,11 +77,11 @@ menu.handlers = { entry.func(caridx, choices[caridx], choices) end end, - [core.MENU_SUBMENU] = function(current_menu, entry) + [core.MENU_SUBMENU] = function(_, entry) -- recurse return menu.run(entry.submenu) end, - [core.MENU_RETURN] = function(current_menu, entry) + [core.MENU_RETURN] = function(_, entry) -- allow entry to have a function/side effect if entry.func ~= nil then entry.func() @@ -122,7 +122,7 @@ menu.boot_environments = { bootenv_name .. " (" .. idx .. " of " .. #all_choices .. ")" end, - func = function(idx, choice, all_choices) + func = function(_, choice, _) bootenvSet(choice) end, alias = {"a", "A"}, @@ -312,7 +312,7 @@ menu.welcome = { kernel_name .. " (" .. idx .. " of " .. #all_choices .. ")" end, - func = function(idx, choice, all_choices) + func = function(_, choice, _) config.selectkernel(choice) end, alias = {"k", "K"} @@ -361,7 +361,7 @@ function menu.run(m) if m == menu.default then autoboot_key = menu.autoboot() end - cont = true + local cont = true while cont do local key = autoboot_key or io.getchar() autoboot_key = nil Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Thu Feb 22 04:01:55 2018 (r329808) +++ head/stand/lua/password.lua Thu Feb 22 04:15:02 2018 (r329809) @@ -38,7 +38,7 @@ function password.read() local n = 0 while true do - ch = io.getchar() + local ch = io.getchar() if ch == core.KEY_ENTER then break end From owner-svn-src-all@freebsd.org Thu Feb 22 04:30:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E7A7F275A7; Thu, 22 Feb 2018 04:30:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B180569990; Thu, 22 Feb 2018 04:30:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC9422289A; Thu, 22 Feb 2018 04:30:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M4UqPA029866; Thu, 22 Feb 2018 04:30:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M4UqL9029865; Thu, 22 Feb 2018 04:30:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220430.w1M4UqL9029865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 04:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329811 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:30:53 -0000 Author: kevans Date: Thu Feb 22 04:30:52 2018 New Revision: 329811 URL: https://svnweb.freebsd.org/changeset/base/329811 Log: lualoader: Clear up an empty conditional branch We will likely uncomment this whole monster in the near future. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Thu Feb 22 04:28:52 2018 (r329810) +++ head/stand/lua/config.lua Thu Feb 22 04:30:52 2018 (r329811) @@ -260,10 +260,10 @@ function config.loadmod(mod, silent) end end - else - -- if not silent then - -- print("Skipping module '". . k .. "'") - -- end +-- else +-- if not silent then +-- print("Skipping module '". . k .. "'") +-- end end end From owner-svn-src-all@freebsd.org Thu Feb 22 04:40:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E04F27EA1 for ; Thu, 22 Feb 2018 04:40:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B69526A241 for ; Thu, 22 Feb 2018 04:40:20 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x230.google.com with SMTP id t79so5539515lfe.3 for ; Wed, 21 Feb 2018 20:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:cc; bh=e0Bhg4xCffDaSLacnhKqezaPtLkvwsnXJFBYYTusPqU=; b=OR8bNWE7zGrUPfvHA4Bdz/8DxzelXhKYFiEr7n3QN65BYQUmZW/EhO78c2OzGHiWzu iWKMTwCy5RIkGqqGc5wA5KAyoJzNR4M/aP3D6umCia3RWu5kBYCdwfyPpokB3Js4n5w/ pCHWCstL5Kaeztmx90mEcqQEPl3+rYmKO25AzpWi8AQFTxGz+BnbSAcGmdc+nCQwdzTU cv1yvYiLyFK2zLNFTRbFEKe8VqQKIq24oPjPtkoZCFVh0gf9qjwjY8Rb8RKy3487C7y9 hcgJmFWP0SXrAd/wuUqmsjVo76sxZoOvn4TFWDf3U69XG+TFCLQjzW1Xi5Wg+PaHKD4c t/sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:cc; bh=e0Bhg4xCffDaSLacnhKqezaPtLkvwsnXJFBYYTusPqU=; b=X3E3EXP0lmHvQrWvtgo40bIm6Im6TPe7sMbTXKlZvaDkCgNZSXeh9jtlkReC/V7R61 FcCJ6StGmibZ/ELpLSETiLfiT7i2RCHpx2tefgWAxZ66X+/QyfXEi7srmRRkiv0Lx+9C O4BgA4nl6SajTftORoZJVIm3B3B9ggcBKrt6EvE/UIs2wnKJB6LBRYU1++kLRv+A6IXy za2WEFnD0pdib+CXvh9vmIC2npvbQ9gkyh/I713H0ujZh2ukt3HqKCpUXTKglPG1eHdS oGdo6BBtAVGHFZ+QMqQEHNerkEwU4h5ojAXsupXNpl67zqJ3YY70JJO1O8Q4sG0jcXxV Y52Q== X-Gm-Message-State: APf1xPDCbn17x8zBd0fUFEct6CAYre9t+ytrhE1TBhuHuIyMDgzQZeo/ IXkkkz+UJdzWEr0DDKHxaAOjI4ldKFbNih1/IWI= X-Received: by 10.25.16.197 with SMTP id 66mt4436601lfq.86.1519274419224; Wed, 21 Feb 2018 20:40:19 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Wed, 21 Feb 2018 20:40:18 -0800 (PST) In-Reply-To: <201802211551.w1LFpn57042314@repo.freebsd.org> References: <201802211551.w1LFpn57042314@repo.freebsd.org> From: Alan Somers Date: Wed, 21 Feb 2018 21:40:18 -0700 X-Google-Sender-Auth: BPLN8LquhZipPgO3ThJ-KClRsQ0 Message-ID: Subject: Re: svn commit: r329722 - head/cddl/usr.sbin/zdb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:40:21 -0000 On Wed, Feb 21, 2018 at 8:51 AM, Alan Somers wrote: > Author: asomers > Date: Wed Feb 21 15:51:48 2018 > New Revision: 329722 > URL: https://svnweb.freebsd.org/changeset/base/329722 > > Log: > zdb: raise WARNS from 0 to 2 > > This has only been possible since r329694 and r329508 > > MFC after: 3 weeks > X-MFC-With: 329694 > X-MFC-With: 329508 > Sponsored by: Spectra Logic > > Modified: > head/cddl/usr.sbin/zdb/Makefile > > Looks like I broke the build with GCC-6. I'll fix it, as soon as I can get the toolchain setup. -Alan From owner-svn-src-all@freebsd.org Thu Feb 22 04:28:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C8EBF27311; Thu, 22 Feb 2018 04:28:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3DEF69813; Thu, 22 Feb 2018 04:28:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEE1F2287C; Thu, 22 Feb 2018 04:28:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M4SqVD029730; Thu, 22 Feb 2018 04:28:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M4SqE4029729; Thu, 22 Feb 2018 04:28:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802220428.w1M4SqE4029729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 04:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329810 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 329810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 04:28:53 -0000 Author: kevans Date: Thu Feb 22 04:28:52 2018 New Revision: 329810 URL: https://svnweb.freebsd.org/changeset/base/329810 Log: Add script for linting stand/lua to tools/boot. We require some --globals due to custom loader extensions in our environment. Add everything required for this to tools/boot so that other interested parties can get up and go with linting our scripts and not get a bunch of false-positives. Added: head/tools/boot/lua-lint.sh (contents, props changed) Added: head/tools/boot/lua-lint.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/boot/lua-lint.sh Thu Feb 22 04:28:52 2018 (r329810) @@ -0,0 +1,19 @@ +#!/bin/sh +# $FreeBSD$ + +# Run linter on the lua scripts in stand/lua. luacheck, not currently available +# in ports, must be installed as a dependency. + +die() { + echo $* + exit 1 +} + +LUACHECK=$(which luacheck) + +[ ! -z "${LUACHECK}" ] && [ -e "${LUACHECK}" ] || \ + die "You must have luacheck installed and in your PATH" + +cd $(make -V SRCTOP)/stand +${LUACHECK} . --globals loader --globals lfs --globals io.getchar \ + --globals io.ischar --std lua53 From owner-svn-src-all@freebsd.org Thu Feb 22 05:43:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38B27F03C48; Thu, 22 Feb 2018 05:43:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE6F56D0FB; Thu, 22 Feb 2018 05:43:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3AD823681; Thu, 22 Feb 2018 05:43:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M5hoBH068908; Thu, 22 Feb 2018 05:43:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M5hobv068907; Thu, 22 Feb 2018 05:43:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802220543.w1M5hobv068907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 05:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329814 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 05:43:54 -0000 Author: imp Date: Thu Feb 22 05:43:50 2018 New Revision: 329814 URL: https://svnweb.freebsd.org/changeset/base/329814 Log: Note when we tick. To help implement a policy of 'queue all trims until next I/O sched tick' policy to help coalesce them, note when we tick so we can do something special on the first call after the tick to get more work. Sponsored by: Netflix Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 (r329813) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 2018 (r329814) @@ -60,6 +60,19 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); /* + * Trim or similar currently pending completion. Should only be set for + * those drivers wishing only one Trim active at a time. + */ +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) + /* Callout active, and needs to be torn down */ +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) + /* Timer has just ticked */ +#define CAM_IOSCHED_FLAG_TICK (1ul << 2) + + /* Periph drivers set these flags to indicate work */ +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) + +/* * Default I/O scheduler for FreeBSD. This implementation is just a thin-vineer * over the bioq_* interface, with notions of separate calls for normal I/O and * for trims. @@ -574,6 +587,7 @@ cam_iosched_ticker(void *arg) cam_iosched_limiter_tick(&isc->write_stats); cam_iosched_limiter_tick(&isc->trim_stats); + isc->flags |= CAM_IOSCHED_FLAGS_TICK; cam_iosched_schedule(isc, isc->periph); /* @@ -701,17 +715,6 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) } #endif -/* - * Trim or similar currently pending completion. Should only be set for - * those drivers wishing only one Trim active at a time. - */ -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) - /* Callout active, and needs to be torn down */ -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) - - /* Periph drivers set these flags to indicate work */ -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) - #ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_io_metric_update(struct cam_iosched_softc *isc, @@ -1322,6 +1325,10 @@ struct bio * cam_iosched_next_bio(struct cam_iosched_softc *isc) { struct bio *bp; + bool wastick; + + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; /* * See if we have a trim that can be scheduled. We can only send one From owner-svn-src-all@freebsd.org Thu Feb 22 05:43:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A64C5F03C51; Thu, 22 Feb 2018 05:43:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53CE46D105; Thu, 22 Feb 2018 05:43:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DF6B23683; Thu, 22 Feb 2018 05:43:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M5huT4068964; Thu, 22 Feb 2018 05:43:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M5ht9k068959; Thu, 22 Feb 2018 05:43:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802220543.w1M5ht9k068959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 05:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329815 - in head/sys/cam: . ata nvme scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/cam: . ata nvme scsi X-SVN-Commit-Revision: 329815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 05:43:56 -0000 Author: imp Date: Thu Feb 22 05:43:55 2018 New Revision: 329815 URL: https://svnweb.freebsd.org/changeset/base/329815 Log: Introduce capacity flags for periphs Introduce flags word to describe the capacities of the peripheral. First bit will describe if the periph driver allows multiple outstanding TRIMS to be active in a device. Modify the I/O scheduler so that the nda driver can queue trims for a while after the first one arrives. We'll queue until we see a I/O scheduler tick, then we'll schedule as many TRIMs as allowed by other factors (currently this is slocts in the NVMe controller). This mariginally helps the read latency issues we see with reads, but sets the stage for the nda driver to do TRIM collapsing like the da and ada drivers do today. Sponsored by: Netflix Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_iosched.c head/sys/cam/cam_iosched.h head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Feb 22 05:43:50 2018 (r329814) +++ head/sys/cam/ata/ata_da.c Thu Feb 22 05:43:55 2018 (r329815) @@ -1705,7 +1705,7 @@ adaregister(struct cam_periph *periph, void *arg) announce_buf = softc->announce_temp; bzero(announce_buf, ADA_ANNOUNCETMP_SZ); - if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, 0) != 0) { printf("adaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 2018 (r329814) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:55 2018 (r329815) @@ -68,6 +68,8 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", #define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) /* Timer has just ticked */ #define CAM_IOSCHED_FLAG_TICK (1ul << 2) + /* When set, defer trims until after next tick */ +#define CAM_IOSCHED_FLAG_TRIM_QONLY (1ul << 4) /* Periph drivers set these flags to indicate work */ #define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) @@ -290,6 +292,7 @@ struct cam_iosched_softc { struct bio_queue_head trim_queue; /* scheduler flags < 16, user flags >= 16 */ uint32_t flags; + u_int caps; int sort_io_queue; #ifdef CAM_IOSCHED_DYNAMIC int read_bias; /* Read bias setting */ @@ -1064,12 +1067,16 @@ cam_iosched_cl_sysctl_fini(struct control_loop *clp) * sizeof struct cam_iosched_softc. */ int -cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph) +cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph, + u_int caps) { *iscp = malloc(sizeof(**iscp), M_CAMSCHED, M_NOWAIT | M_ZERO); if (*iscp == NULL) return ENOMEM; + (*iscp)->caps = caps; + if (caps & CAM_IOSCHED_CAP_TRIM_CLOCKED) + (*iscp)->flags |= CAM_IOSCHED_FLAG_TRIM_QONLY; #ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug) printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); @@ -1196,7 +1203,7 @@ cam_iosched_flush(struct cam_iosched_softc *isc, struc #ifdef CAM_IOSCHED_DYNAMIC static struct bio * -cam_iosched_get_write(struct cam_iosched_softc *isc) +cam_iosched_get_write(struct cam_iosched_softc *isc, bool wastick) { struct bio *bp; @@ -1305,13 +1312,45 @@ cam_iosched_next_trim(struct cam_iosched_softc *isc) * * Assumes we're called with the periph lock held. */ -struct bio * -cam_iosched_get_trim(struct cam_iosched_softc *isc) +static struct bio * +cam_iosched_get_trim(struct cam_iosched_softc *isc, bool wastick) { - if (!cam_iosched_has_more_trim(isc)) + /* + * If there's no trims, return NULL. If we're clocking out the + * trims rather than doing thins right away, this is where we + * set the queue only bit. This causes us to ignore them until + * the next clock tick. If we can't get a trim, and we're clocking + * them out, if the queue is empty or if we're rate limited, + * then set QONLY so we stop processing trims until the next + * tick. + */ + if (!cam_iosched_has_more_trim(isc)) { + if ((isc->caps & CAM_IOSCHED_CAP_TRIM_CLOCKED) && + (bioq_first(&isc->trim_queue) == NULL || +#ifdef CAM_IOSCHED_DYNAMIC + (isc->trim_stats.state_flags & IOP_RATE_LIMITED) +#else + false +#endif + )) + isc->flags |= CAM_IOSCHED_FLAG_TRIM_QONLY; return NULL; + } + /* + * If we just ticked, and we have trims, then turn off + * the queue only flag. + */ + if (wastick) + isc->flags &= ~CAM_IOSCHED_FLAG_TRIM_QONLY; + + /* + * If QONLY is set, no trims are eligble just now. + */ + if (isc->flags & CAM_IOSCHED_FLAG_TRIM_QONLY) + return NULL; + return cam_iosched_next_trim(isc); } @@ -1327,17 +1366,17 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) struct bio *bp; bool wastick; - wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); - isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; + wastick = !!(isc->flags & CAM_IOSCHED_FLAG_TICK); + isc->flags &= ~CAM_IOSCHED_FLAG_TICK; /* * See if we have a trim that can be scheduled. We can only send one - * at a time down, so this takes that into account. - * - * XXX newer TRIM commands are queueable. Revisit this when we - * implement them. + * at a time down, so this takes that into account for those devices + * that can only do one. In addition, some devices queue up a bunch + * of TRIMs before sending them down as a batch. */ - if ((bp = cam_iosched_get_trim(isc)) != NULL) + if ((isc->flags & CAM_IOSCHED_FLAG_TRIM_QONLY) == 0 && + (bp = cam_iosched_get_trim(isc, wastick)) != NULL) return bp; #ifdef CAM_IOSCHED_DYNAMIC @@ -1346,7 +1385,7 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) * and if so, those are next. */ if (do_dynamic_iosched) { - if ((bp = cam_iosched_get_write(isc)) != NULL) + if ((bp = cam_iosched_get_write(isc, was_tick)) != NULL) return bp; } #endif Modified: head/sys/cam/cam_iosched.h ============================================================================== --- head/sys/cam/cam_iosched.h Thu Feb 22 05:43:50 2018 (r329814) +++ head/sys/cam/cam_iosched.h Thu Feb 22 05:43:55 2018 (r329815) @@ -81,11 +81,12 @@ cam_iosched_sbintime_t(uintptr_t delta) return (sbintime_t)((uint64_t)delta << CAM_IOSCHED_TIME_SHIFT); } -int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); +#define CAM_IOSCHED_CAP_TRIM_CLOCKED 0x1 + +int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph, u_int caps); void cam_iosched_fini(struct cam_iosched_softc *); void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); struct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); -struct bio *cam_iosched_get_trim(struct cam_iosched_softc *isc); struct bio *cam_iosched_next_bio(struct cam_iosched_softc *isc); void cam_iosched_queue_work(struct cam_iosched_softc *isc, struct bio *bp); void cam_iosched_flush(struct cam_iosched_softc *isc, struct devstat *stp, int err); Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Feb 22 05:43:50 2018 (r329814) +++ head/sys/cam/nvme/nvme_da.c Thu Feb 22 05:43:55 2018 (r329815) @@ -691,7 +691,8 @@ ndaregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, + CAM_IOSCHED_CAP_TRIM_CLOCKED) != 0) { printf("ndaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Feb 22 05:43:50 2018 (r329814) +++ head/sys/cam/scsi/scsi_da.c Thu Feb 22 05:43:55 2018 (r329815) @@ -2572,7 +2572,7 @@ daregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, 0) != 0) { printf("daregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); From owner-svn-src-all@freebsd.org Thu Feb 22 05:44:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 405F9F03C65; Thu, 22 Feb 2018 05:44:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806666D1DF; Thu, 22 Feb 2018 05:44:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44E1423685; Thu, 22 Feb 2018 05:44:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M5i1WR069044; Thu, 22 Feb 2018 05:44:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M5i1JB069042; Thu, 22 Feb 2018 05:44:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802220544.w1M5i1JB069042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 05:44:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329816 - in head/sys: cam/nvme dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/nvme dev/nvme X-SVN-Commit-Revision: 329816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 05:44:03 -0000 Author: imp Date: Thu Feb 22 05:44:00 2018 New Revision: 329816 URL: https://svnweb.freebsd.org/changeset/base/329816 Log: Combine BIO_DELETE requests for nda devices Now that we're queueing BIO_DELETE requests in the CAM I/O scheduler, it make sense to try to combine as many as possible into a single request to send down to hardware. Hopefully, lots of larger requests like this are better than lots of individual transactions. Note for future: need to limit based on total size of the trim request. Should also collapse adjacent ranges where possible to increase the size of the max payload. Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c head/sys/dev/nvme/nvme.h Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Feb 22 05:43:55 2018 (r329815) +++ head/sys/cam/nvme/nvme_da.c Thu Feb 22 05:44:00 2018 (r329816) @@ -122,6 +122,14 @@ struct nda_softc { #endif }; +struct nda_trim_request { + union { + struct nvme_dsm_range dsm; + uint8_t data[NVME_MAX_DSM_TRIM]; + } u; + TAILQ_HEAD(, bio) bps; +}; + /* Need quirk table */ static disk_strategy_t ndastrategy; @@ -150,11 +158,14 @@ static void ndasuspend(void *arg); #ifndef NDA_DEFAULT_RETRY #define NDA_DEFAULT_RETRY 4 #endif +#ifndef NDA_MAX_TRIM_ENTRIES +#define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ +#endif - //static int nda_retry_count = NDA_DEFAULT_RETRY; static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; +static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; /* * All NVMe media is non-rotational, so all nvme device instances @@ -895,22 +906,40 @@ ndastart(struct cam_periph *periph, union ccb *start_c } case BIO_DELETE: { - struct nvme_dsm_range *dsm_range; + struct nvme_dsm_range *dsm_range, *dsm_end; + struct nda_trim_request *trim; + struct bio *bp1; + int ents; - dsm_range = - malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_NOWAIT); - if (dsm_range == NULL) { + trim = malloc(sizeof(*trim), M_NVMEDA, M_ZERO | M_NOWAIT); + if (trim == NULL) { biofinish(bp, NULL, ENOMEM); xpt_release_ccb(start_ccb); ndaschedule(periph); return; } - dsm_range->length = - bp->bio_bcount / softc->disk->d_sectorsize; - dsm_range->starting_lba = - bp->bio_offset / softc->disk->d_sectorsize; - bp->bio_driver2 = dsm_range; - nda_nvme_trim(softc, &start_ccb->nvmeio, dsm_range, 1); + TAILQ_INIT(&trim->bps); + bp1 = bp; + ents = sizeof(trim->u.data) / sizeof(struct nvme_dsm_range); + ents = min(ents, nda_max_trim_entries); + dsm_range = &trim->u.dsm; + dsm_end = dsm_range + ents; + do { + TAILQ_INSERT_TAIL(&trim->bps, bp1, bio_queue); + dsm_range->length = + bp1->bio_bcount / softc->disk->d_sectorsize; + dsm_range->starting_lba = + bp1->bio_offset / softc->disk->d_sectorsize; + dsm_range++; + if (dsm_range >= dsm_end) + break; + bp1 = cam_iosched_next_trim(softc->cam_iosched); + /* XXX -- Could collapse adjacent ranges, but we don't for now */ + /* XXX -- Could limit based on total payload size */ + } while (bp1 != NULL); + bp->bio_driver2 = trim; + nda_nvme_trim(softc, &start_ccb->nvmeio, &trim->u.dsm, + dsm_range - &trim->u.dsm); start_ccb->ccb_h.ccb_state = NDA_CCB_TRIM; start_ccb->ccb_h.flags |= CAM_UNLOCKED; /* @@ -991,8 +1020,6 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb } else { bp->bio_resid = 0; } - if (state == NDA_CCB_TRIM) - free(bp->bio_driver2, M_NVMEDA); softc->outstanding_cmds--; /* @@ -1004,13 +1031,15 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb cam_iosched_bio_complete(softc->cam_iosched, bp, done_ccb); xpt_release_ccb(done_ccb); if (state == NDA_CCB_TRIM) { -#ifdef notyet - TAILQ_HEAD(, bio) queue; + struct nda_trim_request *trim; struct bio *bp1; + TAILQ_HEAD(, bio) queue; + trim = bp->bio_driver2; TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue); -#endif + TAILQ_CONCAT(&queue, &trim->bps, bio_queue); + free(trim, M_NVMEDA); + /* * Since we can have multiple trims in flight, we don't * need to call this here. @@ -1018,8 +1047,6 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb */ ndaschedule(periph); cam_periph_unlock(periph); -#ifdef notyet -/* Not yet collapsing several BIO_DELETE requests into one TRIM */ while ((bp1 = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, bp1, bio_queue); bp1->bio_error = error; @@ -1030,9 +1057,6 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb bp1->bio_resid = 0; biodone(bp1); } -#else - biodone(bp); -#endif } else { ndaschedule(periph); cam_periph_unlock(periph); Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Thu Feb 22 05:43:55 2018 (r329815) +++ head/sys/dev/nvme/nvme.h Thu Feb 22 05:44:00 2018 (r329816) @@ -59,6 +59,9 @@ /* Cap nvme to 1MB transfers driver explodes with larger sizes */ #define NVME_MAX_XFER_SIZE (MAXPHYS < (1<<20) ? MAXPHYS : (1<<20)) +/* Largest DSM Trim that can be done */ +#define NVME_MAX_DSM_TRIM 4096 + union cap_lo_register { uint32_t raw; struct { From owner-svn-src-all@freebsd.org Thu Feb 22 06:07:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEE22F055CF; Thu, 22 Feb 2018 06:07:21 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 508106E080; Thu, 22 Feb 2018 06:07:21 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from freyja.zeit4.iv.bundesimmobilien.de ([87.138.105.249]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Ld1CS-1eOW2R1EpM-00iC0R; Thu, 22 Feb 2018 07:07:19 +0100 Date: Thu, 22 Feb 2018 07:07:13 +0100 From: "O. Hartmann" To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329814 - head/sys/cam Message-ID: <20180222070713.1ba6f278@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <201802220543.w1M5hobv068907@repo.freebsd.org> References: <201802220543.w1M5hobv068907@repo.freebsd.org> Organization: Walstatt MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1Wg+Kgf9fb4WnwYwRmj6qr9ueyo+okrOvQdmytBS/EIJrsUyPCe 8CkAnTNpUe/aNpSR3xKsvdAty8ppcon7z6lc6kQdfs/G7/H4j9m261R6xFfbNF5ybTcpJdS 9vuraIiR9la8OAAY2RXwqlFbRmxJ9QIvSp/jartG3RJ7BTCXAYUd6RMhPNRgII3bk2LsT21 PNuSSeuN2yS0uYvrNjLsw== X-UI-Out-Filterresults: notjunk:1;V01:K0:33vRepN7faI=:KYsN/+YSuPiDfIrjh/3xzf RnTCPTLnbJZEq2raUha2v2gBaRR/wmI0j+qUodVYe4MTzwYlXhG1+C6VIXvTrdwbsEt65x4BU iUPWTec4vG+ThnhFUEI+7+wzRkf90/cnkBeIMUMKgBN+LY84HkJEoxuT2D34oAk7WJYBZ2YU9 tx6h3IvrhazrtX9SIU23iXHcZ/qBFXKjraoa+gMNKEsFlR92ogWwJLF/0MaZbiQbb4uiezyxJ ZRmlM/KeVTUwO/p0sZ0dudpvx+i8+aZo6V17kc+ZQ/mi8ehUg2AxwmIijBZT5olfkKA4/t+KI awjvO6HZ+TZDcsM7yHpscnPhGUYHJbRTBWZm/e7o1+MwBSJbMSBjNbm+YEX1UeIWR0xjf1Jln IlMWVoApzavyREFMLU0fyWVEyxMcWDDyRdW8/RrDlntXFdwv8nusp34Hv+weRfhTQehSxMF6N jR6p3xsie1qOszA5WBKGXgrkBXtmrTgxQ4VTcbsr3WBn65BYq2ZR+n6Ue2XSBBjRizOnr8Zhm aBeuEyV3voxv5/XiijKV/xU4P4NZYaMwX82T8hQfyMcJqUDaFYVhBvAC1MNPmNya4mRPdUzvR GOBB17eu1V+QjZqnq0GD4zRiEbfTrv0Hm4Rmhzrri2mUzEInhdpH84RDh4ZFjCn/TK9c0e3Ec 1/PiTVkzVrHQxyhV2QFY8V4d57gWAdvPLjGURn+s/o9zKTQA+brZ2dkg6Il34aGZL9e//1/7e NnB8SevxOQaLkUAJhUQVZBs6uwOoRyBWjSPl5iT9qX8VtvP2FYKEq/ZmaKE2vv3on6mhHmbz+ vTyidTirsRk10PUiwwCs3swhrNRXAaVjKV7IfQT9/QUj2j2Itw= X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 06:07:22 -0000 On Thu, 22 Feb 2018 05:43:50 +0000 (UTC) Warner Losh wrote: > Author: imp > Date: Thu Feb 22 05:43:50 2018 > New Revision: 329814 > URL: https://svnweb.freebsd.org/changeset/base/329814 > > Log: > Note when we tick. > > To help implement a policy of 'queue all trims until next I/O sched > tick' policy to help coalesce them, note when we tick so we can do > something special on the first call after the tick to get more work. > > Sponsored by: Netflix > > Modified: > head/sys/cam/cam_iosched.c > > Modified: head/sys/cam/cam_iosched.c > ============================================================================== > --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 > (r329813) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 > 2018 (r329814) @@ -60,6 +60,19 @@ static MALLOC_DEFINE(M_CAMSCHED, > "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); > > /* > + * Trim or similar currently pending completion. Should only be set for > + * those drivers wishing only one Trim active at a time. > + */ > +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > + /* Callout active, and needs to be torn down */ > +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > + /* Timer has just ticked */ > +#define CAM_IOSCHED_FLAG_TICK (1ul << 2) > + > + /* Periph drivers set these flags to indicate work */ > +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > + > +/* > * Default I/O scheduler for FreeBSD. This implementation is just a > thin-vineer > * over the bioq_* interface, with notions of separate calls for normal I/O > and > * for trims. > @@ -574,6 +587,7 @@ cam_iosched_ticker(void *arg) > cam_iosched_limiter_tick(&isc->write_stats); > cam_iosched_limiter_tick(&isc->trim_stats); > > + isc->flags |= CAM_IOSCHED_FLAGS_TICK; > cam_iosched_schedule(isc, isc->periph); > > /* > @@ -701,17 +715,6 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) > } > #endif > > -/* > - * Trim or similar currently pending completion. Should only be set for > - * those drivers wishing only one Trim active at a time. > - */ > -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > - /* Callout active, and needs to be torn down */ > -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > - > - /* Periph drivers set these flags to indicate work */ > -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > - > #ifdef CAM_IOSCHED_DYNAMIC > static void > cam_iosched_io_metric_update(struct cam_iosched_softc *isc, > @@ -1322,6 +1325,10 @@ struct bio * > cam_iosched_next_bio(struct cam_iosched_softc *isc) > { > struct bio *bp; > + bool wastick; > + > + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); > + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; > > /* > * See if we have a trim that can be scheduled. We can only send one > _______________________________________________ > 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-unsubscribe@freebsd.org" A recent buildworld/buildkernel failed with this error just right now: --- cam_iosched.o --- /usr/src/sys/cam/cam_iosched.c:593:16: error: use of undeclared identifier 'CAM_IOSCHED_FLAGS_TICK' isc->flags |= CAM_IOSCHED_FLAGS_TICK; From owner-svn-src-all@freebsd.org Thu Feb 22 06:57:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3333F08EA7; Thu, 22 Feb 2018 06:57:09 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp002.me.com (st13p35im-asmtp002.me.com [17.164.199.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EEBD702C7; Thu, 22 Feb 2018 06:57:09 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp002.me.com by st13p35im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P4J00D00EYFNE00@st13p35im-asmtp002.me.com>; Thu, 22 Feb 2018 05:56:20 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1519278980; bh=SFohAlVngPoNg11ANPeb5yykEhOc1jAensrflQ3beWY=; h=From:Message-id:Content-type:MIME-version:Subject:Date:To; b=F7O3M1jUG+lPmkG7l+8sUkT0cJHjcQkS5EZ5b/bKGvWR3wXFq5JrGRlZkQ+jgS+FJ qyl9fjo9TOCeDTsFOKtPnWO9mMg0DesuV3DIG9OmF6cMCtqgu0CISINgNverXYxzGY n/KjSeF6JEABgqdT3tcd6iAlX7ndzwQHHdbd5bYQAnXhP/6dbEBE4+tgVBkO2RlQXK pdqq+SJRP3fvAPeJEjx2yh52kip6RxwVTHfbjP9eCUJdWfMSnXUYp42HjsYLvop7XA JXkwTY4uDnZDNObGdS5Z+Vp4wWMWJ0H0Ar3N4p/fI6G835B9H8JyfiW5lh6jlV5ZfU lv+lPdPLj/FYQ== Received: from icloud.com ([127.0.0.1]) by st13p35im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P4J00OSCF5SDY10@st13p35im-asmtp002.me.com>; Thu, 22 Feb 2018 05:56:19 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-22_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1802220076 From: Toomas Soome Message-id: <14ECCB6A-7AEE-4831-AF14-6AAF79CF4102@me.com> MIME-version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329770 - vendor-sys/illumos/dist/uts/common/fs/zfs/lua Date: Thu, 22 Feb 2018 07:56:16 +0200 In-reply-to: <56dda9e2-e9ea-83b9-1e54-6569d478615a@FreeBSD.org> Cc: rgrimes@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-vendor@freebsd.org To: Alexander Motin References: <201802220104.w1M14uHQ088614@pdx.rh.CN85.dnsmgr.net> <56dda9e2-e9ea-83b9-1e54-6569d478615a@FreeBSD.org> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 06:57:10 -0000 > On 22 Feb 2018, at 05:03, Alexander Motin wrote: >=20 > On 21.02.2018 20:04, Rodney W. Grimes wrote: >> [ Charset UTF-8 unsupported, converting... ] >>> Author: mav >>> Date: Thu Feb 22 00:46:24 2018 >>> New Revision: 329770 >>> URL: https://svnweb.freebsd.org/changeset/base/329770 >>>=20 >>> Log: >>> 9035 zfs: this statement may fall through >>>=20 >>> illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553 >>>=20 >>> Reviewed by: Yuri Pankov >>> Reviewed by: Andy Fiddaman >>> Reviewed by: Matthew Ahrens >>> Approved by: Dan McDonald >>> Author: Toomas Soome >>>=20 >>> Modified: >>> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c >>> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c >>> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lstrlib.c >>> vendor-sys/illumos/dist/uts/common/fs/zfs/lua/ltable.c >>>=20 >>> Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb = 22 00:42:12 2018 (r329769) >>> +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/lgc.c Thu Feb = 22 00:46:24 2018 (r329770) >>> @@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) = { >>> case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); = break; >>> case LUA_TSHRSTR: >>> G(L)->strt.nuse--; >>> - /* go through */ >>> + /* FALLTHROUGH */ >>> case LUA_TLNGSTR: { >>> luaM_freemem(L, o, sizestring(gco2ts(o))); >>> break; >>>=20 >>> Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb = 22 00:42:12 2018 (r329769) >>> +++ vendor-sys/illumos/dist/uts/common/fs/zfs/lua/llex.c Thu Feb = 22 00:46:24 2018 (r329770) >>> @@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) = { >>> else if (!lisdigit(ls->current)) return '.'; >>> /* else go through */ >> ^^^^^^^^^^^^^^^^^^^^^^^ Wasnt this already marked, perhaps = in the >> wrong place with the wrong string? > As I understand GCC 7 parses comments like that to decide whether > generate warnings or not, but this informal text is out of his > understanding. >=20 >=20 Exactly. Also in some cases it is desirable to have more text than just = FALLTHROUGH, And in some cases we may just have missed the original = comment which should be removed:) rgds, toomas From owner-svn-src-all@freebsd.org Thu Feb 22 05:43:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 516E0F03C35; Thu, 22 Feb 2018 05:43:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9EEA6D02A; Thu, 22 Feb 2018 05:43:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E144F23680; Thu, 22 Feb 2018 05:43:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M5hjwn068855; Thu, 22 Feb 2018 05:43:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M5hjeh068854; Thu, 22 Feb 2018 05:43:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802220543.w1M5hjeh068854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 05:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329813 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 05:43:46 -0000 Author: imp Date: Thu Feb 22 05:43:45 2018 New Revision: 329813 URL: https://svnweb.freebsd.org/changeset/base/329813 Log: Wrap an extra long line This debugging line is too big for even my largest xterm. wrap it at about 80 columns. Sponsored by: Netflix Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:20 2018 (r329812) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 (r329813) @@ -1219,7 +1219,11 @@ cam_iosched_get_write(struct cam_iosched_softc *isc) */ if (bioq_first(&isc->bio_queue) && isc->current_read_bias) { if (iosched_debug) - printf("Reads present and current_read_bias is %d queued writes %d queued reads %d\n", isc->current_read_bias, isc->write_stats.queued, isc->read_stats.queued); + printf( + "Reads present and current_read_bias is %d queued " + "writes %d queued reads %d\n", + isc->current_read_bias, isc->write_stats.queued, + isc->read_stats.queued); isc->current_read_bias--; /* We're not limiting writes, per se, just doing reads first */ return NULL; From owner-svn-src-all@freebsd.org Thu Feb 22 05:43:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95648F03BFD; Thu, 22 Feb 2018 05:43:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BF76CF50; Thu, 22 Feb 2018 05:43:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 426002367D; Thu, 22 Feb 2018 05:43:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M5hLKS068795; Thu, 22 Feb 2018 05:43:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M5hL8Q068794; Thu, 22 Feb 2018 05:43:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802220543.w1M5hL8Q068794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 05:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329812 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 05:43:21 -0000 Author: imp Date: Thu Feb 22 05:43:20 2018 New Revision: 329812 URL: https://svnweb.freebsd.org/changeset/base/329812 Log: Don't sort TRIMs. While the code for ada and da both assume that the trim list is ordered when doing the coaleascing the TRIMs, it turns out that creating the sorted list uses more resources than are saved by having slightly fewer trims sent to the device. Sponsored by: Netflix Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 04:30:52 2018 (r329811) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:20 2018 (r329812) @@ -1392,7 +1392,7 @@ cam_iosched_queue_work(struct cam_iosched_softc *isc, * the work on the bio queue. */ if (bp->bio_cmd == BIO_DELETE) { - bioq_disksort(&isc->trim_queue, bp); + bioq_insert_tail(&isc->trim_queue, bp); #ifdef CAM_IOSCHED_DYNAMIC isc->trim_stats.in++; isc->trim_stats.queued++; From owner-svn-src-all@freebsd.org Thu Feb 22 07:16:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 339ADF0A947; Thu, 22 Feb 2018 07:16:15 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D47C71556; Thu, 22 Feb 2018 07:16:14 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f44.google.com with SMTP id q69so5937710lfi.10; Wed, 21 Feb 2018 23:16:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1okof+2PZjJH77r3RlIdwEB4e/dQGkeffkbuTkHWv1c=; b=fwyzx3z8ljpCEGQoCg4/IvEbyYZ7BiTIq9EFvu4DMQprNdbtgV/4PVhN3eZdvTZgvY 8p804sVdbyBJz2dU0FhTqmRDiXa1JqucFI9RmZRaCTFdydp9A0vM/olBOPDFVBjLWdfm 7tAHNUhgzN5M3wZOgIApISH+HcrDKi47WN/SvZ/98rs2pu2WVwag09VUIpd0pbi9qm80 yjJxuDhVK6nOJmZkBKWoIyAOyPf3ykNdN/7GZ7Y+2H5H6OfOBh32s1/Txb/vKFR2yPMN OBYHMqq/TgQ1s8XQLstzLVCTp3n5Q7H56BJEl37M+7lq3ucri2VVt2BXxEO0T1rVczSt tltg== X-Gm-Message-State: APf1xPA+8Ethe+kt85TFAYRdc72gw0tmHga5EaJOdmA11H7lLMXLtSre SPyOAushL4D5leKIEWF1+zP1LKvz X-Google-Smtp-Source: AH8x2269oKQ1MwFwdjhf6/gT+8nP2B6UVCFybjn1fk9et/mxI4MCUqFT6uFvm/Yr55PvnqZoMNtmag== X-Received: by 10.46.41.157 with SMTP id p29mr3933724ljp.137.1519283767324; Wed, 21 Feb 2018 23:16:07 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id c74sm1233978lfe.96.2018.02.21.23.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 23:16:06 -0800 (PST) Subject: Re: svn commit: r329795 - in vendor-sys/illumos/dist/uts/common: fs/zfs fs/zfs/sys sys/fs To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org References: <201802220225.w1M2P9Un068350@repo.freebsd.org> From: Andriy Gapon Message-ID: <68dd6e31-9616-2190-544a-82b400d81370@FreeBSD.org> Date: Thu, 22 Feb 2018 09:16:05 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802220225.w1M2P9Un068350@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 07:16:15 -0000 On 22/02/2018 04:25, Alexander Motin wrote: > Author: mav > Date: Thu Feb 22 02:25:09 2018 > New Revision: 329795 > URL: https://svnweb.freebsd.org/changeset/base/329795 > > Log: > r329793 | mav | 2018-02-22 04:21:03 +0200 (чт, 22 февр. 2018) | 58 lines > > 9075 Improve ZFS pool import/load process and corrupted pool recovery > > illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1 This commit message looks strange. -- Andriy Gapon From owner-svn-src-all@freebsd.org Thu Feb 22 07:18:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDCA3F0AB1C; Thu, 22 Feb 2018 07:18:20 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4237071795; Thu, 22 Feb 2018 07:18:20 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f50.google.com with SMTP id t204so5953610lff.9; Wed, 21 Feb 2018 23:18:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JY9Y1s8IS+fCUUVE7LTFyIKWsueAKn/YRaXaXLsLfhg=; b=g1ZK5nAaMmBHngczyu7gCFTdSWnynzx9d0Ls37195vL4QAHHUkXgQM/ltZallWDmHl cRVfMljq9EtafskBNtwYzqV5JEQFri2wvemzBpe4DS5hx6S8kGotWadug8+vtLTi8SxV eZeNX/2PvfC98XelhFmWdi8oW3bnDgo52pU0gt4ycWv8FYdxYkdkG8/7xzKzEo7WzVcI pMtleL1S29keKxnRxwAKrEZi4vGeW5TP1fSSvOvCDq9tSYR06CV4eSeOP4cyQj1wKh3D T0EyPrlIB1Flrj+8UQvMfjfA29GM/qERDRRUD2w916kSUQR/j7l7mZpRbrT67HxzHZme 0UHg== X-Gm-Message-State: APf1xPA+XnLpgmpMd/FW2J0emf5uY4yNzfKLgBg/RomgOHn7Qu9Q7g6N pWtiBs8ojlToSMuMOuKANWofkc00 X-Google-Smtp-Source: AH8x226CvTEXJFvbW1nISwn3kUV0Fxz/Pt8hal9fT3c8O/pTxO6htTDLm7AwZUCdhP0gsV+y92YStA== X-Received: by 10.25.207.145 with SMTP id f139mr4535737lfg.75.1519283893222; Wed, 21 Feb 2018 23:18:13 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id h71sm2156996ljh.77.2018.02.21.23.18.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 23:18:12 -0800 (PST) Subject: Re: svn commit: r329796 - head/sys/dev/vt To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802220226.w1M2QTR2068451@repo.freebsd.org> From: Andriy Gapon Message-ID: Date: Thu, 22 Feb 2018 09:18:11 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802220226.w1M2QTR2068451@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 07:18:21 -0000 On 22/02/2018 04:26, John Baldwin wrote: > Author: jhb > Date: Thu Feb 22 02:26:29 2018 > New Revision: 329796 > URL: https://svnweb.freebsd.org/changeset/base/329796 > > Log: > Avoid grabbing locks when grabbing the vt(4) console for DDB. > > Trying to grab locks during cngrab() when entering the debugger is > deadlock prone as all other CPUs are already halted (and thus unable > to release locks) when cngrab() is invoked. One could instead use > try-locks. However, the case that the try-lock fails still has to > be handled. In addition, if the try-lock works it doesn't provide > any greater ordering guarantees than is already provided by entering > and exiting DDB. It is simpler to define a simpler path for the > case that the try-lock would fail and always use that when entering > DDB. Messing with timers, etc. when entering DDB is dubious even if > the try-lock succeeds. > > This patch attempts to use the smallest possible set of operations to > grab the vt(4) console when entering DDB without using any locks. > > Reviewed by: emaste > Tested by: Matthew Macy > MFC after: 1 week There are some additional, harder problems in that path: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213334 -- Andriy Gapon From owner-svn-src-all@freebsd.org Thu Feb 22 07:01:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18C5AF095AB; Thu, 22 Feb 2018 07:01:56 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA0F370744; Thu, 22 Feb 2018 07:01:55 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id BC67514E40; Thu, 22 Feb 2018 07:01:49 +0000 (UTC) Subject: Re: svn commit: r329814 - head/sys/cam To: "O. Hartmann" , Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802220543.w1M5hobv068907@repo.freebsd.org> <20180222070713.1ba6f278@freyja.zeit4.iv.bundesimmobilien.de> From: Allan Jude Message-ID: <89a4b962-ca69-4a42-579e-72ae777ef015@freebsd.org> Date: Thu, 22 Feb 2018 02:01:51 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180222070713.1ba6f278@freyja.zeit4.iv.bundesimmobilien.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 07:01:56 -0000 On 2018-02-22 01:07, O. Hartmann wrote: > On Thu, 22 Feb 2018 05:43:50 +0000 (UTC) > Warner Losh wrote: > >> Author: imp >> Date: Thu Feb 22 05:43:50 2018 >> New Revision: 329814 >> URL: https://svnweb.freebsd.org/changeset/base/329814 >> >> Log: >> Note when we tick. >> >> To help implement a policy of 'queue all trims until next I/O sched >> tick' policy to help coalesce them, note when we tick so we can do >> something special on the first call after the tick to get more work. >> >> Sponsored by: Netflix >> >> Modified: >> head/sys/cam/cam_iosched.c >> >> Modified: head/sys/cam/cam_iosched.c >> ============================================================================== >> --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 >> (r329813) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 >> 2018 (r329814) @@ -60,6 +60,19 @@ static MALLOC_DEFINE(M_CAMSCHED, >> "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); >> >> /* >> + * Trim or similar currently pending completion. Should only be set for >> + * those drivers wishing only one Trim active at a time. >> + */ >> +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) >> + /* Callout active, and needs to be torn down */ >> +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) >> + /* Timer has just ticked */ >> +#define CAM_IOSCHED_FLAG_TICK (1ul << 2) >> + >> + /* Periph drivers set these flags to indicate work */ >> +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) >> + >> +/* >> * Default I/O scheduler for FreeBSD. This implementation is just a >> thin-vineer >> * over the bioq_* interface, with notions of separate calls for normal I/O >> and >> * for trims. >> @@ -574,6 +587,7 @@ cam_iosched_ticker(void *arg) >> cam_iosched_limiter_tick(&isc->write_stats); >> cam_iosched_limiter_tick(&isc->trim_stats); >> >> + isc->flags |= CAM_IOSCHED_FLAGS_TICK; >> cam_iosched_schedule(isc, isc->periph); >> >> /* >> @@ -701,17 +715,6 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) >> } >> #endif >> >> -/* >> - * Trim or similar currently pending completion. Should only be set for >> - * those drivers wishing only one Trim active at a time. >> - */ >> -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) >> - /* Callout active, and needs to be torn down */ >> -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) >> - >> - /* Periph drivers set these flags to indicate work */ >> -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) >> - >> #ifdef CAM_IOSCHED_DYNAMIC >> static void >> cam_iosched_io_metric_update(struct cam_iosched_softc *isc, >> @@ -1322,6 +1325,10 @@ struct bio * >> cam_iosched_next_bio(struct cam_iosched_softc *isc) >> { >> struct bio *bp; >> + bool wastick; >> + >> + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); >> + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; >> >> /* >> * See if we have a trim that can be scheduled. We can only send one >> _______________________________________________ >> 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-unsubscribe@freebsd.org" > > A recent buildworld/buildkernel failed with this error just right now: > > --- cam_iosched.o --- > /usr/src/sys/cam/cam_iosched.c:593:16: error: use of undeclared identifier > 'CAM_IOSCHED_FLAGS_TICK' isc->flags |= CAM_IOSCHED_FLAGS_TICK; > Looks like a typo, FLAGS_TICK vs FLAG_TICK -- Allan Jude From owner-svn-src-all@freebsd.org Thu Feb 22 08:15:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28E26F11D83 for ; Thu, 22 Feb 2018 08:15:27 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B43B746D1 for ; Thu, 22 Feb 2018 08:15:26 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x236.google.com with SMTP id a20so1282979wmd.1 for ; Thu, 22 Feb 2018 00:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=YR4VBOi0YZyE6OjPpD+Mr4wxFKTZKCtDP9ZAThfqxmA=; b=HyZy6CtMbX37s+5cvbXnsPitxu57SD/KF1+qTa8DmIt4y58IKPov1pQ+hUvQSOkxbj O8yjLbvY95ln3OOkKAhRiujru89N14PTMCCGx5ljn7bMY/WJyE4haLztJGRXBoKPV2/i MT9qRHBwhHgQl2vOV4o/MpuygM/Vxr/0jbOsFBjtz/8G+eLXXj99KCcr1T4767WcxEQk W8Yo5+3YUnZAExoH6F9EFSVvl1gxPV2vBlsyoWRJFX7uXGzX0NtWz8SBaiQLx75NzKPq BJXRHeBnJ1XVXTlS6QOC9jxKpKuvthfddaMjU9VAcJd+gTrzbLinCl6aADLwRYE1676R nMfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=YR4VBOi0YZyE6OjPpD+Mr4wxFKTZKCtDP9ZAThfqxmA=; b=luUHYW9ysFv47JjQmwPrJMwq5qcfqDjoRCGW8CMUK04w7SmTjNuGbfCWqIvY0NP6ve MSAnUmYVVrlfXa4nyELt7YBDqG45xnrre1Q6Ki6+U7IDvT/yZ9ERJ2wtjTb8RgmtTx2m /tDfzF5PEnJUjNcr6ewFQ4iPtkkKDfE568KMKQbE89y3vTkbP03/SjHO7Iy8t163UeeE P2+LXb0ooJGCFQ6lHWhchGjOpe2xQpTvAtgWmr3P81f3hwHmDXx80Z6iDn7JE33G35I1 m6bSphY2oPXAMkGOQceLflYi9miYMgnHxTAnEt3DSVktA94a+bvoJGgDjVd/A0+m583a B1XQ== X-Gm-Message-State: APf1xPCLejtV1lAgf3qKCRt4Hv4CkrBhyUy51rwumWC4xx5/HV1p5z/L Lf9D86lCH8NvJjU5Qh+uT+qXyIH3JkI= X-Google-Smtp-Source: AH8x224KF7fMoKh0Lv15EDs9NXP+5VcIie0zH7s1AeEEYyyXKXDBrB+MeFKNjYugDMvBT6+5fKDhyg== X-Received: by 10.28.191.3 with SMTP id p3mr4371827wmf.21.1519287325240; Thu, 22 Feb 2018 00:15:25 -0800 (PST) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id 69sm48342wmw.32.2018.02.22.00.15.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 00:15:24 -0800 (PST) Subject: Re: svn commit: r329812 - head/sys/cam To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802220543.w1M5hL8Q068794@repo.freebsd.org> From: Steven Hartland Message-ID: <2666dfe3-28af-06e2-2992-c57b6ba11c12@multiplay.co.uk> Date: Thu, 22 Feb 2018 08:15:25 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802220543.w1M5hL8Q068794@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 08:15:27 -0000 In our experience this is very device dependent, what lead you to this conclusion? On 22/02/2018 05:43, Warner Losh wrote: > Author: imp > Date: Thu Feb 22 05:43:20 2018 > New Revision: 329812 > URL: https://svnweb.freebsd.org/changeset/base/329812 > > Log: > Don't sort TRIMs. > > While the code for ada and da both assume that the trim list is > ordered when doing the coaleascing the TRIMs, it turns out that > creating the sorted list uses more resources than are saved by having > slightly fewer trims sent to the device. > > Sponsored by: Netflix > > Modified: > head/sys/cam/cam_iosched.c > > Modified: head/sys/cam/cam_iosched.c > ============================================================================== > --- head/sys/cam/cam_iosched.c Thu Feb 22 04:30:52 2018 (r329811) > +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:20 2018 (r329812) > @@ -1392,7 +1392,7 @@ cam_iosched_queue_work(struct cam_iosched_softc *isc, > * the work on the bio queue. > */ > if (bp->bio_cmd == BIO_DELETE) { > - bioq_disksort(&isc->trim_queue, bp); > + bioq_insert_tail(&isc->trim_queue, bp); > #ifdef CAM_IOSCHED_DYNAMIC > isc->trim_stats.in++; > isc->trim_stats.queued++; > From owner-svn-src-all@freebsd.org Thu Feb 22 08:25:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABE52F12D87; Thu, 22 Feb 2018 08:25:40 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A1F674F8C; Thu, 22 Feb 2018 08:25:40 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54CF82527A; Thu, 22 Feb 2018 08:25:40 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1M8PeKq049432; Thu, 22 Feb 2018 08:25:40 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1M8PeqT049430; Thu, 22 Feb 2018 08:25:40 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201802220825.w1M8PeqT049430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 22 Feb 2018 08:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329817 - in head/etc: . rc.d X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: in head/etc: . rc.d X-SVN-Commit-Revision: 329817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 08:25:40 -0000 Author: araujo Date: Thu Feb 22 08:25:39 2018 New Revision: 329817 URL: https://svnweb.freebsd.org/changeset/base/329817 Log: The firewall_type is ignored if not set in rc.conf or rc.conf.local, after r190575 there is an option to call rc.firewall with the firewall_type passed in as an argument. Submitted by: David P. Discher MFC after: 3 weeks. Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D14286 Modified: head/etc/rc.d/ipfw head/etc/rc.firewall Modified: head/etc/rc.d/ipfw ============================================================================== --- head/etc/rc.d/ipfw Thu Feb 22 05:44:00 2018 (r329816) +++ head/etc/rc.d/ipfw Thu Feb 22 08:25:39 2018 (r329817) @@ -40,7 +40,11 @@ ipfw_start() { local _firewall_type - _firewall_type=$1 + if [ -n "${1}" ]; then + _firewall_type=$1 + else + _firewall_type=${firewall_type} + fi # set the firewall rules script if none was specified [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall Modified: head/etc/rc.firewall ============================================================================== --- head/etc/rc.firewall Thu Feb 22 05:44:00 2018 (r329816) +++ head/etc/rc.firewall Thu Feb 22 08:25:39 2018 (r329817) @@ -112,12 +112,20 @@ setup_ipv6_mandatory() { ${fwcmd} add pass ipv6-icmp from any to any icmp6types 2,135,136 } +. /etc/rc.subr +. /etc/network.subr + if [ -n "${1}" ]; then firewall_type="${1}" fi +if [ -z "${firewall_rc_config_load}" ]; then + load_rc_config ipfw +else + for i in ${firewall_rc_config_load}; do + load_rc_config $i + done +fi -. /etc/rc.subr -. /etc/network.subr afexists inet6 ipv6_available=$? From owner-svn-src-all@freebsd.org Thu Feb 22 10:55:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F5BEF21652; Thu, 22 Feb 2018 10:55:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 454D27AE38; Thu, 22 Feb 2018 10:55:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4039326ABD; Thu, 22 Feb 2018 10:55:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MAtOkj024563; Thu, 22 Feb 2018 10:55:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MAtO8U024562; Thu, 22 Feb 2018 10:55:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802221055.w1MAtO8U024562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 10:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329818 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 10:55:24 -0000 Author: imp Date: Thu Feb 22 10:55:23 2018 New Revision: 329818 URL: https://svnweb.freebsd.org/changeset/base/329818 Log: Fix typo in last commit after last rebase before commit... Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 08:25:39 2018 (r329817) +++ head/sys/cam/cam_iosched.c Thu Feb 22 10:55:23 2018 (r329818) @@ -590,7 +590,7 @@ cam_iosched_ticker(void *arg) cam_iosched_limiter_tick(&isc->write_stats); cam_iosched_limiter_tick(&isc->trim_stats); - isc->flags |= CAM_IOSCHED_FLAGS_TICK; + isc->flags |= CAM_IOSCHED_FLAG_TICK; cam_iosched_schedule(isc, isc->periph); /* From owner-svn-src-all@freebsd.org Thu Feb 22 10:57:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F863F2193D for ; Thu, 22 Feb 2018 10:57:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 171317B0CE for ; Thu, 22 Feb 2018 10:57:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id w63so5771429ita.3 for ; Thu, 22 Feb 2018 02:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uceNEP8G8BGYDO28EUW4hKinaPS2L5P6o7qcuA6Ol8A=; b=S+jmVnF6zRsA0m/084jz3qtMoHCb3gS3iSGbiGXf47dD9a9eOfn0YWtzyHL9aqxONY 0TqaLTmdMymyrVbttyPIjUvxKbBW9dJBD5cljgZYFKGjHP2xeIGOiFjkMZRWBZFEeQBG OGUWoZCfY6je7zLYnBzQ1A7kdBUryrPce+PyazdiyHXn4WtxvNxcpSi3vIVwQ5N66fXI KaBXH9BuajP6TRyotZPhi/RJ8urYQOW9J4lzxwJFZI4FxSc9eThs9SBsAoNgn4oXVFm8 2qBQMH9MPwDQFIZfJ/w8mvf6tqPrD0PdHpn/confS6oU6EnbSiLwfRm8DLzBstgBV5YM f6NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uceNEP8G8BGYDO28EUW4hKinaPS2L5P6o7qcuA6Ol8A=; b=KRTkeOJMUCphEI/ckZxmvYwfA4UsYUlIgb/qMfREbfqMQXGKGrBvb99V46Cq2AmH7n mhsmg/gHy4wDD4WFZjGpwLV6uRNkg3SrlD2/vAbSqYCdSqrXqjS8fOVbmkjhUzsCc9Le Ub38RnRTSIFWdw6cIk7thYWFB9Pn+2tBLuiRhPmVNYjCNMvviNQxBBCm4p3IfUDQajuH XvvG6Jztcy4Uki22uf8xtifGFE0Udp515mMrkwM482R4iEzKurMxLSD/02xQWzM2VuO6 2aRRO3+OKtCaVxwuWWzosVT15hpWLtlBJnZ6+IppjDHKQmiWSibvMAUSq0qrVTjFiW4u JBSA== X-Gm-Message-State: APf1xPCPecJjTPEKD+UIsQCGR11NDUVIzI7iNVMWVQf+CVPSnqJjuYYA fN+d45Dlj/LKegGgNsEqZfOIz7KaEw47upUSHYgtzQ== X-Google-Smtp-Source: AG47ELuLeOm3BUo8SJRvkRav7o42w61bikALuxuCxjTgxGXKnmScvro+6IhBvF+l2ecOTyCY2YIPRiQxi3ZvwLCZgI0= X-Received: by 10.36.222.2 with SMTP id d2mr7166246itg.1.1519297031263; Thu, 22 Feb 2018 02:57:11 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 02:57:10 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <89a4b962-ca69-4a42-579e-72ae777ef015@freebsd.org> References: <201802220543.w1M5hobv068907@repo.freebsd.org> <20180222070713.1ba6f278@freyja.zeit4.iv.bundesimmobilien.de> <89a4b962-ca69-4a42-579e-72ae777ef015@freebsd.org> From: Warner Losh Date: Thu, 22 Feb 2018 03:57:10 -0700 X-Google-Sender-Auth: _SRskkYoJKIqoSwv_lzLuZn-Uy8 Message-ID: Subject: Re: svn commit: r329814 - head/sys/cam To: Allan Jude Cc: "O. Hartmann" , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 10:57:12 -0000 On Thu, Feb 22, 2018 at 12:01 AM, Allan Jude wrote: > On 2018-02-22 01:07, O. Hartmann wrote: > > On Thu, 22 Feb 2018 05:43:50 +0000 (UTC) > > Warner Losh wrote: > > > >> Author: imp > >> Date: Thu Feb 22 05:43:50 2018 > >> New Revision: 329814 > >> URL: https://svnweb.freebsd.org/changeset/base/329814 > >> > >> Log: > >> Note when we tick. > >> > >> To help implement a policy of 'queue all trims until next I/O sched > >> tick' policy to help coalesce them, note when we tick so we can do > >> something special on the first call after the tick to get more work. > >> > >> Sponsored by: Netflix > >> > >> Modified: > >> head/sys/cam/cam_iosched.c > >> > >> Modified: head/sys/cam/cam_iosched.c > >> ============================================================ > ================== > >> --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 > >> (r329813) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 > >> 2018 (r329814) @@ -60,6 +60,19 @@ static MALLOC_DEFINE(M_CAMSCHED, > >> "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); > >> > >> /* > >> + * Trim or similar currently pending completion. Should only be set for > >> + * those drivers wishing only one Trim active at a time. > >> + */ > >> +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > >> + /* Callout active, and needs to be torn down */ > >> +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > >> + /* Timer has just ticked */ > >> +#define CAM_IOSCHED_FLAG_TICK (1ul << 2) > >> + > >> + /* Periph drivers set these flags to indicate work > */ > >> +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > >> + > >> +/* > >> * Default I/O scheduler for FreeBSD. This implementation is just a > >> thin-vineer > >> * over the bioq_* interface, with notions of separate calls for > normal I/O > >> and > >> * for trims. > >> @@ -574,6 +587,7 @@ cam_iosched_ticker(void *arg) > >> cam_iosched_limiter_tick(&isc->write_stats); > >> cam_iosched_limiter_tick(&isc->trim_stats); > >> > >> + isc->flags |= CAM_IOSCHED_FLAGS_TICK; > >> cam_iosched_schedule(isc, isc->periph); > >> > >> /* > >> @@ -701,17 +715,6 @@ cam_iosched_cl_maybe_steer(struct control_loop > *clp) > >> } > >> #endif > >> > >> -/* > >> - * Trim or similar currently pending completion. Should only be set for > >> - * those drivers wishing only one Trim active at a time. > >> - */ > >> -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > >> - /* Callout active, and needs to be torn down */ > >> -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > >> - > >> - /* Periph drivers set these flags to indicate work > */ > >> -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > >> - > >> #ifdef CAM_IOSCHED_DYNAMIC > >> static void > >> cam_iosched_io_metric_update(struct cam_iosched_softc *isc, > >> @@ -1322,6 +1325,10 @@ struct bio * > >> cam_iosched_next_bio(struct cam_iosched_softc *isc) > >> { > >> struct bio *bp; > >> + bool wastick; > >> + > >> + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); > >> + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; > >> > >> /* > >> * See if we have a trim that can be scheduled. We can only send > one > >> _______________________________________________ > >> 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-unsubscribe@freebsd.org" > > > > A recent buildworld/buildkernel failed with this error just right now: > > > > --- cam_iosched.o --- > > /usr/src/sys/cam/cam_iosched.c:593:16: error: use of undeclared > identifier > > 'CAM_IOSCHED_FLAGS_TICK' isc->flags |= CAM_IOSCHED_FLAGS_TICK; > > > > Looks like a typo, FLAGS_TICK vs FLAG_TICK > It is. I'm unsure how, but it appears to have snuck in during my final rebasing to current... I had a mix in the middle of development and thought I'd fixed them all... Warner From owner-svn-src-all@freebsd.org Thu Feb 22 11:18:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38226F23882; Thu, 22 Feb 2018 11:18:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E15C17C325; Thu, 22 Feb 2018 11:18:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5F8826DE4; Thu, 22 Feb 2018 11:18:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MBIYx8034685; Thu, 22 Feb 2018 11:18:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MBIYQa034679; Thu, 22 Feb 2018 11:18:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802221118.w1MBIYQa034679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 11:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329819 - in head/sys: cam cam/ata cam/nvme cam/scsi dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam cam/ata cam/nvme cam/scsi dev/nvme X-SVN-Commit-Revision: 329819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 11:18:35 -0000 Author: imp Date: Thu Feb 22 11:18:33 2018 New Revision: 329819 URL: https://svnweb.freebsd.org/changeset/base/329819 Log: Backout r329818, r329816 and r329815. These aren't the commits I thought I was testing prior to commit. Revert until I can sort out what happened and fix it. Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_iosched.c head/sys/cam/cam_iosched.h head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_da.c head/sys/dev/nvme/nvme.h Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/cam/ata/ata_da.c Thu Feb 22 11:18:33 2018 (r329819) @@ -1705,7 +1705,7 @@ adaregister(struct cam_periph *periph, void *arg) announce_buf = softc->announce_temp; bzero(announce_buf, ADA_ANNOUNCETMP_SZ); - if (cam_iosched_init(&softc->cam_iosched, periph, 0) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { printf("adaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/cam/cam_iosched.c Thu Feb 22 11:18:33 2018 (r329819) @@ -68,8 +68,6 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", #define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) /* Timer has just ticked */ #define CAM_IOSCHED_FLAG_TICK (1ul << 2) - /* When set, defer trims until after next tick */ -#define CAM_IOSCHED_FLAG_TRIM_QONLY (1ul << 4) /* Periph drivers set these flags to indicate work */ #define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) @@ -292,7 +290,6 @@ struct cam_iosched_softc { struct bio_queue_head trim_queue; /* scheduler flags < 16, user flags >= 16 */ uint32_t flags; - u_int caps; int sort_io_queue; #ifdef CAM_IOSCHED_DYNAMIC int read_bias; /* Read bias setting */ @@ -590,7 +587,7 @@ cam_iosched_ticker(void *arg) cam_iosched_limiter_tick(&isc->write_stats); cam_iosched_limiter_tick(&isc->trim_stats); - isc->flags |= CAM_IOSCHED_FLAG_TICK; + isc->flags |= CAM_IOSCHED_FLAGS_TICK; cam_iosched_schedule(isc, isc->periph); /* @@ -1067,16 +1064,12 @@ cam_iosched_cl_sysctl_fini(struct control_loop *clp) * sizeof struct cam_iosched_softc. */ int -cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph, - u_int caps) +cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph) { *iscp = malloc(sizeof(**iscp), M_CAMSCHED, M_NOWAIT | M_ZERO); if (*iscp == NULL) return ENOMEM; - (*iscp)->caps = caps; - if (caps & CAM_IOSCHED_CAP_TRIM_CLOCKED) - (*iscp)->flags |= CAM_IOSCHED_FLAG_TRIM_QONLY; #ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug) printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); @@ -1203,7 +1196,7 @@ cam_iosched_flush(struct cam_iosched_softc *isc, struc #ifdef CAM_IOSCHED_DYNAMIC static struct bio * -cam_iosched_get_write(struct cam_iosched_softc *isc, bool wastick) +cam_iosched_get_write(struct cam_iosched_softc *isc) { struct bio *bp; @@ -1312,45 +1305,13 @@ cam_iosched_next_trim(struct cam_iosched_softc *isc) * * Assumes we're called with the periph lock held. */ -static struct bio * -cam_iosched_get_trim(struct cam_iosched_softc *isc, bool wastick) +struct bio * +cam_iosched_get_trim(struct cam_iosched_softc *isc) { - /* - * If there's no trims, return NULL. If we're clocking out the - * trims rather than doing thins right away, this is where we - * set the queue only bit. This causes us to ignore them until - * the next clock tick. If we can't get a trim, and we're clocking - * them out, if the queue is empty or if we're rate limited, - * then set QONLY so we stop processing trims until the next - * tick. - */ - if (!cam_iosched_has_more_trim(isc)) { - if ((isc->caps & CAM_IOSCHED_CAP_TRIM_CLOCKED) && - (bioq_first(&isc->trim_queue) == NULL || -#ifdef CAM_IOSCHED_DYNAMIC - (isc->trim_stats.state_flags & IOP_RATE_LIMITED) -#else - false -#endif - )) - isc->flags |= CAM_IOSCHED_FLAG_TRIM_QONLY; + if (!cam_iosched_has_more_trim(isc)) return NULL; - } - /* - * If we just ticked, and we have trims, then turn off - * the queue only flag. - */ - if (wastick) - isc->flags &= ~CAM_IOSCHED_FLAG_TRIM_QONLY; - - /* - * If QONLY is set, no trims are eligble just now. - */ - if (isc->flags & CAM_IOSCHED_FLAG_TRIM_QONLY) - return NULL; - return cam_iosched_next_trim(isc); } @@ -1366,17 +1327,17 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) struct bio *bp; bool wastick; - wastick = !!(isc->flags & CAM_IOSCHED_FLAG_TICK); - isc->flags &= ~CAM_IOSCHED_FLAG_TICK; + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; /* * See if we have a trim that can be scheduled. We can only send one - * at a time down, so this takes that into account for those devices - * that can only do one. In addition, some devices queue up a bunch - * of TRIMs before sending them down as a batch. + * at a time down, so this takes that into account. + * + * XXX newer TRIM commands are queueable. Revisit this when we + * implement them. */ - if ((isc->flags & CAM_IOSCHED_FLAG_TRIM_QONLY) == 0 && - (bp = cam_iosched_get_trim(isc, wastick)) != NULL) + if ((bp = cam_iosched_get_trim(isc)) != NULL) return bp; #ifdef CAM_IOSCHED_DYNAMIC @@ -1385,7 +1346,7 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) * and if so, those are next. */ if (do_dynamic_iosched) { - if ((bp = cam_iosched_get_write(isc, was_tick)) != NULL) + if ((bp = cam_iosched_get_write(isc)) != NULL) return bp; } #endif Modified: head/sys/cam/cam_iosched.h ============================================================================== --- head/sys/cam/cam_iosched.h Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/cam/cam_iosched.h Thu Feb 22 11:18:33 2018 (r329819) @@ -81,12 +81,11 @@ cam_iosched_sbintime_t(uintptr_t delta) return (sbintime_t)((uint64_t)delta << CAM_IOSCHED_TIME_SHIFT); } -#define CAM_IOSCHED_CAP_TRIM_CLOCKED 0x1 - -int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph, u_int caps); +int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); void cam_iosched_fini(struct cam_iosched_softc *); void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); struct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); +struct bio *cam_iosched_get_trim(struct cam_iosched_softc *isc); struct bio *cam_iosched_next_bio(struct cam_iosched_softc *isc); void cam_iosched_queue_work(struct cam_iosched_softc *isc, struct bio *bp); void cam_iosched_flush(struct cam_iosched_softc *isc, struct devstat *stp, int err); Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/cam/nvme/nvme_da.c Thu Feb 22 11:18:33 2018 (r329819) @@ -122,14 +122,6 @@ struct nda_softc { #endif }; -struct nda_trim_request { - union { - struct nvme_dsm_range dsm; - uint8_t data[NVME_MAX_DSM_TRIM]; - } u; - TAILQ_HEAD(, bio) bps; -}; - /* Need quirk table */ static disk_strategy_t ndastrategy; @@ -158,14 +150,11 @@ static void ndasuspend(void *arg); #ifndef NDA_DEFAULT_RETRY #define NDA_DEFAULT_RETRY 4 #endif -#ifndef NDA_MAX_TRIM_ENTRIES -#define NDA_MAX_TRIM_ENTRIES 256 /* Number of DSM trims to use, max 256 */ -#endif + //static int nda_retry_count = NDA_DEFAULT_RETRY; static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED; static int nda_default_timeout = NDA_DEFAULT_TIMEOUT; -static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES; /* * All NVMe media is non-rotational, so all nvme device instances @@ -702,8 +691,7 @@ ndaregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - if (cam_iosched_init(&softc->cam_iosched, periph, - CAM_IOSCHED_CAP_TRIM_CLOCKED) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { printf("ndaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); return(CAM_REQ_CMP_ERR); @@ -906,40 +894,22 @@ ndastart(struct cam_periph *periph, union ccb *start_c } case BIO_DELETE: { - struct nvme_dsm_range *dsm_range, *dsm_end; - struct nda_trim_request *trim; - struct bio *bp1; - int ents; + struct nvme_dsm_range *dsm_range; - trim = malloc(sizeof(*trim), M_NVMEDA, M_ZERO | M_NOWAIT); - if (trim == NULL) { + dsm_range = + malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_NOWAIT); + if (dsm_range == NULL) { biofinish(bp, NULL, ENOMEM); xpt_release_ccb(start_ccb); ndaschedule(periph); return; } - TAILQ_INIT(&trim->bps); - bp1 = bp; - ents = sizeof(trim->u.data) / sizeof(struct nvme_dsm_range); - ents = min(ents, nda_max_trim_entries); - dsm_range = &trim->u.dsm; - dsm_end = dsm_range + ents; - do { - TAILQ_INSERT_TAIL(&trim->bps, bp1, bio_queue); - dsm_range->length = - bp1->bio_bcount / softc->disk->d_sectorsize; - dsm_range->starting_lba = - bp1->bio_offset / softc->disk->d_sectorsize; - dsm_range++; - if (dsm_range >= dsm_end) - break; - bp1 = cam_iosched_next_trim(softc->cam_iosched); - /* XXX -- Could collapse adjacent ranges, but we don't for now */ - /* XXX -- Could limit based on total payload size */ - } while (bp1 != NULL); - bp->bio_driver2 = trim; - nda_nvme_trim(softc, &start_ccb->nvmeio, &trim->u.dsm, - dsm_range - &trim->u.dsm); + dsm_range->length = + bp->bio_bcount / softc->disk->d_sectorsize; + dsm_range->starting_lba = + bp->bio_offset / softc->disk->d_sectorsize; + bp->bio_driver2 = dsm_range; + nda_nvme_trim(softc, &start_ccb->nvmeio, dsm_range, 1); start_ccb->ccb_h.ccb_state = NDA_CCB_TRIM; start_ccb->ccb_h.flags |= CAM_UNLOCKED; /* @@ -1020,6 +990,8 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb } else { bp->bio_resid = 0; } + if (state == NDA_CCB_TRIM) + free(bp->bio_driver2, M_NVMEDA); softc->outstanding_cmds--; /* @@ -1031,15 +1003,13 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb cam_iosched_bio_complete(softc->cam_iosched, bp, done_ccb); xpt_release_ccb(done_ccb); if (state == NDA_CCB_TRIM) { - struct nda_trim_request *trim; - struct bio *bp1; +#ifdef notyet TAILQ_HEAD(, bio) queue; + struct bio *bp1; - trim = bp->bio_driver2; TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &trim->bps, bio_queue); - free(trim, M_NVMEDA); - + TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue); +#endif /* * Since we can have multiple trims in flight, we don't * need to call this here. @@ -1047,6 +1017,8 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb */ ndaschedule(periph); cam_periph_unlock(periph); +#ifdef notyet +/* Not yet collapsing several BIO_DELETE requests into one TRIM */ while ((bp1 = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, bp1, bio_queue); bp1->bio_error = error; @@ -1057,6 +1029,9 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb bp1->bio_resid = 0; biodone(bp1); } +#else + biodone(bp); +#endif } else { ndaschedule(periph); cam_periph_unlock(periph); Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/cam/scsi/scsi_da.c Thu Feb 22 11:18:33 2018 (r329819) @@ -2572,7 +2572,7 @@ daregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - if (cam_iosched_init(&softc->cam_iosched, periph, 0) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph) != 0) { printf("daregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Thu Feb 22 10:55:23 2018 (r329818) +++ head/sys/dev/nvme/nvme.h Thu Feb 22 11:18:33 2018 (r329819) @@ -59,9 +59,6 @@ /* Cap nvme to 1MB transfers driver explodes with larger sizes */ #define NVME_MAX_XFER_SIZE (MAXPHYS < (1<<20) ? MAXPHYS : (1<<20)) -/* Largest DSM Trim that can be done */ -#define NVME_MAX_DSM_TRIM 4096 - union cap_lo_register { uint32_t raw; struct { From owner-svn-src-all@freebsd.org Thu Feb 22 11:35:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3B3EF24DEB; Thu, 22 Feb 2018 11:35:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 3E1E87CE54; Thu, 22 Feb 2018 11:35:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id B29971045E9; Thu, 22 Feb 2018 22:12:16 +1100 (AEDT) Date: Thu, 22 Feb 2018 22:12:15 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Benno Rice cc: Colin Percival , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329737 - head/stand/i386/boot2 In-Reply-To: Message-ID: <20180222215700.Q2777@besplex.bde.org> References: <201802211810.w1LIApvC012656@repo.freebsd.org> <01000161b9b067ef-cf38721a-d658-4840-bd63-4e50310f3d52-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=tKatY2OJAAAA:8 a=5xMUPcLK8LthSvtWSr0A:9 a=B3lYLri6K72FZsHg:21 a=RxScmUlPLVADfG0m:21 a=CjuIK1q_8ugA:10 a=ce2VFjyCEyIfsGOlKAFV:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 11:35:59 -0000 On Wed, 21 Feb 2018, Benno Rice wrote: >> On Feb 21, 2018, at 10:46 AM, Colin Percival wrote: >> >> On 02/21/18 10:10, Benno Rice wrote: >>> Curiously, changing whitespace seems to cause the md5 of the .o files to differ >>> these days hence the following testing strategy: >>> >>> Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) objdump -d only dissassembles the text section (and does a bad job of that, with calls to extern functions printed as e8 fc ff ff ff call on i386 (here 0xe8 is the opcode for the call instruction, and fc ff ff ff is -4 which is a placeholder for the eventual offset, and is the result of adding -4 to the current program counter. The symbol table gives the name of linked address, but the garbage offset is used to form the garbage address instead of printing this name. So objdump -d would miss the large change of calling a different extern function. >> Is this simply because line numbers are changing? That isn't new; I remember >> a case where a security advisory touched a .h file and suddenly a huge number >> of binaries changed because they included header file line numbers. > > No, it happened when I changed the indent of the while statement on line ~132 in memcpy. I do suspect debug info though. Isn't there a binary compiled without any debug info? Bruce From owner-svn-src-all@freebsd.org Thu Feb 22 11:41:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AED7F25373; Thu, 22 Feb 2018 11:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFE857D308; Thu, 22 Feb 2018 11:41:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA4772713F; Thu, 22 Feb 2018 11:41:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MBf01u046893; Thu, 22 Feb 2018 11:41:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MBf0dI046892; Thu, 22 Feb 2018 11:41:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802221141.w1MBf0dI046892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 22 Feb 2018 11:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329820 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 11:41:01 -0000 Author: avg Date: Thu Feb 22 11:41:00 2018 New Revision: 329820 URL: https://svnweb.freebsd.org/changeset/base/329820 Log: followup to r329556, completely remove the covered vnode assert vrele() acquires the vnode lock only if the hold count drops to zero. In other scenarios it needs only the interlock. So, zfsctl_snapdir_lookup() can race with vfs_mount_destroy() -> vrele() such that the lookup adds a new reference and then vrele() drops the mountpoint's reference and only then we check the reference count. It would be just one in this case. In fact, the assert should have been removed in r323483 when the code learned how to deal with the uncovered vnode. PR: 225795 MFC after: 4 days X-MFC with: r329556 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Feb 22 11:18:33 2018 (r329819) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Feb 22 11:41:00 2018 (r329820) @@ -976,13 +976,6 @@ zfsctl_snapdir_lookup(ap) break; /* - * The vnode must be referenced at least by this thread and - * the mount point or the thread doing the mounting. - * There can be more references from concurrent lookups. - */ - KASSERT((*vpp)->v_holdcnt > 1, ("found unheld mountpoint")); - - /* * Check if a snapshot is already mounted on top of the vnode. */ err = zfsctl_mounted_here(vpp, lkflags); From owner-svn-src-all@freebsd.org Thu Feb 22 11:51:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EA54F262B7; Thu, 22 Feb 2018 11:51:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0098E7DDD6; Thu, 22 Feb 2018 11:51:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF9DE27311; Thu, 22 Feb 2018 11:51:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MBpo7A052133; Thu, 22 Feb 2018 11:51:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MBpo0W052132; Thu, 22 Feb 2018 11:51:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802221151.w1MBpo0W052132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 22 Feb 2018 11:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329821 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 11:51:51 -0000 Author: imp Date: Thu Feb 22 11:51:50 2018 New Revision: 329821 URL: https://svnweb.freebsd.org/changeset/base/329821 Log: Revert r329814 as well. It should have been in r329819. Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Feb 22 11:41:00 2018 (r329820) +++ head/sys/cam/cam_iosched.c Thu Feb 22 11:51:50 2018 (r329821) @@ -60,19 +60,6 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); /* - * Trim or similar currently pending completion. Should only be set for - * those drivers wishing only one Trim active at a time. - */ -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) - /* Callout active, and needs to be torn down */ -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) - /* Timer has just ticked */ -#define CAM_IOSCHED_FLAG_TICK (1ul << 2) - - /* Periph drivers set these flags to indicate work */ -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) - -/* * Default I/O scheduler for FreeBSD. This implementation is just a thin-vineer * over the bioq_* interface, with notions of separate calls for normal I/O and * for trims. @@ -587,7 +574,6 @@ cam_iosched_ticker(void *arg) cam_iosched_limiter_tick(&isc->write_stats); cam_iosched_limiter_tick(&isc->trim_stats); - isc->flags |= CAM_IOSCHED_FLAGS_TICK; cam_iosched_schedule(isc, isc->periph); /* @@ -715,6 +701,17 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) } #endif +/* + * Trim or similar currently pending completion. Should only be set for + * those drivers wishing only one Trim active at a time. + */ +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) + /* Callout active, and needs to be torn down */ +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) + + /* Periph drivers set these flags to indicate work */ +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) + #ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_io_metric_update(struct cam_iosched_softc *isc, @@ -1325,10 +1322,6 @@ struct bio * cam_iosched_next_bio(struct cam_iosched_softc *isc) { struct bio *bp; - bool wastick; - - wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); - isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; /* * See if we have a trim that can be scheduled. We can only send one From owner-svn-src-all@freebsd.org Thu Feb 22 11:56:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98739F2673C for ; Thu, 22 Feb 2018 11:56:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 276C27E0D7 for ; Thu, 22 Feb 2018 11:56:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id z6so5723400iob.11 for ; Thu, 22 Feb 2018 03:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ammovNOEXAASkYq6AqvmKpePluVcKE3hQmVv2oPQD2g=; b=CvsEKPlNqGWqyQXC7ny3H3fpWFTYPCxsxrqGgVXlfEcAgKffrbSkeK4vnmdHDVElAJ /UvCrpMK2CrN3fYOZR63HQQFtgpI3iBeP37FNdNDudLU+7edoqgIv2mAXT1ZJ9HoPX6y BEkrJX8uRvxpXmKd6l6G1eR3MI+9+tH7ycHJ/hp+FeImY0FBXc82oZ9Atubgi3GC2bjh MT30qk1BWSSBEUyALYI8D8Fbrkv37bdfl+PNgn/n94g5GseS9CdzLll5WWFhoyji3lrS 1u5FFeNAGQ3BcAilFxZOzkoGKtpS2NtE0JXrmXFT37Vpnl9tOyl1Zd+4uz3I1yoHa3qE pB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ammovNOEXAASkYq6AqvmKpePluVcKE3hQmVv2oPQD2g=; b=bEnQnW9+UEulAz6Nvm2Hna29U0bzfd3QxxRXeVKGROZaqu7REML4ZaY4/b1z3frNcI s6eS7yfd1uX3I25dVa+pz78U4q9a7BSPuOes6F3EUSjFOdAhMZtBCsFv02rQYN8LDpjK tCTp1+pXig7ktYAXz54Qkj1fflO2vhaOMT6th7E1vwLBZTan3FTCixxEZHgjAXj8UWbQ wnwQqv7imvoPmn2QqH1E7bJ5PKO2mDHovAyz7sYO2zPXs6cDaQ8aN6WADyU67+1d/OfJ G9+I+npruPW7gUcJI33ItbBchIX+xpY96rplO52+A7w4ibtiIuQCSGvv3efgNZGU4/Q3 XYRA== X-Gm-Message-State: APf1xPAZZAKqADjZj/p1j2q2S7VkG8CnSM5f9Gr7PfxLg9R42QIgl/gI Wm/p7ZuqDEdU13KrIuYO9f38eD5PwiK4p+reehAjBw== X-Google-Smtp-Source: AH8x227N9KlNiPJvKm++aXGKMrahN4cGdX3WnaSQBtk0b9Pigqw1jtOfaA7Y2VfI+t4ohr+ORIn5+hfZhvv3DFlu95Q= X-Received: by 10.107.188.65 with SMTP id m62mr8018346iof.39.1519300564384; Thu, 22 Feb 2018 03:56:04 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 03:56:03 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:b10f:802c:cf9a:71e3] Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 03:56:03 -0800 (PST) In-Reply-To: References: <201802220543.w1M5hobv068907@repo.freebsd.org> <20180222070713.1ba6f278@freyja.zeit4.iv.bundesimmobilien.de> <89a4b962-ca69-4a42-579e-72ae777ef015@freebsd.org> From: Warner Losh Date: Thu, 22 Feb 2018 04:56:03 -0700 X-Google-Sender-Auth: m4IOOIgh8uiBRcH6wVjMvY34tJI Message-ID: Subject: Re: svn commit: r329814 - head/sys/cam To: Allan Jude Cc: "O. Hartmann" , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 11:56:05 -0000 On Feb 22, 2018 3:57 AM, "Warner Losh" wrote: On Thu, Feb 22, 2018 at 12:01 AM, Allan Jude wrote: > On 2018-02-22 01:07, O. Hartmann wrote: > > On Thu, 22 Feb 2018 05:43:50 +0000 (UTC) > > Warner Losh wrote: > > > >> Author: imp > >> Date: Thu Feb 22 05:43:50 2018 > >> New Revision: 329814 > >> URL: https://svnweb.freebsd.org/changeset/base/329814 > >> > >> Log: > >> Note when we tick. > >> > >> To help implement a policy of 'queue all trims until next I/O sched > >> tick' policy to help coalesce them, note when we tick so we can do > >> something special on the first call after the tick to get more work. > >> > >> Sponsored by: Netflix > >> > >> Modified: > >> head/sys/cam/cam_iosched.c > >> > >> Modified: head/sys/cam/cam_iosched.c > >> ============================================================ > ================== > >> --- head/sys/cam/cam_iosched.c Thu Feb 22 05:43:45 2018 > >> (r329813) +++ head/sys/cam/cam_iosched.c Thu Feb 22 05:43:50 > >> 2018 (r329814) @@ -60,6 +60,19 @@ static MALLOC_DEFINE(M_CAMSCHED, > >> "CAM I/O Scheduler", "CAM I/O Scheduler buffers"); > >> > >> /* > >> + * Trim or similar currently pending completion. Should only be set for > >> + * those drivers wishing only one Trim active at a time. > >> + */ > >> +#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > >> + /* Callout active, and needs to be torn down */ > >> +#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > >> + /* Timer has just ticked */ > >> +#define CAM_IOSCHED_FLAG_TICK (1ul << 2) > >> + > >> + /* Periph drivers set these flags to indicate work > */ > >> +#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > >> + > >> +/* > >> * Default I/O scheduler for FreeBSD. This implementation is just a > >> thin-vineer > >> * over the bioq_* interface, with notions of separate calls for > normal I/O > >> and > >> * for trims. > >> @@ -574,6 +587,7 @@ cam_iosched_ticker(void *arg) > >> cam_iosched_limiter_tick(&isc->write_stats); > >> cam_iosched_limiter_tick(&isc->trim_stats); > >> > >> + isc->flags |= CAM_IOSCHED_FLAGS_TICK; > >> cam_iosched_schedule(isc, isc->periph); > >> > >> /* > >> @@ -701,17 +715,6 @@ cam_iosched_cl_maybe_steer(struct control_loop > *clp) > >> } > >> #endif > >> > >> -/* > >> - * Trim or similar currently pending completion. Should only be set for > >> - * those drivers wishing only one Trim active at a time. > >> - */ > >> -#define CAM_IOSCHED_FLAG_TRIM_ACTIVE (1ul << 0) > >> - /* Callout active, and needs to be torn down */ > >> -#define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1) > >> - > >> - /* Periph drivers set these flags to indicate work > */ > >> -#define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) > >> - > >> #ifdef CAM_IOSCHED_DYNAMIC > >> static void > >> cam_iosched_io_metric_update(struct cam_iosched_softc *isc, > >> @@ -1322,6 +1325,10 @@ struct bio * > >> cam_iosched_next_bio(struct cam_iosched_softc *isc) > >> { > >> struct bio *bp; > >> + bool wastick; > >> + > >> + wastick = !!(isc->flags & CAM_IOSCHED_FLAGS_TICK); > >> + isc->flags &= ~CAM_IOSCHED_FLAGS_TICK; > >> > >> /* > >> * See if we have a trim that can be scheduled. We can only send > one > >> _______________________________________________ > >> 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-unsubscribe@freebsd.org" > > > > A recent buildworld/buildkernel failed with this error just right now: > > > > --- cam_iosched.o --- > > /usr/src/sys/cam/cam_iosched.c:593:16: error: use of undeclared > identifier > > 'CAM_IOSCHED_FLAGS_TICK' isc->flags |= CAM_IOSCHED_FLAGS_TICK; > > > > Looks like a typo, FLAGS_TICK vs FLAG_TICK > It is. I'm unsure how, but it appears to have snuck in during my final rebasing to current... I had a mix in the middle of development and thought I'd fixed them all... Something is not right with the series. Backing out and will recommit when its sorted out. Warner From owner-svn-src-all@freebsd.org Thu Feb 22 12:31:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03721F29A30; Thu, 22 Feb 2018 12:31:29 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC0BD800A6; Thu, 22 Feb 2018 12:31:28 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6CB527956; Thu, 22 Feb 2018 12:31:28 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MCVSq7070695; Thu, 22 Feb 2018 12:31:28 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MCVS7D070694; Thu, 22 Feb 2018 12:31:28 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802221231.w1MCVS7D070694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 22 Feb 2018 12:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329822 - head/sbin X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sbin X-SVN-Commit-Revision: 329822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 12:31:29 -0000 Author: wma Date: Thu Feb 22 12:31:28 2018 New Revision: 329822 URL: https://svnweb.freebsd.org/changeset/base/329822 Log: Add bsdlabel and fdisk to powerpc64 Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Added: head/sbin/Makefile.powerpc64 (contents, props changed) Added: head/sbin/Makefile.powerpc64 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/Makefile.powerpc64 Thu Feb 22 12:31:28 2018 (r329822) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +SUBDIR += bsdlabel +SUBDIR += fdisk From owner-svn-src-all@freebsd.org Thu Feb 22 13:06:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5C65F0128A; Thu, 22 Feb 2018 13:06:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B22C815BA; Thu, 22 Feb 2018 13:06:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92E2F27F77; Thu, 22 Feb 2018 13:06:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MD6Rjq089740; Thu, 22 Feb 2018 13:06:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MD6R4E089737; Thu, 22 Feb 2018 13:06:27 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802221306.w1MD6R4E089737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 22 Feb 2018 13:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329823 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 329823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 13:06:28 -0000 Author: avg Date: Thu Feb 22 13:06:27 2018 New Revision: 329823 URL: https://svnweb.freebsd.org/changeset/base/329823 Log: another rework of getzfsvfs / getzfsvfs_impl code This change is designed to account for yet another difference between illumos and FreeBSD VFS. In FreeBSD a filesystem driver is supposed to clean up mnt_data in its VFS_UNMOUNT method because it's the last call into the driver before a struct mount object is destroyed. The VFS drains all references to the object before destroying it, but for the driver it's already as good as gone. In contrast, illumos VFS provides another method, VFS_FREEVFS, that is called when all references are drained. So, the driver can keep its data after VFS_UNMOUNT and clean it up in VFS_FREEVFS after all references are gone. This is what ZFS does on illumos. So there a reference to a filesystem is sufficient to guarantee that the ZFS specific data, aka zfsvfs_t, stays around (even if the filesystem gets unmounted). In FreeBSD we need to vfs_busy the filesystem to get the same guarantee. vfs_ref guarantees only that the struct mount is kept. The following rules should be observed in getzfsvfs / getzfsvfs_impl on FreeBSD: - if we need access to zfsvfs_t then we must use vfs_busy - if only we need to access struct mount (aka vfs_t), then vfs_ref is enough - when illumos code actually needs only the vfs_t, they still can pass the zfsvfs_t and get the vfs_t from it; that can work in FreeBSD if the filesystem is busied, but when it's just referenced then we have to pass the vfs_t explicitly - we cannot call vfs_busy while holding a dataset because that creates a LOR with dp_config_rwlock As a result: - getzfsvfs_impl now only references the filesystem, same as in illumos, but unlike illumos it has to return the vfs_t - the consumers are updated to account for the change - getzfsvfs busies the filesystem (and drops the reference from getzfsvfs_impl) Also, zfs_unmount_snap() now gets a busied a filesystem, references it and then unbusies it essentially reverting actions done in getzfsvfs. This is needed because the code may perform some checks that require the zfsvfs_t. So, those are done before the unbusying. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Feb 22 12:31:28 2018 (r329822) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Feb 22 13:06:27 2018 (r329823) @@ -426,7 +426,11 @@ extern int zfs_secpolicy_destroy_perms(const char *, c extern int zfs_busy(void); extern void zfs_unmount_snap(const char *); extern void zfs_destroy_unmount_origin(const char *); +#ifdef illumos extern int getzfsvfs_impl(struct objset *, struct zfsvfs **); +#else +extern int getzfsvfs_impl(struct objset *, vfs_t **); +#endif extern int getzfsvfs(const char *, struct zfsvfs **); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Thu Feb 22 12:31:28 2018 (r329822) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Thu Feb 22 13:06:27 2018 (r329823) @@ -226,7 +226,9 @@ get_temporary_prop(dsl_dataset_t *ds, zfs_prop_t zfs_p return (0); #else int error; +#ifdef illumos zfsvfs_t *zfvp; +#endif vfs_t *vfsp; objset_t *os; uint64_t tmp = *val; @@ -235,12 +237,12 @@ get_temporary_prop(dsl_dataset_t *ds, zfs_prop_t zfs_p if (error != 0) return (error); - error = getzfsvfs_impl(os, &zfvp); + error = getzfsvfs_impl(os, &vfsp); if (error != 0) return (error); - +#ifdef illumos vfsp = zfvp->z_vfs; - +#endif switch (zfs_prop) { case ZFS_PROP_ATIME: if (vfs_optionisset(vfsp, MNTOPT_NOATIME, NULL)) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 12:31:28 2018 (r329822) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Feb 22 13:06:27 2018 (r329823) @@ -1448,9 +1448,9 @@ put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl) } int -getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) +getzfsvfs_impl(objset_t *os, vfs_t **vfsp) { - vfs_t *vfsp; + zfsvfs_t *zfvp; int error = 0; if (dmu_objset_type(os) != DMU_OST_ZFS) { @@ -1458,9 +1458,10 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) } mutex_enter(&os->os_user_ptr_lock); - *zfvp = dmu_objset_get_user(os); - if (*zfvp) { - vfs_ref((*zfvp)->z_vfs); + zfvp = dmu_objset_get_user(os); + if (zfvp) { + *vfsp = zfvp->z_vfs; + vfs_ref(zfvp->z_vfs); } else { error = SET_ERROR(ESRCH); } @@ -1468,57 +1469,31 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) return (error); } -#ifdef illumos int getzfsvfs(const char *dsname, zfsvfs_t **zfvp) { objset_t *os; + vfs_t *vfsp; int error; error = dmu_objset_hold(dsname, FTAG, &os); if (error != 0) return (error); - - error = getzfsvfs_impl(os, zfvp); + error = getzfsvfs_impl(os, &vfsp); dmu_objset_rele(os, FTAG); - return (error); -} - -#else - -static int -getzfsvfs_ref(const char *dsname, zfsvfs_t **zfvp) -{ - objset_t *os; - int error; - - error = dmu_objset_hold(dsname, FTAG, &os); if (error != 0) return (error); - error = getzfsvfs_impl(os, zfvp); - dmu_objset_rele(os, FTAG); - return (error); -} - -int -getzfsvfs(const char *dsname, zfsvfs_t **zfvp) -{ - objset_t *os; - int error; - - error = getzfsvfs_ref(dsname, zfvp); - if (error != 0) - return (error); - error = vfs_busy((*zfvp)->z_vfs, 0); - vfs_rel((*zfvp)->z_vfs); + error = vfs_busy(vfsp, 0); + vfs_rel(vfsp); if (error != 0) { *zfvp = NULL; error = SET_ERROR(ESRCH); + } else { + *zfvp = vfsp->vfs_data; } return (error); } -#endif /* * Find a zfsvfs_t for a mounted filesystem, or create our own, in which @@ -3597,7 +3572,7 @@ zfs_unmount_snap(const char *snapname) if (strchr(snapname, '@') == NULL) return; - int err = getzfsvfs_ref(snapname, &zfsvfs); + int err = getzfsvfs(snapname, &zfsvfs); if (err != 0) { ASSERT3P(zfsvfs, ==, NULL); return; @@ -3619,6 +3594,8 @@ zfs_unmount_snap(const char *snapname) #ifdef illumos (void) dounmount(vfsp, MS_FORCE, kcred); #else + vfs_ref(vfsp); + vfs_unbusy(vfsp); (void) dounmount(vfsp, MS_FORCE, curthread); #endif } From owner-svn-src-all@freebsd.org Thu Feb 22 13:32:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7064FF03617; Thu, 22 Feb 2018 13:32:33 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0155882795; Thu, 22 Feb 2018 13:32:33 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D615148C; Thu, 22 Feb 2018 13:32:32 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MDWWY1004580; Thu, 22 Feb 2018 13:32:32 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MDWVao004564; Thu, 22 Feb 2018 13:32:31 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802221332.w1MDWVao004564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 22 Feb 2018 13:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme X-SVN-Commit-Revision: 329824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 13:32:33 -0000 Author: wma Date: Thu Feb 22 13:32:31 2018 New Revision: 329824 URL: https://svnweb.freebsd.org/changeset/base/329824 Log: NVMe: Add big-endian support Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Modified: head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/wdc.c head/sys/cam/nvme/nvme_all.c head/sys/cam/nvme/nvme_da.c head/sys/conf/files head/sys/dev/mpr/mpr_sas.c head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_ctrlr_cmd.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/nvme/nvme_ns_cmd.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/devlist.c Thu Feb 22 13:32:31 2018 (r329824) @@ -54,8 +54,14 @@ devlist_usage(void) static inline uint32_t ns_get_sector_size(struct nvme_namespace_data *nsdata) { + uint8_t flbas_fmt, lbads; - return (1 << nsdata->lbaf[nsdata->flbas.format].lbads); + flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & + NVME_NS_DATA_FLBAS_FORMAT_MASK; + lbads = (nsdata->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & + NVME_NS_DATA_LBAF_LBADS_MASK; + + return (1 << lbads); } void Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/firmware.c Thu Feb 22 13:32:31 2018 (r329824) @@ -125,9 +125,9 @@ update_firmware(int fd, uint8_t *payload, int32_t payl memcpy(chunk, payload + off, size); memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD; - pt.cmd.cdw10 = (size / sizeof(uint32_t)) - 1; - pt.cmd.cdw11 = (off / sizeof(uint32_t)); + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD); + pt.cmd.cdw10 = htole32((size / sizeof(uint32_t)) - 1); + pt.cmd.cdw11 = htole32(off / sizeof(uint32_t)); pt.buf = chunk; pt.len = size; pt.is_read = 0; @@ -147,17 +147,21 @@ static int activate_firmware(int fd, int slot, int activate_action) { struct nvme_pt_command pt; + uint16_t sct, sc; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_FIRMWARE_ACTIVATE; - pt.cmd.cdw10 = (activate_action << 3) | slot; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_FIRMWARE_ACTIVATE); + pt.cmd.cdw10 = htole32((activate_action << 3) | slot); pt.is_read = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "firmware activate request failed"); - if (pt.cpl.status.sct == NVME_SCT_COMMAND_SPECIFIC && - pt.cpl.status.sc == NVME_SC_FIRMWARE_REQUIRES_RESET) + sct = NVME_STATUS_GET_SCT(pt.cpl.status); + sc = NVME_STATUS_GET_SC(pt.cpl.status); + + if (sct == NVME_SCT_COMMAND_SPECIFIC && + sc == NVME_SC_FIRMWARE_REQUIRES_RESET) return 1; if (nvme_completion_is_error(&pt.cpl)) @@ -180,16 +184,19 @@ firmware(int argc, char *argv[]) int fd = -1, slot = 0; int a_flag, s_flag, f_flag; int activate_action, reboot_required; - char ch, *p, *image = NULL; + int opt; + char *p, *image = NULL; char *controller = NULL, prompt[64]; void *buf = NULL; int32_t size = 0; + uint16_t oacs_fw; + uint8_t fw_slot1_ro, fw_num_slots; struct nvme_controller_data cdata; a_flag = s_flag = f_flag = false; - while ((ch = getopt(argc, argv, "af:s:")) != -1) { - switch (ch) { + while ((opt = getopt(argc, argv, "af:s:")) != -1) { + switch (opt) { case 'a': a_flag = true; break; @@ -243,17 +250,26 @@ firmware(int argc, char *argv[]) open_dev(controller, &fd, 1, 1); read_controller_data(fd, &cdata); - if (cdata.oacs.firmware == 0) + oacs_fw = (cdata.oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) & + NVME_CTRLR_DATA_OACS_FIRMWARE_MASK; + + if (oacs_fw == 0) errx(1, "controller does not support firmware activate/download"); - if (f_flag && slot == 1 && cdata.frmw.slot1_ro) + fw_slot1_ro = (cdata.frmw >> NVME_CTRLR_DATA_FRMW_SLOT1_RO_SHIFT) & + NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK; + + if (f_flag && slot == 1 && fw_slot1_ro) errx(1, "slot %d is marked as read only", slot); - if (slot > cdata.frmw.num_slots) + fw_num_slots = (cdata.frmw >> NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT) & + NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK; + + if (slot > fw_num_slots) errx(1, "slot %d specified but controller only supports %d slots", - slot, cdata.frmw.num_slots); + slot, fw_num_slots); if (a_flag && !f_flag && !slot_has_valid_firmware(fd, slot)) errx(1, Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/identify.c Thu Feb 22 13:32:31 2018 (r329824) @@ -47,7 +47,52 @@ print_controller(struct nvme_controller_data *cdata) { uint8_t str[128]; char cbuf[UINT128_DIG + 1]; + uint16_t oncs, oacs; + uint8_t compare, write_unc, dsm, vwc_present; + uint8_t security, fmt, fw, nsmgmt; + uint8_t fw_slot1_ro, fw_num_slots; + uint8_t ns_smart; + uint8_t sqes_max, sqes_min; + uint8_t cqes_max, cqes_min; + oncs = cdata->oncs; + compare = (oncs >> NVME_CTRLR_DATA_ONCS_COMPARE_SHIFT) & + NVME_CTRLR_DATA_ONCS_COMPARE_MASK; + write_unc = (oncs >> NVME_CTRLR_DATA_ONCS_WRITE_UNC_SHIFT) & + NVME_CTRLR_DATA_ONCS_WRITE_UNC_MASK; + dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) & + NVME_CTRLR_DATA_ONCS_DSM_MASK; + vwc_present = (cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) & + NVME_CTRLR_DATA_VWC_PRESENT_MASK; + + oacs = cdata->oacs; + security = (oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) & + NVME_CTRLR_DATA_OACS_SECURITY_MASK; + fmt = (oacs >> NVME_CTRLR_DATA_OACS_FORMAT_SHIFT) & + NVME_CTRLR_DATA_OACS_FORMAT_MASK; + fw = (oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) & + NVME_CTRLR_DATA_OACS_FIRMWARE_MASK; + nsmgmt = (oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) & + NVME_CTRLR_DATA_OACS_NSMGMT_MASK; + + fw_num_slots = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT) & + NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK; + fw_slot1_ro = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_SLOT1_RO_SHIFT) & + NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK; + + ns_smart = (cdata->lpa >> NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT) & + NVME_CTRLR_DATA_LPA_NS_SMART_MASK; + + sqes_min = (cdata->sqes >> NVME_CTRLR_DATA_SQES_MIN_SHIFT) & + NVME_CTRLR_DATA_SQES_MIN_MASK; + sqes_max = (cdata->sqes >> NVME_CTRLR_DATA_SQES_MAX_SHIFT) & + NVME_CTRLR_DATA_SQES_MAX_MASK; + + cqes_min = (cdata->cqes >> NVME_CTRLR_DATA_CQES_MIN_SHIFT) & + NVME_CTRLR_DATA_CQES_MIN_MASK; + cqes_max = (cdata->cqes >> NVME_CTRLR_DATA_CQES_MAX_SHIFT) & + NVME_CTRLR_DATA_CQES_MAX_MASK; + printf("Controller Capabilities/Features\n"); printf("================================\n"); printf("Vendor ID: %04x\n", cdata->vid); @@ -67,34 +112,34 @@ print_controller(struct nvme_controller_data *cdata) if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); + printf("%ld\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", - cdata->oacs.security ? "Supported" : "Not Supported"); + security ? "Supported" : "Not Supported"); printf("Format NVM: %s\n", - cdata->oacs.format ? "Supported" : "Not Supported"); + fmt ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", - cdata->oacs.firmware ? "Supported" : "Not Supported"); + fw ? "Supported" : "Not Supported"); printf("Namespace Managment: %s\n", - cdata->oacs.nsmgmt ? "Supported" : "Not Supported"); + nsmgmt ? "Supported" : "Not Supported"); printf("Abort Command Limit: %d\n", cdata->acl+1); printf("Async Event Request Limit: %d\n", cdata->aerl+1); printf("Number of Firmware Slots: "); - if (cdata->oacs.firmware != 0) - printf("%d\n", cdata->frmw.num_slots); + if (fw != 0) + printf("%d\n", fw_num_slots); else printf("N/A\n"); printf("Firmware Slot 1 Read-Only: "); - if (cdata->oacs.firmware != 0) - printf("%s\n", cdata->frmw.slot1_ro ? "Yes" : "No"); + if (fw != 0) + printf("%s\n", fw_slot1_ro ? "Yes" : "No"); else printf("N/A\n"); printf("Per-Namespace SMART Log: %s\n", - cdata->lpa.ns_smart ? "Yes" : "No"); + ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); @@ -102,22 +147,22 @@ print_controller(struct nvme_controller_data *cdata) printf("NVM Command Set Attributes\n"); printf("==========================\n"); printf("Submission Queue Entry Size\n"); - printf(" Max: %d\n", 1 << cdata->sqes.max); - printf(" Min: %d\n", 1 << cdata->sqes.min); + printf(" Max: %d\n", 1 << sqes_max); + printf(" Min: %d\n", 1 << sqes_min); printf("Completion Queue Entry Size\n"); - printf(" Max: %d\n", 1 << cdata->cqes.max); - printf(" Min: %d\n", 1 << cdata->cqes.min); + printf(" Max: %d\n", 1 << cqes_max); + printf(" Min: %d\n", 1 << cqes_min); printf("Number of Namespaces: %d\n", cdata->nn); printf("Compare Command: %s\n", - cdata->oncs.compare ? "Supported" : "Not Supported"); + compare ? "Supported" : "Not Supported"); printf("Write Uncorrectable Command: %s\n", - cdata->oncs.write_unc ? "Supported" : "Not Supported"); + write_unc ? "Supported" : "Not Supported"); printf("Dataset Management Command: %s\n", - cdata->oncs.dsm ? "Supported" : "Not Supported"); + dsm ? "Supported" : "Not Supported"); printf("Volatile Write Cache: %s\n", - cdata->vwc.present ? "Present" : "Not Present"); + vwc_present ? "Present" : "Not Present"); - if (cdata->oacs.nsmgmt) { + if (nsmgmt) { printf("\n"); printf("Namespace Drive Attributes\n"); printf("==========================\n"); @@ -132,7 +177,16 @@ static void print_namespace(struct nvme_namespace_data *nsdata) { uint32_t i; + uint32_t lbaf, lbads, ms; + uint8_t thin_prov; + uint8_t flbas_fmt; + thin_prov = (nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_THIN_PROV_SHIFT) & + NVME_NS_DATA_NSFEAT_THIN_PROV_MASK; + + flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & + NVME_NS_DATA_FLBAS_FORMAT_MASK; + printf("Size (in LBAs): %lld (%lldM)\n", (long long)nsdata->nsze, (long long)nsdata->nsze / 1024 / 1024); @@ -143,13 +197,18 @@ print_namespace(struct nvme_namespace_data *nsdata) (long long)nsdata->nuse, (long long)nsdata->nuse / 1024 / 1024); printf("Thin Provisioning: %s\n", - nsdata->nsfeat.thin_prov ? "Supported" : "Not Supported"); + thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); - printf("Current LBA Format: LBA Format #%02d\n", - nsdata->flbas.format); - for (i = 0; i <= nsdata->nlbaf; i++) + printf("Current LBA Format: LBA Format #%02d\n", flbas_fmt); + for (i = 0; i <= nsdata->nlbaf; i++) { + lbaf = nsdata->lbaf[i]; + lbads = (lbaf >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & + NVME_NS_DATA_LBAF_LBADS_MASK; + ms = (lbaf >> NVME_NS_DATA_LBAF_MS_SHIFT) & + NVME_NS_DATA_LBAF_MS_MASK; printf("LBA Format #%02d: Data Size: %5d Metadata Size: %5d\n", - i, 1 << nsdata->lbaf[i].lbads, nsdata->lbaf[i].ms); + i, 1 << lbads, ms); + } } static void Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/logpage.c Thu Feb 22 13:32:31 2018 (r329824) @@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if _BYTE_ORDER != _LITTLE_ENDIAN -#error "Code only works on little endian machines" -#endif - #include "nvmecontrol.h" #define DEFAULT_SIZE (4096) @@ -107,12 +103,15 @@ read_logpage(int fd, uint8_t log_page, int nsid, void uint32_t payload_size) { struct nvme_pt_command pt; + struct nvme_error_information_entry *err_entry; + int i, err_pages; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_GET_LOG_PAGE; - pt.cmd.nsid = nsid; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_GET_LOG_PAGE); + pt.cmd.nsid = htole32(nsid); pt.cmd.cdw10 = ((payload_size/sizeof(uint32_t)) - 1) << 16; pt.cmd.cdw10 |= log_page; + pt.cmd.cdw10 = htole32(pt.cmd.cdw10); pt.buf = payload; pt.len = payload_size; pt.is_read = 1; @@ -120,6 +119,30 @@ read_logpage(int fd, uint8_t log_page, int nsid, void if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "get log page request failed"); + /* Convert data to host endian */ + switch (log_page) { + case NVME_LOG_ERROR: + err_entry = (struct nvme_error_information_entry *)payload; + err_pages = payload_size / sizeof(struct nvme_error_information_entry); + for (i = 0; i < err_pages; i++) + nvme_error_information_entry_swapbytes(err_entry++); + break; + case NVME_LOG_HEALTH_INFORMATION: + nvme_health_information_page_swapbytes( + (struct nvme_health_information_page *)payload); + break; + case NVME_LOG_FIRMWARE_SLOT: + nvme_firmware_page_swapbytes( + (struct nvme_firmware_page *)payload); + break; + case INTEL_LOG_TEMP_STATS: + intel_log_temp_stats_swapbytes( + (struct intel_log_temp_stats *)payload); + break; + default: + break; + } + if (nvme_completion_is_error(&pt.cpl)) errx(1, "get log page request returned error"); } @@ -128,8 +151,9 @@ static void print_log_error(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { int i, nentries; + uint16_t status; + uint8_t p, sc, sct, m, dnr; struct nvme_error_information_entry *entry = buf; - struct nvme_status *status; printf("Error Information Log\n"); printf("=====================\n"); @@ -144,7 +168,14 @@ print_log_error(const struct nvme_controller_data *cda if (entry->error_count == 0) break; - status = &entry->status; + status = entry->status; + + p = NVME_STATUS_GET_P(status); + sc = NVME_STATUS_GET_SC(status); + sct = NVME_STATUS_GET_SCT(status); + m = NVME_STATUS_GET_M(status); + dnr = NVME_STATUS_GET_DNR(status); + printf("Entry %02d\n", i + 1); printf("=========\n"); printf(" Error count: %ju\n", entry->error_count); @@ -152,11 +183,11 @@ print_log_error(const struct nvme_controller_data *cda printf(" Command ID: %u\n", entry->cid); /* TODO: Export nvme_status_string structures from kernel? */ printf(" Status:\n"); - printf(" Phase tag: %d\n", status->p); - printf(" Status code: %d\n", status->sc); - printf(" Status code type: %d\n", status->sct); - printf(" More: %d\n", status->m); - printf(" DNR: %d\n", status->dnr); + printf(" Phase tag: %d\n", p); + printf(" Status code: %d\n", sc); + printf(" Status code type: %d\n", sct); + printf(" More: %d\n", m); + printf(" DNR: %d\n", dnr); printf(" Error location: %u\n", entry->error_location); printf(" LBA: %ju\n", entry->lba); printf(" Namespace ID: %u\n", entry->nsid); @@ -176,23 +207,25 @@ print_log_health(const struct nvme_controller_data *cd { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; + uint8_t warning; int i; + warning = health->critical_warning; + printf("SMART/Health Information Log\n"); printf("============================\n"); - printf("Critical Warning State: 0x%02x\n", - health->critical_warning.raw); + printf("Critical Warning State: 0x%02x\n", warning); printf(" Available spare: %d\n", - health->critical_warning.bits.available_spare); + !!(warning & NVME_CRIT_WARN_ST_AVAILABLE_SPARE)); printf(" Temperature: %d\n", - health->critical_warning.bits.temperature); + !!(warning & NVME_CRIT_WARN_ST_TEMPERATURE)); printf(" Device reliability: %d\n", - health->critical_warning.bits.device_reliability); + !!(warning & NVME_CRIT_WARN_ST_DEVICE_RELIABILITY)); printf(" Read only: %d\n", - health->critical_warning.bits.read_only); + !!(warning & NVME_CRIT_WARN_ST_READ_ONLY)); printf(" Volatile memory backup: %d\n", - health->critical_warning.bits.volatile_memory_backup); + !!(warning & NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP)); printf("Temperature: "); print_temp(health->temperature); printf("Available spare: %u\n", @@ -225,7 +258,7 @@ print_log_health(const struct nvme_controller_data *cd printf("Warning Temp Composite Time: %d\n", health->warning_temp_time); printf("Error Temp Composite Time: %d\n", health->error_temp_time); - for (i = 0; i < 7; i++) { + for (i = 0; i < 8; i++) { if (health->temp_sensor[i] == 0) continue; printf("Temperature Sensor %d: ", i + 1); @@ -234,23 +267,34 @@ print_log_health(const struct nvme_controller_data *cd } static void -print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) +print_log_firmware(const struct nvme_controller_data *cdata, void *buf, uint32_t size __unused) { int i, slots; const char *status; struct nvme_firmware_page *fw = buf; + uint8_t afi_slot; + uint16_t oacs_fw; + uint8_t fw_num_slots; + afi_slot = fw->afi >> NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT; + afi_slot &= NVME_FIRMWARE_PAGE_AFI_SLOT_MASK; + + oacs_fw = (cdata->oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) & + NVME_CTRLR_DATA_OACS_FIRMWARE_MASK; + fw_num_slots = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT) & + NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK; + printf("Firmware Slot Log\n"); printf("=================\n"); - if (cdata->oacs.firmware == 0) + if (oacs_fw == 0) slots = 1; else - slots = MIN(cdata->frmw.num_slots, MAX_FW_SLOTS); + slots = MIN(fw_num_slots, MAX_FW_SLOTS); for (i = 0; i < slots; i++) { printf("Slot %d: ", i + 1); - if (fw->afi.slot == i + 1) + if (afi_slot == i + 1) status = " Active"; else status = "Inactive"; @@ -868,7 +912,8 @@ logpage(int argc, char *argv[]) int fd, nsid; int log_page = 0, pageflag = false; int binflag = false, hexflag = false, ns_specified; - char ch, *p; + int opt; + char *p; char cname[64]; uint32_t size; void *buf; @@ -876,9 +921,10 @@ logpage(int argc, char *argv[]) struct logpage_function *f; struct nvme_controller_data cdata; print_fn_t print_fn; + uint8_t ns_smart; - while ((ch = getopt(argc, argv, "bp:xv:")) != -1) { - switch (ch) { + while ((opt = getopt(argc, argv, "bp:xv:")) != -1) { + switch (opt) { case 'b': binflag = true; break; @@ -928,6 +974,9 @@ logpage(int argc, char *argv[]) read_controller_data(fd, &cdata); + ns_smart = (cdata.lpa >> NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT) & + NVME_CTRLR_DATA_LPA_NS_SMART_MASK; + /* * The log page attribtues indicate whether or not the controller * supports the SMART/Health information log page on a per @@ -937,7 +986,7 @@ logpage(int argc, char *argv[]) if (log_page != NVME_LOG_HEALTH_INFORMATION) errx(1, "log page %d valid only at controller level", log_page); - if (cdata.lpa.ns_smart == 0) + if (ns_smart == 0) errx(1, "controller does not support per namespace " "smart/health information"); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/nvmecontrol.c Thu Feb 22 13:32:31 2018 (r329824) @@ -146,8 +146,8 @@ read_controller_data(int fd, struct nvme_controller_da struct nvme_pt_command pt; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_IDENTIFY; - pt.cmd.cdw10 = 1; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_IDENTIFY); + pt.cmd.cdw10 = htole32(1); pt.buf = cdata; pt.len = sizeof(*cdata); pt.is_read = 1; @@ -155,6 +155,9 @@ read_controller_data(int fd, struct nvme_controller_da if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "identify request failed"); + /* Convert data to host endian */ + nvme_controller_data_swapbytes(cdata); + if (nvme_completion_is_error(&pt.cpl)) errx(1, "identify request returned error"); } @@ -165,14 +168,17 @@ read_namespace_data(int fd, int nsid, struct nvme_name struct nvme_pt_command pt; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_IDENTIFY; - pt.cmd.nsid = nsid; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_IDENTIFY); + pt.cmd.nsid = htole32(nsid); pt.buf = nsdata; pt.len = sizeof(*nsdata); pt.is_read = 1; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "identify request failed"); + + /* Convert data to host endian */ + nvme_namespace_data_swapbytes(nsdata); if (nvme_completion_is_error(&pt.cpl)) errx(1, "identify request returned error"); Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/perftest.c Thu Feb 22 13:32:31 2018 (r329824) @@ -81,7 +81,7 @@ perftest(int argc, char *argv[]) { struct nvme_io_test io_test; int fd; - char ch; + int opt; char *p; u_long ioctl_cmd = NVME_IO_TEST; bool nflag, oflag, sflag, tflag; @@ -91,8 +91,8 @@ perftest(int argc, char *argv[]) memset(&io_test, 0, sizeof(io_test)); - while ((ch = getopt(argc, argv, "f:i:n:o:ps:t:")) != -1) { - switch (ch) { + while ((opt = getopt(argc, argv, "f:i:n:o:ps:t:")) != -1) { + switch (opt) { case 'f': if (!strcmp(optarg, "refthread")) io_test.flags |= NVME_TEST_FLAG_REFTHREAD; Modified: head/sbin/nvmecontrol/power.c ============================================================================== --- head/sbin/nvmecontrol/power.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/power.c Thu Feb 22 13:32:31 2018 (r329824) @@ -56,22 +56,32 @@ static void power_list_one(int i, struct nvme_power_state *nps) { int mpower, apower, ipower; + uint8_t mps, nops, aps, apw; + mps = (nps->mps_nops >> NVME_PWR_ST_MPS_SHIFT) & + NVME_PWR_ST_MPS_MASK; + nops = (nps->mps_nops >> NVME_PWR_ST_NOPS_SHIFT) & + NVME_PWR_ST_NOPS_MASK; + apw = (nps->apw_aps >> NVME_PWR_ST_APW_SHIFT) & + NVME_PWR_ST_APW_MASK; + aps = (nps->apw_aps >> NVME_PWR_ST_APS_SHIFT) & + NVME_PWR_ST_APS_MASK; + mpower = nps->mp; - if (nps->mps == 0) + if (mps == 0) mpower *= 100; ipower = nps->idlp; if (nps->ips == 1) ipower *= 100; apower = nps->actp; - if (nps->aps == 1) + if (aps == 1) apower *= 100; printf("%2d: %2d.%04dW%c %3d.%03dms %3d.%03dms %2d %2d %2d %2d %2d.%04dW %2d.%04dW %d\n", i, mpower / 10000, mpower % 10000, - nps->nops ? '*' : ' ', nps->enlat / 1000, nps->enlat % 1000, + nops ? '*' : ' ', nps->enlat / 1000, nps->enlat % 1000, nps->exlat / 1000, nps->exlat % 1000, nps->rrt, nps->rrl, nps->rwt, nps->rwl, ipower / 10000, ipower % 10000, - apower / 10000, apower % 10000, nps->apw); + apower / 10000, apower % 10000, apw); } static void @@ -94,9 +104,9 @@ power_set(int fd, int power_val, int workload, int per p = perm ? (1u << 31) : 0; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_SET_FEATURES; - pt.cmd.cdw10 = NVME_FEAT_POWER_MANAGEMENT | p; - pt.cmd.cdw11 = power_val | (workload << 5); + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_SET_FEATURES); + pt.cmd.cdw10 = htole32(NVME_FEAT_POWER_MANAGEMENT | p); + pt.cmd.cdw11 = htole32(power_val | (workload << 5)); if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "set feature power mgmt request failed"); @@ -111,8 +121,8 @@ power_show(int fd) struct nvme_pt_command pt; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = NVME_OPC_GET_FEATURES; - pt.cmd.cdw10 = NVME_FEAT_POWER_MANAGEMENT; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_GET_FEATURES); + pt.cmd.cdw10 = htole32(NVME_FEAT_POWER_MANAGEMENT); if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(1, "set feature power mgmt request failed"); Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sbin/nvmecontrol/wdc.c Thu Feb 22 13:32:31 2018 (r329824) @@ -81,10 +81,10 @@ wdc_get_data(int fd, uint32_t opcode, uint32_t len, ui struct nvme_pt_command pt; memset(&pt, 0, sizeof(pt)); - pt.cmd.opc = opcode; - pt.cmd.cdw10 = len / sizeof(uint32_t); /* - 1 like all the others ??? */ - pt.cmd.cdw11 = off / sizeof(uint32_t); - pt.cmd.cdw12 = cmd; + pt.cmd.opc_fuse = NVME_CMD_SET_OPC(opcode); + pt.cmd.cdw10 = htole32(len / sizeof(uint32_t)); /* - 1 like all the others ??? */ + pt.cmd.cdw11 = htole32(off / sizeof(uint32_t)); + pt.cmd.cdw12 = htole32(cmd); pt.buf = buffer; pt.len = buflen; pt.is_read = 1; Modified: head/sys/cam/nvme/nvme_all.c ============================================================================== --- head/sys/cam/nvme/nvme_all.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/cam/nvme/nvme_all.c Thu Feb 22 13:32:31 2018 (r329824) @@ -70,14 +70,14 @@ nvme_ns_cmd(struct ccb_nvmeio *nvmeio, uint8_t cmd, ui uint32_t cdw14, uint32_t cdw15) { bzero(&nvmeio->cmd, sizeof(struct nvme_command)); - nvmeio->cmd.opc = cmd; - nvmeio->cmd.nsid = nsid; - nvmeio->cmd.cdw10 = cdw10; - nvmeio->cmd.cdw11 = cdw11; - nvmeio->cmd.cdw12 = cdw12; - nvmeio->cmd.cdw13 = cdw13; - nvmeio->cmd.cdw14 = cdw14; - nvmeio->cmd.cdw15 = cdw15; + nvmeio->cmd.opc_fuse = NVME_CMD_SET_OPC(cmd); + nvmeio->cmd.nsid = htole32(nsid); + nvmeio->cmd.cdw10 = htole32(cdw10); + nvmeio->cmd.cdw11 = htole32(cdw11); + nvmeio->cmd.cdw12 = htole32(cdw12); + nvmeio->cmd.cdw13 = htole32(cdw13); + nvmeio->cmd.cdw14 = htole32(cdw14); + nvmeio->cmd.cdw15 = htole32(cdw15); } int @@ -118,24 +118,32 @@ nvme_opc2str[] = { const char * nvme_op_string(const struct nvme_command *cmd) { - if (cmd->opc > nitems(nvme_opc2str)) + uint8_t opc; + + opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK; + if (opc > nitems(nvme_opc2str)) return "UNKNOWN"; - return nvme_opc2str[cmd->opc]; + return nvme_opc2str[opc]; } const char * nvme_cmd_string(const struct nvme_command *cmd, char *cmd_string, size_t len) { + uint8_t opc, fuse; + + opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK; + fuse = (cmd->opc_fuse >> NVME_CMD_FUSE_SHIFT) & NVME_CMD_FUSE_MASK; /* * cid, rsvd areas and mptr not printed, since they are used * only internally by the SIM. */ snprintf(cmd_string, len, "opc=%x fuse=%x nsid=%x prp1=%llx prp2=%llx cdw=%x %x %x %x %x %x", - cmd->opc, cmd->fuse, cmd->nsid, + opc, fuse, cmd->nsid, (unsigned long long)cmd->prp1, (unsigned long long)cmd->prp2, - cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, cmd->cdw15); + cmd->cdw10, cmd->cdw11, cmd->cdw12, + cmd->cdw13, cmd->cdw14, cmd->cdw15); return cmd_string; } Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/cam/nvme/nvme_da.c Thu Feb 22 13:32:31 2018 (r329824) @@ -676,6 +676,7 @@ ndaregister(struct cam_periph *periph, void *arg) const struct nvme_namespace_data *nsd; const struct nvme_controller_data *cd; char announce_buf[80]; + uint8_t flbas_fmt, lbads, vwc_present; u_int maxio; int quirks; @@ -744,13 +745,19 @@ ndaregister(struct cam_periph *periph, void *arg) else if (maxio > MAXPHYS) maxio = MAXPHYS; /* for safety */ disk->d_maxsize = maxio; - disk->d_sectorsize = 1 << nsd->lbaf[nsd->flbas.format].lbads; + flbas_fmt = (nsd->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & + NVME_NS_DATA_FLBAS_FORMAT_MASK; + lbads = (nsd->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & + NVME_NS_DATA_LBAF_LBADS_MASK; + disk->d_sectorsize = 1 << lbads; disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze); disk->d_delmaxsize = disk->d_mediasize; disk->d_flags = DISKFLAG_DIRECT_COMPLETION; // if (cd->oncs.dsm) // XXX broken? disk->d_flags |= DISKFLAG_CANDELETE; - if (cd->vwc.present) + vwc_present = (cd->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) & + NVME_CTRLR_DATA_VWC_PRESENT_MASK; + if (vwc_present) disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((cpi.hba_misc & PIM_UNMAPPED) != 0) { disk->d_flags |= DISKFLAG_UNMAPPED_BIO; @@ -905,9 +912,9 @@ ndastart(struct cam_periph *periph, union ccb *start_c return; } dsm_range->length = - bp->bio_bcount / softc->disk->d_sectorsize; + htole32(bp->bio_bcount / softc->disk->d_sectorsize); dsm_range->starting_lba = - bp->bio_offset / softc->disk->d_sectorsize; + htole64(bp->bio_offset / softc->disk->d_sectorsize); bp->bio_driver2 = dsm_range; nda_nvme_trim(softc, &start_ccb->nvmeio, dsm_range, 1); start_ccb->ccb_h.ccb_state = NDA_CCB_TRIM; Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/conf/files Thu Feb 22 13:32:31 2018 (r329824) @@ -2535,6 +2535,17 @@ dev/nmdm/nmdm.c optional nmdm dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp pccard dev/null/null.c standard +dev/nvd/nvd.c optional nvd nvme +dev/nvme/nvme.c optional nvme +dev/nvme/nvme_ctrlr.c optional nvme +dev/nvme/nvme_ctrlr_cmd.c optional nvme +dev/nvme/nvme_ns.c optional nvme +dev/nvme/nvme_ns_cmd.c optional nvme +dev/nvme/nvme_qpair.c optional nvme +dev/nvme/nvme_sim.c optional nvme scbus +dev/nvme/nvme_sysctl.c optional nvme +dev/nvme/nvme_test.c optional nvme +dev/nvme/nvme_util.c optional nvme dev/oce/oce_hw.c optional oce pci dev/oce/oce_if.c optional oce pci dev/oce/oce_mbox.c optional oce pci Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/dev/mpr/mpr_sas.c Thu Feb 22 13:32:31 2018 (r329824) @@ -1839,7 +1839,7 @@ mprsas_build_nvme_unmap(struct mpr_softc *sc, struct m /* Build NVMe DSM command */ c = (struct nvme_command *) req->NVMe_Command; - c->opc = NVME_OPC_DATASET_MANAGEMENT; + c->opc_fuse = NVME_CMD_SET_OPC(NVME_OPC_DATASET_MANAGEMENT); c->nsid = htole32(csio->ccb_h.target_lun + 1); c->cdw10 = htole32(ndesc - 1); c->cdw11 = htole32(NVME_DSM_ATTR_DEALLOCATE); @@ -2263,22 +2263,26 @@ mpr_sc_failed_io_info(struct mpr_softc *sc, struct ccb * Returns appropriate scsi_status */ static u8 -mprsas_nvme_trans_status_code(struct nvme_status nvme_status, +mprsas_nvme_trans_status_code(uint16_t nvme_status, struct mpr_command *cm) { u8 status = MPI2_SCSI_STATUS_GOOD; int skey, asc, ascq; union ccb *ccb = cm->cm_complete_data; int returned_sense_len; + uint8_t sct, sc; + sct = NVME_STATUS_GET_SCT(nvme_status); + sc = NVME_STATUS_GET_SC(nvme_status); + status = MPI2_SCSI_STATUS_CHECK_CONDITION; skey = SSD_KEY_ILLEGAL_REQUEST; asc = SCSI_ASC_NO_SENSE; ascq = SCSI_ASCQ_CAUSE_NOT_REPORTABLE; - switch (nvme_status.sct) { + switch (sct) { case NVME_SCT_GENERIC: - switch (nvme_status.sc) { + switch (sc) { case NVME_SC_SUCCESS: status = MPI2_SCSI_STATUS_GOOD; skey = SSD_KEY_NO_SENSE; @@ -2351,7 +2355,7 @@ mprsas_nvme_trans_status_code(struct nvme_status nvme_ } break; case NVME_SCT_COMMAND_SPECIFIC: - switch (nvme_status.sc) { + switch (sc) { case NVME_SC_INVALID_FORMAT: status = MPI2_SCSI_STATUS_CHECK_CONDITION; skey = SSD_KEY_ILLEGAL_REQUEST; @@ -2367,7 +2371,7 @@ mprsas_nvme_trans_status_code(struct nvme_status nvme_ } break; case NVME_SCT_MEDIA_ERROR: - switch (nvme_status.sc) { + switch (sc) { case NVME_SC_WRITE_FAULTS: status = MPI2_SCSI_STATUS_CHECK_CONDITION; skey = SSD_KEY_MEDIUM_ERROR; Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/dev/nvme/nvme.c Thu Feb 22 13:32:31 2018 (r329824) @@ -222,23 +222,38 @@ nvme_modevent(module_t mod, int type, void *arg) void nvme_dump_command(struct nvme_command *cmd) { + uint8_t opc, fuse; + + opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK; + fuse = (cmd->opc_fuse >> NVME_CMD_FUSE_SHIFT) & NVME_CMD_FUSE_MASK; + printf( -"opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx cdw:%x %x %x %x %x %x\n", - cmd->opc, cmd->fuse, cmd->rsvd1, cmd->cid, cmd->nsid, +"opc:%x f:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx cdw:%x %x %x %x %x %x\n", + opc, fuse, cmd->cid, le32toh(cmd->nsid), cmd->rsvd2, cmd->rsvd3, - (uintmax_t)cmd->mptr, (uintmax_t)cmd->prp1, (uintmax_t)cmd->prp2, - cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, - cmd->cdw15); + (uintmax_t)le64toh(cmd->mptr), (uintmax_t)le64toh(cmd->prp1), (uintmax_t)le64toh(cmd->prp2), + le32toh(cmd->cdw10), le32toh(cmd->cdw11), le32toh(cmd->cdw12), + le32toh(cmd->cdw13), le32toh(cmd->cdw14), le32toh(cmd->cdw15)); } void nvme_dump_completion(struct nvme_completion *cpl) { + uint8_t p, sc, sct, m, dnr; + uint16_t status; + + status = le16toh(cpl->status); + + p = NVME_STATUS_GET_P(status); + sc = NVME_STATUS_GET_SC(status); + sct = NVME_STATUS_GET_SCT(status); + m = NVME_STATUS_GET_M(status); + dnr = NVME_STATUS_GET_DNR(status); + printf("cdw0:%08x sqhd:%04x sqid:%04x " "cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n", - cpl->cdw0, cpl->sqhd, cpl->sqid, - cpl->cid, cpl->status.p, cpl->status.sc, cpl->status.sct, - cpl->status.m, cpl->status.dnr); + le32toh(cpl->cdw0), le16toh(cpl->sqhd), le16toh(cpl->sqid), + cpl->cid, p, sc, sct, m, dnr); } static int Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Thu Feb 22 13:06:27 2018 (r329823) +++ head/sys/dev/nvme/nvme.h Thu Feb 22 13:32:31 2018 (r329824) @@ -36,6 +36,7 @@ #endif #include +#include #define NVME_PASSTHROUGH_CMD _IOWR('n', 0, struct nvme_pt_command) #define NVME_RESET_CONTROLLER _IO('n', 1) @@ -59,153 +60,264 @@ /* Cap nvme to 1MB transfers driver explodes with larger sizes */ #define NVME_MAX_XFER_SIZE (MAXPHYS < (1<<20) ? MAXPHYS : (1<<20)) -union cap_lo_register { - uint32_t raw; - struct { - /** maximum queue entries supported */ - uint32_t mqes : 16; +/* Register field definitions */ +#define NVME_CAP_LO_REG_MQES_SHIFT (0) +#define NVME_CAP_LO_REG_MQES_MASK (0xFFFF) +#define NVME_CAP_LO_REG_CQR_SHIFT (16) +#define NVME_CAP_LO_REG_CQR_MASK (0x1) +#define NVME_CAP_LO_REG_AMS_SHIFT (17) +#define NVME_CAP_LO_REG_AMS_MASK (0x3) +#define NVME_CAP_LO_REG_TO_SHIFT (24) +#define NVME_CAP_LO_REG_TO_MASK (0xFF) - /** contiguous queues required */ - uint32_t cqr : 1; +#define NVME_CAP_HI_REG_DSTRD_SHIFT (0) +#define NVME_CAP_HI_REG_DSTRD_MASK (0xF) +#define NVME_CAP_HI_REG_CSS_NVM_SHIFT (5) +#define NVME_CAP_HI_REG_CSS_NVM_MASK (0x1) +#define NVME_CAP_HI_REG_MPSMIN_SHIFT (16) +#define NVME_CAP_HI_REG_MPSMIN_MASK (0xF) +#define NVME_CAP_HI_REG_MPSMAX_SHIFT (20) +#define NVME_CAP_HI_REG_MPSMAX_MASK (0xF) - /** arbitration mechanism supported */ - uint32_t ams : 2; +#define NVME_CC_REG_EN_SHIFT (0) +#define NVME_CC_REG_EN_MASK (0x1) +#define NVME_CC_REG_CSS_SHIFT (4) +#define NVME_CC_REG_CSS_MASK (0x7) +#define NVME_CC_REG_MPS_SHIFT (7) +#define NVME_CC_REG_MPS_MASK (0xF) +#define NVME_CC_REG_AMS_SHIFT (11) +#define NVME_CC_REG_AMS_MASK (0x7) +#define NVME_CC_REG_SHN_SHIFT (14) +#define NVME_CC_REG_SHN_MASK (0x3) +#define NVME_CC_REG_IOSQES_SHIFT (16) +#define NVME_CC_REG_IOSQES_MASK (0xF) +#define NVME_CC_REG_IOCQES_SHIFT (20) +#define NVME_CC_REG_IOCQES_MASK (0xF) - uint32_t reserved1 : 5; +#define NVME_CSTS_REG_RDY_SHIFT (0) +#define NVME_CSTS_REG_RDY_MASK (0x1) +#define NVME_CSTS_REG_CFS_SHIFT (1) +#define NVME_CSTS_REG_CFS_MASK (0x1) +#define NVME_CSTS_REG_SHST_SHIFT (2) +#define NVME_CSTS_REG_SHST_MASK (0x3) - /** timeout */ - uint32_t to : 8; - } bits __packed; -} __packed; +#define NVME_CSTS_GET_SHST(csts) (((csts) >> NVME_CSTS_REG_SHST_SHIFT) & NVME_CSTS_REG_SHST_MASK) -_Static_assert(sizeof(union cap_lo_register) == 4, "bad size for cap_lo_register"); +#define NVME_AQA_REG_ASQS_SHIFT (0) +#define NVME_AQA_REG_ASQS_MASK (0xFFF) +#define NVME_AQA_REG_ACQS_SHIFT (16) +#define NVME_AQA_REG_ACQS_MASK (0xFFF) -union cap_hi_register { - uint32_t raw; - struct { - /** doorbell stride */ - uint32_t dstrd : 4; +/* Command field definitions */ - uint32_t reserved3 : 1; +#define NVME_CMD_OPC_SHIFT (0) +#define NVME_CMD_OPC_MASK (0xFF) +#define NVME_CMD_FUSE_SHIFT (8) +#define NVME_CMD_FUSE_MASK (0x3) - /** command sets supported */ - uint32_t css_nvm : 1; +#define NVME_CMD_SET_OPC(opc) (htole16(((opc) & NVME_CMD_OPC_MASK) << NVME_CMD_OPC_SHIFT)) - uint32_t css_reserved : 3; - uint32_t reserved2 : 7; +#define NVME_STATUS_P_SHIFT (0) +#define NVME_STATUS_P_MASK (0x1) +#define NVME_STATUS_SC_SHIFT (1) +#define NVME_STATUS_SC_MASK (0xFF) +#define NVME_STATUS_SCT_SHIFT (9) +#define NVME_STATUS_SCT_MASK (0x7) +#define NVME_STATUS_M_SHIFT (14) +#define NVME_STATUS_M_MASK (0x1) +#define NVME_STATUS_DNR_SHIFT (15) +#define NVME_STATUS_DNR_MASK (0x1) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Feb 22 14:38:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93546F093C6; Thu, 22 Feb 2018 14:38:07 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAA318676F; Thu, 22 Feb 2018 14:38:06 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1MEc45x091594; Thu, 22 Feb 2018 06:38:04 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1MEc4am091593; Thu, 22 Feb 2018 06:38:04 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802221438.w1MEc4am091593@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329817 - in head/etc: . rc.d In-Reply-To: <201802220825.w1M8PeqT049430@repo.freebsd.org> To: Marcelo Araujo Date: Thu, 22 Feb 2018 06:38:04 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 14:38:07 -0000 > Author: araujo > Date: Thu Feb 22 08:25:39 2018 > New Revision: 329817 > URL: https://svnweb.freebsd.org/changeset/base/329817 > > Log: > The firewall_type is ignored if not set in rc.conf or rc.conf.local, > after r190575 there is an option to call rc.firewall with the firewall_type > passed in as an argument. > > Submitted by: David P. Discher > MFC after: 3 weeks. > Sponsored by: iXsystems Inc. > Differential Revision: https://reviews.freebsd.org/D14286 > > Modified: > head/etc/rc.d/ipfw > head/etc/rc.firewall > > Modified: head/etc/rc.d/ipfw > ============================================================================== > --- head/etc/rc.d/ipfw Thu Feb 22 05:44:00 2018 (r329816) > +++ head/etc/rc.d/ipfw Thu Feb 22 08:25:39 2018 (r329817) > @@ -40,7 +40,11 @@ ipfw_start() > { > local _firewall_type > > - _firewall_type=$1 > + if [ -n "${1}" ]; then > + _firewall_type=$1 > + else > + _firewall_type=${firewall_type} > + fi > > # set the firewall rules script if none was specified > [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall > > Modified: head/etc/rc.firewall > ============================================================================== > --- head/etc/rc.firewall Thu Feb 22 05:44:00 2018 (r329816) > +++ head/etc/rc.firewall Thu Feb 22 08:25:39 2018 (r329817) > @@ -112,12 +112,20 @@ setup_ipv6_mandatory() { > ${fwcmd} add pass ipv6-icmp from any to any icmp6types 2,135,136 > } > > +. /etc/rc.subr > +. /etc/network.subr > + > if [ -n "${1}" ]; then > firewall_type="${1}" > fi > +if [ -z "${firewall_rc_config_load}" ]; then > + load_rc_config ipfw > +else > + for i in ${firewall_rc_config_load}; do > + load_rc_config $i > + done > +fi There is no documentation of firewall_rc_config_load. > -. /etc/rc.subr > -. /etc/network.subr > afexists inet6 > ipv6_available=$? -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Feb 22 15:16:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03A09F0DE06; Thu, 22 Feb 2018 15:16:28 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb0-x230.google.com (mail-yb0-x230.google.com [IPv6:2607:f8b0:4002:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86D92683C1; Thu, 22 Feb 2018 15:16:27 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb0-x230.google.com with SMTP id z90-v6so1825066ybh.11; Thu, 22 Feb 2018 07:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vBy4nccERfeaVPANgnaPwQuFqw38H3iVW5T3oGgre9I=; b=UyllqCL6lrJfjc6AEIrTyJhyJbjudaLSy/F8IZWK8yjtb3ALkQem9S9jZUBWO3yXLN Cs1kxMtVOZlsAnwn2GwIpTJI9HmX/bokrxnC17zvRsSVSDdy18b04wTctcU4IU5aL94l RtCHMzWzDEDkHLM6zaK5H/Lux6D/uv0WXEAJBazzqP67SZisTJfAyRmJeRNZ6TmAe/6t H6e+dfm9svpXNtqDLun85QEnzjdmAavF5vV8lFOLLSllmgHJ6bO+oIDU9GvC+1MxNVmG 5kqidU602pVZo4p2TncZ/6vAUK3Nd2NfPe9Qb4+MBgkrYfZadNjiRCZ3HrZOP+nm13sO /LoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vBy4nccERfeaVPANgnaPwQuFqw38H3iVW5T3oGgre9I=; b=b/uoNz3qFee4s/fdK5tj4l3kAg7TbzbdJh7bVeU5Sibmc0HfITEJMjj9HlP/l3SmSB xICr/Se53YarnbSDx1CZIV+sPGUSc1ypX7F3CMJRJCkLDdrrUqUfVLdhuPQIgLH/0ubS T51uNzqf/Zz9AZflyiIfLcN12Frw0X0oGn8UdHhxK0lADPkx2ZT58LrS28YFZH3OtTFX cHPgjzb6o0BzGsim+U6PSQIUQdHRcxwq3PIQcs7XiF8rWKE2yd2z+/nqNvYHaCIcv75Y 7rFo/z4Kf1OF16iOf2KXcImeK07HYz99GVsSFCaw4IWyV/PDXdQd5j4wjQbXYUUWoiTN g66w== X-Gm-Message-State: APf1xPCZGPwi9glVJb86pVAwbaWj6dWRKM66wn9SssdQiYBxKy9S6tsJ q8NHzAi99CAYDhtJetwJYyLqxB4N X-Google-Smtp-Source: AH8x226y3GJoM7ITfVWSVyxvp3N5S4cdVNxx6NT61B4NMyx/zfshcMVtjqEnQuFwsdoXrb6wcJIPGA== X-Received: by 2002:a25:1907:: with SMTP id 7-v6mr4909911ybz.129.1519312586761; Thu, 22 Feb 2018 07:16:26 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.164.17.129]) by smtp.gmail.com with ESMTPSA id c207sm111861ywa.96.2018.02.22.07.16.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 07:16:26 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r329795 - in vendor-sys/illumos/dist/uts/common: fs/zfs fs/zfs/sys sys/fs To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org References: <201802220225.w1M2P9Un068350@repo.freebsd.org> <68dd6e31-9616-2190-544a-82b400d81370@FreeBSD.org> From: Alexander Motin Message-ID: <796c1f47-76e3-ac2d-ba32-e5544c1e40a5@FreeBSD.org> Date: Thu, 22 Feb 2018 10:16:24 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <68dd6e31-9616-2190-544a-82b400d81370@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 15:16:28 -0000 On 22.02.2018 02:16, Andriy Gapon wrote: > On 22/02/2018 04:25, Alexander Motin wrote: >> Author: mav >> Date: Thu Feb 22 02:25:09 2018 >> New Revision: 329795 >> URL: https://svnweb.freebsd.org/changeset/base/329795 >> >> Log: >> r329793 | mav | 2018-02-22 04:21:03 +0200 (чт, 22 февр. 2018) | 58 lines >> >> 9075 Improve ZFS pool import/load process and corrupted pool recovery >> >> illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1 > > This commit message looks strange. It does. I'm sorry. r329793 and r329795 were supposed to be a single commit into two vendor repos, but then I made mistake, committing to only one of them, and then made one more in copy/paste while fixing the first. Into the head the change went properly as one commit. -- Alexander Motin From owner-svn-src-all@freebsd.org Thu Feb 22 15:28:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79B4EF0ED0E; Thu, 22 Feb 2018 15:28:19 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 2293168B71; Thu, 22 Feb 2018 15:28:18 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:ada6:8e98:af77:e4cf] (unknown [IPv6:2001:630:212:2a8:ada6:8e98:af77:e4cf]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id E56B34EBDA; Thu, 22 Feb 2018 15:27:40 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r329822 - head/sbin From: Andrew Turner In-Reply-To: <201802221231.w1MCVS7D070694@repo.freebsd.org> Date: Thu, 22 Feb 2018 15:27:39 +0000 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <3C2620CD-D21E-41FB-BF9A-BE051D677113@fubar.geek.nz> References: <201802221231.w1MCVS7D070694@repo.freebsd.org> To: Wojciech Macek X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 15:28:19 -0000 This commit message is missing why these are needed on powerpc, e.g. why = aren=E2=80=99t you able to use gpart. Andrew > On 22 Feb 2018, at 12:31, Wojciech Macek wrote: >=20 > Author: wma > Date: Thu Feb 22 12:31:28 2018 > New Revision: 329822 > URL: https://svnweb.freebsd.org/changeset/base/329822 >=20 > Log: > Add bsdlabel and fdisk to powerpc64 >=20 > Submitted by: Wojciech Macek > Obtained from: Semihalf > Sponsored by: IBM, QCM Technologies >=20 > Added: > head/sbin/Makefile.powerpc64 (contents, props changed) >=20 > Added: head/sbin/Makefile.powerpc64 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sbin/Makefile.powerpc64 Thu Feb 22 12:31:28 2018 = (r329822) > @@ -0,0 +1,4 @@ > +# $FreeBSD$ > + > +SUBDIR +=3D bsdlabel > +SUBDIR +=3D fdisk >=20 From owner-svn-src-all@freebsd.org Thu Feb 22 15:29:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2905F0EE61; Thu, 22 Feb 2018 15:29:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A087368D5F; Thu, 22 Feb 2018 15:29:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E9D11681; Thu, 22 Feb 2018 15:29:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MFTKOd062452; Thu, 22 Feb 2018 15:29:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MFTJJh062446; Thu, 22 Feb 2018 15:29:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802221529.w1MFTJJh062446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Feb 2018 15:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329825 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 329825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 15:29:21 -0000 Author: hselasky Date: Thu Feb 22 15:29:19 2018 New Revision: 329825 URL: https://svnweb.freebsd.org/changeset/base/329825 Log: Return correct error code to user-space when a system call receives a signal in the LinuxKPI. The read(), write() and mmap() system calls can return either EINTR or ERESTART upon receiving a signal. Add code to figure out the correct return value by temporarily storing the return code from the relevant FreeBSD kernel APIs in the Linux task structure. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h head/sys/compat/linuxkpi/common/include/linux/rwsem.h head/sys/compat/linuxkpi/common/include/linux/sched.h head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/linuxkpi/common/src/linux_lock.c head/sys/compat/linuxkpi/common/src/linux_schedule.c Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mutex.h Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/include/linux/mutex.h Thu Feb 22 15:29:19 2018 (r329825) @@ -63,7 +63,7 @@ typedef struct mutex { #define mutex_lock_interruptible(_m) ({ \ MUTEX_SKIP() ? 0 : \ - (sx_xlock_sig(&(_m)->sx) ? -EINTR : 0); \ + linux_mutex_lock_interruptible(_m); \ }) #define mutex_unlock(_m) do { \ @@ -142,5 +142,7 @@ linux_mutex_destroy(mutex_t *m) mutex_unlock(m); sx_destroy(&m->sx); } + +extern int linux_mutex_lock_interruptible(mutex_t *m); #endif /* _LINUX_MUTEX_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/rwsem.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rwsem.h Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/include/linux/rwsem.h Thu Feb 22 15:29:19 2018 (r329825) @@ -47,7 +47,7 @@ struct rw_semaphore { #define up_read(_rw) sx_sunlock(&(_rw)->sx) #define down_read_trylock(_rw) !!sx_try_slock(&(_rw)->sx) #define down_write_trylock(_rw) !!sx_try_xlock(&(_rw)->sx) -#define down_write_killable(_rw) !!sx_xlock_sig(&(_rw)->sx) +#define down_write_killable(_rw) linux_down_write_killable(_rw) #define downgrade_write(_rw) sx_downgrade(&(_rw)->sx) #define down_read_nested(_rw, _sc) down_read(_rw) #define init_rwsem(_rw) linux_init_rwsem(_rw, rwsem_name("lnxrwsem")) @@ -78,5 +78,7 @@ linux_init_rwsem(struct rw_semaphore *rw, const char * memset(rw, 0, sizeof(*rw)); sx_init_flags(&rw->sx, name, SX_NOWITNESS); } + +extern int linux_down_write_killable(struct rw_semaphore *); #endif /* _LINUX_RWSEM_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Thu Feb 22 15:29:19 2018 (r329825) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ struct task_struct { struct completion exited; TAILQ_ENTRY(task_struct) rcu_entry; int rcu_recurse; + int bsd_interrupt_value; }; #define current ({ \ @@ -127,11 +128,25 @@ void linux_send_sig(int signo, struct task_struct *tas #define signal_pending_state(state, task) \ linux_signal_pending_state(state, task) #define send_sig(signo, task, priv) do { \ - CTASSERT(priv == 0); \ + CTASSERT((priv) == 0); \ linux_send_sig(signo, task); \ } while (0) int linux_schedule_timeout(int timeout); + +static inline void +linux_schedule_save_interrupt_value(struct task_struct *task, int value) +{ + task->bsd_interrupt_value = value; +} + +static inline int +linux_schedule_get_interrupt_value(struct task_struct *task) +{ + int value = task->bsd_interrupt_value; + task->bsd_interrupt_value = 0; + return (value); +} #define schedule() \ (void)linux_schedule_timeout(MAX_SCHEDULE_TIMEOUT) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Feb 22 15:29:19 2018 (r329825) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -828,10 +828,27 @@ linux_access_ok(int rw, const void *uaddr, size_t len) (eaddr > saddr && eaddr <= VM_MAXUSER_ADDRESS)); } +/* + * This function should return either EINTR or ERESTART depending on + * the signal type sent to this thread: + */ static int +linux_get_error(struct task_struct *task, int error) +{ + /* check for signal type interrupt code */ + if (error == EINTR || error == ERESTARTSYS || error == ERESTART) { + error = -linux_schedule_get_interrupt_value(task); + if (error == 0) + error = EINTR; + } + return (error); +} + +static int linux_file_ioctl_sub(struct file *fp, struct linux_file *filp, u_long cmd, caddr_t data, struct thread *td) { + struct task_struct *task = current; unsigned size; int error; @@ -844,8 +861,8 @@ linux_file_ioctl_sub(struct file *fp, struct linux_fil * Background: Linux code expects a user-space address * while FreeBSD supplies a kernel-space address. */ - current->bsd_ioctl_data = data; - current->bsd_ioctl_len = size; + task->bsd_ioctl_data = data; + task->bsd_ioctl_len = size; data = (void *)LINUX_IOCTL_MIN_PTR; } else { /* fetch user-space pointer */ @@ -869,16 +886,17 @@ linux_file_ioctl_sub(struct file *fp, struct linux_fil else error = ENOTTY; if (size > 0) { - current->bsd_ioctl_data = NULL; - current->bsd_ioctl_len = 0; + task->bsd_ioctl_data = NULL; + task->bsd_ioctl_len = 0; } if (error == EWOULDBLOCK) { /* update kqfilter status, if any */ linux_file_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_READ | LINUX_KQ_FLAG_HAS_WRITE); - } else if (error == ERESTARTSYS) - error = ERESTART; + } else { + error = linux_get_error(task, error); + } return (error); } @@ -1111,6 +1129,7 @@ linux_file_mmap_single(struct file *fp, vm_ooffset_t * vm_size_t size, struct vm_object **object, int nprot, struct thread *td) { + struct task_struct *task; struct vm_area_struct *vmap; struct mm_struct *mm; struct linux_file *filp; @@ -1132,7 +1151,8 @@ linux_file_mmap_single(struct file *fp, vm_ooffset_t * * The atomic reference below makes sure the mm_struct is * available as long as the vmap is in the linux_vma_head. */ - mm = current->mm; + task = current; + mm = task->mm; if (atomic_inc_not_zero(&mm->mm_users) == 0) return (EINVAL); @@ -1147,11 +1167,10 @@ linux_file_mmap_single(struct file *fp, vm_ooffset_t * vmap->vm_mm = mm; if (unlikely(down_write_killable(&vmap->vm_mm->mmap_sem))) { - error = EINTR; + error = linux_get_error(task, EINTR); } else { error = -OPW(fp, td, filp->f_op->mmap(filp, vmap)); - if (error == ERESTARTSYS) - error = ERESTART; + error = linux_get_error(task, error); up_write(&vmap->vm_mm->mmap_sem); } @@ -1290,9 +1309,7 @@ linux_file_read(struct file *file, struct uio *uio, st uio->uio_iov->iov_len -= bytes; uio->uio_resid -= bytes; } else { - error = -bytes; - if (error == ERESTARTSYS) - error = ERESTART; + error = linux_get_error(current, -bytes); } } else error = ENXIO; @@ -1329,9 +1346,7 @@ linux_file_write(struct file *file, struct uio *uio, s uio->uio_iov->iov_len -= bytes; uio->uio_resid -= bytes; } else { - error = -bytes; - if (error == ERESTARTSYS) - error = ERESTART; + error = linux_get_error(current, -bytes); } } else error = ENXIO; @@ -1780,6 +1795,7 @@ linux_complete_common(struct completion *c, int all) int linux_wait_for_common(struct completion *c, int flags) { + struct task_struct *task; int error; if (SCHEDULER_STOPPED()) @@ -1787,6 +1803,8 @@ linux_wait_for_common(struct completion *c, int flags) DROP_GIANT(); + task = current; + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else @@ -1798,7 +1816,9 @@ linux_wait_for_common(struct completion *c, int flags) break; sleepq_add(c, NULL, "completion", flags, 0); if (flags & SLEEPQ_INTERRUPTIBLE) { - if (sleepq_wait_sig(c, 0) != 0) { + error = -sleepq_wait_sig(c, 0); + if (error != 0) { + linux_schedule_save_interrupt_value(task, error); error = -ERESTARTSYS; goto intr; } @@ -1820,22 +1840,22 @@ intr: int linux_wait_for_timeout_common(struct completion *c, int timeout, int flags) { + struct task_struct *task; int end = jiffies + timeout; int error; - int ret; if (SCHEDULER_STOPPED()) return (0); DROP_GIANT(); + task = current; + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else flags = SLEEPQ_SLEEP; - error = 0; - ret = 0; for (;;) { sleepq_lock(c); if (c->done) @@ -1843,26 +1863,30 @@ linux_wait_for_timeout_common(struct completion *c, in sleepq_add(c, NULL, "completion", flags, 0); sleepq_set_timeout(c, linux_timer_jiffies_until(end)); if (flags & SLEEPQ_INTERRUPTIBLE) - ret = sleepq_timedwait_sig(c, 0); + error = -sleepq_timedwait_sig(c, 0); else - ret = sleepq_timedwait(c, 0); - if (ret != 0) { - /* check for timeout or signal */ - if (ret == EWOULDBLOCK) - error = 0; - else + error = -sleepq_timedwait(c, 0); + if (error != 0) { + /* check for timeout */ + if (error == -EWOULDBLOCK) { + error = 0; /* timeout */ + } else { + /* signal happened */ + linux_schedule_save_interrupt_value(task, error); error = -ERESTARTSYS; - goto intr; + } + goto done; } } c->done--; sleepq_release(c); -intr: + /* return how many jiffies are left */ + error = linux_timer_jiffies_until(end); +done: PICKUP_GIANT(); - /* return how many jiffies are left */ - return (ret != 0 ? error : linux_timer_jiffies_until(end)); + return (error); } int Modified: head/sys/compat/linuxkpi/common/src/linux_lock.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_lock.c Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/src/linux_lock.c Thu Feb 22 15:29:19 2018 (r329825) @@ -28,6 +28,7 @@ #include +#include #include struct ww_mutex_thread { @@ -72,10 +73,13 @@ linux_ww_unlock(void) int linux_ww_mutex_lock_sub(struct ww_mutex *lock, int catch_signal) { + struct task_struct *task; struct ww_mutex_thread entry; struct ww_mutex_thread *other; int retval = 0; + task = current; + linux_ww_lock(); if (unlikely(sx_try_xlock(&lock->base.sx) == 0)) { entry.thread = curthread; @@ -105,7 +109,9 @@ linux_ww_mutex_lock_sub(struct ww_mutex *lock, int cat } } if (catch_signal) { - if (cv_wait_sig(&lock->condvar, &ww_mutex_global) != 0) { + retval = -cv_wait_sig(&lock->condvar, &ww_mutex_global); + if (retval != 0) { + linux_schedule_save_interrupt_value(task, retval); retval = -EINTR; goto done; } @@ -133,4 +139,30 @@ linux_ww_mutex_unlock_sub(struct ww_mutex *lock) /* wakeup a lock waiter, if any */ cv_signal(&lock->condvar); linux_ww_unlock(); +} + +int +linux_mutex_lock_interruptible(mutex_t *m) +{ + int error; + + error = -sx_xlock_sig(&m->sx); + if (error != 0) { + linux_schedule_save_interrupt_value(current, error); + error = -EINTR; + } + return (error); +} + +int +linux_down_write_killable(struct rw_semaphore *rw) +{ + int error; + + error = -sx_xlock_sig(&rw->sx); + if (error != 0) { + linux_schedule_save_interrupt_value(current, error); + error = -EINTR; + } + return (error); } Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Feb 22 13:32:31 2018 (r329824) +++ head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Feb 22 15:29:19 2018 (r329825) @@ -41,7 +41,8 @@ __FBSDID("$FreeBSD$"); #include static int -linux_add_to_sleepqueue(void *wchan, const char *wmesg, int timeout, int state) +linux_add_to_sleepqueue(void *wchan, struct task_struct *task, + const char *wmesg, int timeout, int state) { int flags, ret; @@ -66,8 +67,10 @@ linux_add_to_sleepqueue(void *wchan, const char *wmesg ret = -sleepq_timedwait(wchan, 0); } /* filter return value */ - if (ret != 0 && ret != -EWOULDBLOCK) + if (ret != 0 && ret != -EWOULDBLOCK) { + linux_schedule_save_interrupt_value(task, ret); ret = -ERESTARTSYS; + } return (ret); } @@ -235,10 +238,10 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q PHOLD(task->task_thread->td_proc); sleepq_lock(task); if (atomic_read(&task->state) != TASK_WAKING) { - ret = linux_add_to_sleepqueue(task, "wevent", timeout, state); + ret = linux_add_to_sleepqueue(task, task, "wevent", timeout, state); } else { sleepq_release(task); - ret = linux_signal_pending_state(state, task) ? -ERESTARTSYS : 0; + ret = 0; } PRELE(task->task_thread->td_proc); @@ -253,6 +256,7 @@ int linux_schedule_timeout(int timeout) { struct task_struct *task; + int ret; int state; int remainder; @@ -270,10 +274,12 @@ linux_schedule_timeout(int timeout) sleepq_lock(task); state = atomic_read(&task->state); - if (state != TASK_WAKING) - (void)linux_add_to_sleepqueue(task, "sched", timeout, state); - else + if (state != TASK_WAKING) { + ret = linux_add_to_sleepqueue(task, task, "sched", timeout, state); + } else { sleepq_release(task); + ret = 0; + } set_task_state(task, TASK_RUNNING); PICKUP_GIANT(); @@ -283,7 +289,11 @@ linux_schedule_timeout(int timeout) /* range check return value */ remainder -= ticks; - if (remainder < 0) + + /* range check return value */ + if (ret == -ERESTARTSYS && remainder < 1) + remainder = 1; + else if (remainder < 0) remainder = 0; else if (remainder > timeout) remainder = timeout; @@ -337,7 +347,7 @@ linux_wait_on_bit_timeout(unsigned long *word, int bit break; } set_task_state(task, state); - ret = linux_add_to_sleepqueue(wchan, "wbit", timeout, state); + ret = linux_add_to_sleepqueue(wchan, task, "wbit", timeout, state); if (ret != 0) break; } @@ -374,7 +384,7 @@ linux_wait_on_atomic_t(atomic_t *a, unsigned int state break; } set_task_state(task, state); - ret = linux_add_to_sleepqueue(wchan, "watomic", 0, state); + ret = linux_add_to_sleepqueue(wchan, task, "watomic", 0, state); if (ret != 0) break; } From owner-svn-src-all@freebsd.org Thu Feb 22 15:29:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D435F0EF43; Thu, 22 Feb 2018 15:29:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FBFD68EC3; Thu, 22 Feb 2018 15:29:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AB8C1682; Thu, 22 Feb 2018 15:29:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MFTwKJ062516; Thu, 22 Feb 2018 15:29:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MFTw0T062515; Thu, 22 Feb 2018 15:29:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802221529.w1MFTw0T062515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 15:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329826 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 329826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 15:29:58 -0000 Author: kevans Date: Thu Feb 22 15:29:57 2018 New Revision: 329826 URL: https://svnweb.freebsd.org/changeset/base/329826 Log: lua-lint: Add note about luacheck in ports, silence warning luacheck was added in ports r462609. Silence warning about cli_execute -- it's non-standard, but for our setup it will be a standard global. Modified: head/tools/boot/lua-lint.sh Modified: head/tools/boot/lua-lint.sh ============================================================================== --- head/tools/boot/lua-lint.sh Thu Feb 22 15:29:19 2018 (r329825) +++ head/tools/boot/lua-lint.sh Thu Feb 22 15:29:57 2018 (r329826) @@ -1,8 +1,8 @@ #!/bin/sh # $FreeBSD$ -# Run linter on the lua scripts in stand/lua. luacheck, not currently available -# in ports, must be installed as a dependency. +# Run linter on the lua scripts in stand/lua. luacheck, available in ports as +# devel/lua-luacheck, must be installed as a dependency of this script. die() { echo $* @@ -16,4 +16,4 @@ LUACHECK=$(which luacheck) cd $(make -V SRCTOP)/stand ${LUACHECK} . --globals loader --globals lfs --globals io.getchar \ - --globals io.ischar --std lua53 + --globals io.ischar --globals cli_execute --std lua53 From owner-svn-src-all@freebsd.org Thu Feb 22 16:16:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B693F13143; Thu, 22 Feb 2018 16:16:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3716B1B1; Thu, 22 Feb 2018 16:16:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3432E1E64; Thu, 22 Feb 2018 16:16:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MGGocK087023; Thu, 22 Feb 2018 16:16:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MGGoLZ087022; Thu, 22 Feb 2018 16:16:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802221616.w1MGGoLZ087022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 16:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329827 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 329827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:16:50 -0000 Author: kevans Date: Thu Feb 22 16:16:49 2018 New Revision: 329827 URL: https://svnweb.freebsd.org/changeset/base/329827 Log: nvme: Unbreak LE builds after r329824 The parameter 'p' is unused if _BYTE_ORDER == _LITTLE_ENDIAN. Add in a (void)p to fix the build. Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Thu Feb 22 15:29:57 2018 (r329826) +++ head/sys/dev/nvme/nvme.h Thu Feb 22 16:16:49 2018 (r329827) @@ -1196,6 +1196,8 @@ void nvme_le128toh(void *p) tmp[i] = tmp[15-i]; tmp[15-i] = b; } +#else + (void)p; #endif } From owner-svn-src-all@freebsd.org Thu Feb 22 16:19:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20BA0F1344D; Thu, 22 Feb 2018 16:19:11 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E3A26B3CA; Thu, 22 Feb 2018 16:19:10 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x231.google.com with SMTP id 70so8195882lfw.2; Thu, 22 Feb 2018 08:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=tiu5MskbkIBXsH2186jfC5XT3gvvmqy+s7lb/i4mUz8=; b=IbnTO/v8oCCUFjb18jgDOmtw57t4OAOJRuWwJEM9EhoBFsJkcaBO5p3Oeiw/42+7jZ dirti4jZ0avHsgZa6Npef2A/e/+LYAl1/uurm//9MqjBDTwpmhGy1y13kdm+vPTiv6me +tPH7S4yFLRUtfud1XHK5DtQrsVGbhS4AwiQJRZkECOukd64fVIojLuDhKzpQJ6ZZxhs mEHnJYyp8xqUypzyhlLNb8KiyBHwEC6DbHfFyrhmDkKRtGKzHAWAHUaL2AfesjTwdPyp iB9IICrJCbcJt0Tmotf5eTGu/o8iOPTWFa1ZSHN250pLGasTBsw4AFuGZHYz+5E6mLRJ jhjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=tiu5MskbkIBXsH2186jfC5XT3gvvmqy+s7lb/i4mUz8=; b=nAhO8z7sxNy7Rk08PxpMaCPO3LW/4IThpJlUNYTDQDwDImPDkbVvGGZhexdwIIqvQn nlUb43eiXB26VZPWSrksC/ZxuaDgJZ2wv5mSU4ELIIOKBFw88AqJa8LpRZ3q1o4T45AE I0W4JbI3CTgf6NsQmaVXJoYmVa09FBuNaCVnDwqjv+7awtQN8fjNrvunlF0j9YlKgmqT bhCXjPfcfEYn05zNppH/Y8rs9I3xaw2oG367tGvgrpZ2mIONk76hYFp0XQZ6RCVT1Imo gVqpLrp5ziuLLy2Di/PqWnvlkJIRgx2PLjERHoQliCajPLNpQlkqBElH9IEG9KS9HSKz C3ow== X-Gm-Message-State: APf1xPCgLdUm76jIfsVnOYNE9Rb3N9br4b0BiTSj/2RClk8nhqrBTewC F7xeDu9yy7OW9Pbwbxjok7WSyaqcaWTeVGUCr6txSv86 X-Google-Smtp-Source: AH8x224bcdSBxnInsIb9rVtjYlE9SJ6NHZPW5INLvozfjlnXvFDv2DUR16YNKckX5gG6x8DfwpbqavxfrIHsB9B671U= X-Received: by 10.46.20.30 with SMTP id u30mr5561205ljd.12.1519316348789; Thu, 22 Feb 2018 08:19:08 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Thu, 22 Feb 2018 08:19:08 -0800 (PST) In-Reply-To: <201802221332.w1MDWVao004564@repo.freebsd.org> References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Alan Somers Date: Thu, 22 Feb 2018 09:19:08 -0700 X-Google-Sender-Auth: ys7t9vlgK6LJPug_xpVA2oYtjLM Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Wojciech Macek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:19:11 -0000 On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek wrote: > Author: wma > Date: Thu Feb 22 13:32:31 2018 > New Revision: 329824 > URL: https://svnweb.freebsd.org/changeset/base/329824 > > Log: > NVMe: Add big-endian support > > Remove bitfields from defined structures as they are not portable. > Instead use shift and mask macros in the driver and nvmecontrol > application. > > NVMe is now working on powerpc64 host. > > Submitted by: Michal Stanek > Obtained from: Semihalf > Reviewed by: imp, wma > Sponsored by: IBM, QCM Technologies > Differential revision: https://reviews.freebsd.org/D13916 > It looks like this change broke the build with Clang: --- ioctl.pico --- In file included from ioctl.c:32: In file included from /usr/home/alans/freebsd/head/sys/cam/scsi/scsi_pass.h:35: In file included from /usr/home/alans/freebsd/head/sys/cam/cam_ccb.h:46: In file included from /usr/home/alans/freebsd/head/sys/cam/nvme/nvme_all.h:34: /usr/home/alans/freebsd/head/sys/dev/nvme/nvme.h:1187:26: error: unused parameter 'p' [-Werror,-Wunused-parameter] void nvme_le128toh(void *p) -Alan From owner-svn-src-all@freebsd.org Thu Feb 22 16:21:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02CA1F136D6; Thu, 22 Feb 2018 16:21:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B0A46B70E; Thu, 22 Feb 2018 16:21:08 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id 37so8190031lfs.7; Thu, 22 Feb 2018 08:21:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=T9sV2CKIRMVFL5NVuvAoS/g4ZhimKRHgwX8oKDOIZ7k=; b=eOyS590oh6x93XTN+bqTN+GVWBE3V3+NxUQ/YkjLPGJ0zWKL1QnG7MdRxVDT2eSZMO VtZ665YWVMnTV6kqj+B0aCJ1gMqxBA6hlYDPwpCS3X5o5pVlbKhVJNFthAORmytXv7IH UAQw5CivW/o55/jexdjpXjButnKvcphr5jGpkUUct+jtktOImTca7jjmLc3eAmsn8NOJ V8XtJ9YWx4+IgSqKKXnolAnHRzFqLWO5lXjYSVo9GIH+2WzrOB7LD1hxr1HgL6pMRxpQ eNRmEEPCq58s42alBhqJ/BTEY8DPB26bsT8ry8BsTKox1PMJpbaZ4CbtGFkmmPWOmWUs D7YA== X-Gm-Message-State: APf1xPCqVBw8V1qNT6wQNUz8nTR/RXsgUXbZqfajLvUj9EE1FvNxlYEj cm2JDGd/zZ6APpzi/fiy1b9u2nvxmIQ= X-Google-Smtp-Source: AH8x225zg/LzL4F2isQGDP/VfLtpi0QEmfgeGdUQqi63Bp46DPcEd0QDWMf9x11ZMcfuOIyDivIqwQ== X-Received: by 10.46.41.157 with SMTP id p29mr5078854ljp.137.1519316461229; Thu, 22 Feb 2018 08:21:01 -0800 (PST) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com. [209.85.215.54]) by smtp.gmail.com with ESMTPSA id 5sm82704ljv.29.2018.02.22.08.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 08:21:01 -0800 (PST) Received: by mail-lf0-f54.google.com with SMTP id m69so8192627lfe.8; Thu, 22 Feb 2018 08:21:01 -0800 (PST) X-Received: by 10.46.114.26 with SMTP id n26mr4374200ljc.74.1519316460670; Thu, 22 Feb 2018 08:21:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.54.1 with HTTP; Thu, 22 Feb 2018 08:20:40 -0800 (PST) In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Kyle Evans Date: Thu, 22 Feb 2018 10:20:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Alan Somers Cc: Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:21:09 -0000 On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers wrote: > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek wrote: > >> Author: wma >> Date: Thu Feb 22 13:32:31 2018 >> New Revision: 329824 >> URL: https://svnweb.freebsd.org/changeset/base/329824 >> >> Log: >> NVMe: Add big-endian support >> >> Remove bitfields from defined structures as they are not portable. >> Instead use shift and mask macros in the driver and nvmecontrol >> application. >> >> NVMe is now working on powerpc64 host. >> >> Submitted by: Michal Stanek >> Obtained from: Semihalf >> Reviewed by: imp, wma >> Sponsored by: IBM, QCM Technologies >> Differential revision: https://reviews.freebsd.org/D13916 >> > > It looks like this change broke the build with Clang: > Fixed in r329827... all little endian arch's broken, not so great. =( From owner-svn-src-all@freebsd.org Thu Feb 22 16:22:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01E34F1399F; Thu, 22 Feb 2018 16:22:04 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60B9B6B92A; Thu, 22 Feb 2018 16:22:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22b.google.com with SMTP id m69so8197340lfe.8; Thu, 22 Feb 2018 08:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1nxet3W0oHKQ8yHgH3Tpmaz33IjyCBVgoX0AqYrXEns=; b=syI2mN2ZDNeZTu2f4v/rWyWuA+kyGNViOX/0Indk5ycFl9qgJCtouSq22u4Pqx8/MQ KqB0V1kqQMnp4NmJptNTI8KBJYHNHHwg21Ry24pgBq9E9qN+44HDd8kloBLqlt08zFAJ mrZw6sIb4DN3jah55GqDWrmFGqD+FraU13J577UgpBre/KYNBbz5IDrDOfnwv8drxRl2 CePw5XEb6cGJzD59t9F8cyNySAUsgi73qWInRMCpT5TIyTzHwOy0weDy5keyAdsjN6es o7R8TWGVtIP2j9rUTliUcWQ+u9afXJzzHgUWLk56yPwHQ7qslR8g/4QB8exBSU1KRq// XStg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1nxet3W0oHKQ8yHgH3Tpmaz33IjyCBVgoX0AqYrXEns=; b=n3rvd2KymzL7MME2ls/Th1YoVE+ZxtEeHdligyX/OwH7vvfa43GZQRMba3sTN27lHP 2KViIMo4HkSnqGBz3l3XAuVqqz0IbJ63QkIpyMT0/BRwAil5ECgxXIJKwg2kdE690usZ Rnsjr3QZPB45cfEg41haGK9fC16dwdS6N/aYEnMNGbq3QeXP/1WxT13mo4BktwV9ad6K 1KKcQKGPWEaWl2iCp7/P+5yGDtMxf39BchHihQNSXh1HWzdDsZi8B085vbB0HXADBm/w meqUKXjveTqBbB0dRBKYQALLpXSsfmszcdBaci8ql3nWZGnb6dJ2dZvM2JnTF7hXQb3d 8DYw== X-Gm-Message-State: APf1xPCVWd3VwJb4v51coXEG7hurbwIP4Hh+tPltrMgEYWLX5wsp1SgL n3DpnMX4rXJL42qednA1rd9LBr8Vc0l6/aa11NKMFQ== X-Google-Smtp-Source: AH8x226x5BYHDe+4L2uaQhO3fhGmlqpjnnIvlsm5NTMOkog7uirfNLWucKAavk0hXkEUu8JK9foMYG4K+SJYxtvJBuA= X-Received: by 10.25.157.80 with SMTP id g77mr5299579lfe.142.1519316521724; Thu, 22 Feb 2018 08:22:01 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Thu, 22 Feb 2018 08:22:01 -0800 (PST) In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Alan Somers Date: Thu, 22 Feb 2018 09:22:01 -0700 X-Google-Sender-Auth: 0iSKhGe554WIULJyqzNsDsk04cs Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Kyle Evans Cc: Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:22:04 -0000 On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: > On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers wrote: > > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek wrote: > > > >> Author: wma > >> Date: Thu Feb 22 13:32:31 2018 > >> New Revision: 329824 > >> URL: https://svnweb.freebsd.org/changeset/base/329824 > >> > >> Log: > >> NVMe: Add big-endian support > >> > >> Remove bitfields from defined structures as they are not portable. > >> Instead use shift and mask macros in the driver and nvmecontrol > >> application. > >> > >> NVMe is now working on powerpc64 host. > >> > >> Submitted by: Michal Stanek > >> Obtained from: Semihalf > >> Reviewed by: imp, wma > >> Sponsored by: IBM, QCM Technologies > >> Differential revision: https://reviews.freebsd.org/D13916 > >> > > > > It looks like this change broke the build with Clang: > > > > Fixed in r329827... all little endian arch's broken, not so great. =( > Fast work, Kyle. Thanks a bundle. -Alan From owner-svn-src-all@freebsd.org Thu Feb 22 16:24:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D92EF13CB9 for ; Thu, 22 Feb 2018 16:24:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 096426BB90 for ; Thu, 22 Feb 2018 16:24:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x235.google.com with SMTP id q4so2221059itc.0 for ; Thu, 22 Feb 2018 08:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lTs/xv0I+XBLwDLyrkXcJX9A7HilAUJbeLy+dnvbyKc=; b=mTvQDo1Q9+2e3PuNqgjjXoqV4S+RRLQ8KcNdJlwYOKNW0CyypOUZTMwANzbFgpeGOX UHAKedaEwWWSIbHEj7WWp5Hkh61LE6cA06e/7j7ueW0pdX1aTN0HtzdXYAS/Q8/WWQLV gHOlE++JPakmVu2KtI1a8T14NdTRX27H6U9aVKekUA96GT3CMnCgCa8UT+NVZrtkY8XM t3IfcK3R01/ypX5xEB8VKl3hrPu0lMvKer9Vrr+8QQ8KeXzYUP22o/OdXuXukB/+Vcq/ 3QO8xAtVL8SfiUKRAGxonfMc2XaCYxJQdjcFOqDZaa0KPbKFFxmzdsCWieEiLgSKhYMt cV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lTs/xv0I+XBLwDLyrkXcJX9A7HilAUJbeLy+dnvbyKc=; b=UQTkckH/zl4rqDPgyBhJsuTXLol4kOT3eg1dxrUBF78anVNaAv9kCEcy3nb79c/Qt/ cdtAmBCMq0VcJU3PSF7zKYbO3Lub20tpE7SCD6pb3iW+VULpzJxbdDLPneysA22C7wy6 X/ohd93lnKG8rYRgGREUHEFGcGSkCXJGvMi0FBXjm0NrwCawidx2YwUQExY+XSZHYec0 bdQwVdpKm4puaLzrZibquVkHjI4pOgOHz5jfIzMCj7tzwsyL+qNgRrhmGic/n1hPfKaE AEvnxeLGptfU/E6yb0+KrhDBLtrIiSoO/NNZ2ol8fOk187CiyrLfktoGiNR3oE8fCYS0 Lc1w== X-Gm-Message-State: APf1xPAsblORRPu5bOIXhk/+UqZc/TtzB2Mxtd5w8iZfV4KZUGOs0SHd c27JOW3CIbmX/+NWJMFfNcz14gjdVaXwNDfjHYUBxA== X-Google-Smtp-Source: AH8x226xtwB5WxS44SpObtLVaO2iPL1QeVx1bTvb8S8T+G2bHjz3WAUiLhirE3KOAwzKX8MswHl/kECoSjMVwiIBB7A= X-Received: by 10.36.111.4 with SMTP id x4mr8985044itb.51.1519316662215; Thu, 22 Feb 2018 08:24:22 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 08:24:21 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Warner Losh Date: Thu, 22 Feb 2018 09:24:21 -0700 X-Google-Sender-Auth: HLIOyHxZCiUbMINBjPSGEpbkzfc Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Kyle Evans Cc: Alan Somers , Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:24:23 -0000 On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: > On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers wrote: > > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek wrote: > > > >> Author: wma > >> Date: Thu Feb 22 13:32:31 2018 > >> New Revision: 329824 > >> URL: https://svnweb.freebsd.org/changeset/base/329824 > >> > >> Log: > >> NVMe: Add big-endian support > >> > >> Remove bitfields from defined structures as they are not portable. > >> Instead use shift and mask macros in the driver and nvmecontrol > >> application. > >> > >> NVMe is now working on powerpc64 host. > >> > >> Submitted by: Michal Stanek > >> Obtained from: Semihalf > >> Reviewed by: imp, wma > >> Sponsored by: IBM, QCM Technologies > >> Differential revision: https://reviews.freebsd.org/D13916 > >> > > > > It looks like this change broke the build with Clang: > > > > Fixed in r329827... all little endian arch's broken, not so great. =( > At least the kernel is passing my tests this morning... I didn't think this was ready and hasn't yet lifted my objections in the review... Not sure I want to get grumpy about it yet, but I'm not pleased to see this. Warner From owner-svn-src-all@freebsd.org Thu Feb 22 16:31:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0C58F144A1 for ; Thu, 22 Feb 2018 16:31:39 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-qt0-x232.google.com (mail-qt0-x232.google.com [IPv6:2607:f8b0:400d:c0d::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 393B26C132 for ; Thu, 22 Feb 2018 16:31:39 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-qt0-x232.google.com with SMTP id v90so7007113qte.12 for ; Thu, 22 Feb 2018 08:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xYTaE8Ed4qvkzf0pjc7PI+1LVKXFG7VDzQhfcMrR/TM=; b=Q10RKypB89FhEw9lCw8o3jRr5NOzJk0DxIL2JZQzLEzPM3CFqubdd0AYT4LIimUi5Y rzHy4i+OV6/CbXloTstUhx5cUDxV4roBMIgKlysq2sSnDxDXlQegCRSrI600kvqUWHy+ Ek1Q6D6KSrBBpAti15kJ/U8vtOYlpC4qiWal4L1qKkUGO2bi8mE++uovzGYz6uQAxZjC caff7etYMto9jKVwzne6neGe53O2HbPUx8KCyOzFUkhVur7bAo+E3nqib1U+QVgOjU3b 9Jrax/Vi3pzW2MKBDYkQoHmkxklDCM5ZLzg+G85OhwuxXIxe/QV77vPVFLctqKf7S+nP g+ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xYTaE8Ed4qvkzf0pjc7PI+1LVKXFG7VDzQhfcMrR/TM=; b=INtcsW7uOXe0C+Yw4XDaar45lxWSKzigIEk/NLedgdy/vHn8NdSEIOAVZKAUO4Dzlc SDgRqZVuW8CRDdhHoo5iIw6ir7EIyFAKbgGrpPafYR/vW8p+gyw79KaZD9zDOAdOpTCa xfqPUkkTLJhFAKp44xXGXM2JnPfT/nFWGqhuIkGt087yCDpbpHKS9hXmeOBAfuz410bP M5rPY/h5P+NQPVJcRBXehslf4FnqngSTIBkIuJOx9ZxuCrLwd0nw56OIpsUNJP6Y+2vs tQDMp5YP3ktwS3WdNiVszFy1J83o84wdRnIGpVWRMBDiWTIgN+0C+RzOKkZZyKP/OJ5R K9DQ== X-Gm-Message-State: APf1xPD6ZaL1rcFM4jGMgJzWgwyBLAivQsdi09KjVastROyZhgUGkwji yIiyoO3QFPyR9W8eFz59ohw4ie00bJSWkEOWdmC1xw== X-Google-Smtp-Source: AH8x226WiF9bw8KAxcSutNXYykpSL9UNMxyLXuyDq9OyFzQSC+TBruXF2cm8Qmfz0SYPvULafvUO9e19qiqFBCmtDkg= X-Received: by 10.200.3.110 with SMTP id w46mr11814795qtg.149.1519317098786; Thu, 22 Feb 2018 08:31:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.56.170 with HTTP; Thu, 22 Feb 2018 08:31:18 -0800 (PST) In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Wojciech Macek Date: Thu, 22 Feb 2018 17:31:18 +0100 Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Alan Somers Cc: Kyle Evans , Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:31:40 -0000 Thanks and sorry for troubles! These lines must have got lost somewhere during rebase as we run tinderbox with this patch yesterday. Regards, Wojtek wma@ 2018-02-22 17:22 GMT+01:00 Alan Somers : > On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: > >> On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers >> wrote: >> > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek >> wrote: >> > >> >> Author: wma >> >> Date: Thu Feb 22 13:32:31 2018 >> >> New Revision: 329824 >> >> URL: https://svnweb.freebsd.org/changeset/base/329824 >> >> >> >> Log: >> >> NVMe: Add big-endian support >> >> >> >> Remove bitfields from defined structures as they are not portable. >> >> Instead use shift and mask macros in the driver and nvmecontrol >> >> application. >> >> >> >> NVMe is now working on powerpc64 host. >> >> >> >> Submitted by: Michal Stanek >> >> Obtained from: Semihalf >> >> Reviewed by: imp, wma >> >> Sponsored by: IBM, QCM Technologies >> >> Differential revision: https://reviews.freebsd.org/D13916 >> >> >> > >> > It looks like this change broke the build with Clang: >> > >> >> Fixed in r329827... all little endian arch's broken, not so great. =( >> > > Fast work, Kyle. Thanks a bundle. > -Alan > From owner-svn-src-all@freebsd.org Thu Feb 22 16:34:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89453F14973 for ; Thu, 22 Feb 2018 16:34:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 139486C3D8 for ; Thu, 22 Feb 2018 16:34:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id u5so1148422itc.1 for ; Thu, 22 Feb 2018 08:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DeS/74QsBXxEoVSsUqAMRv7LRpSAI2XT8+bDNQP/Qsk=; b=bfeTKAUwiNb/wmAISH/0yGwFJzQlbpjcKsVzxJhJowGFiu87OXH4J5NNJitkJ9oNfe o7YO36yQl7SR/djbles5qflFD0OLnEip64hcxG7a7jtDN3YgoMSscJN8fEg3fV4iXSIZ rA0UkzckINZqeryydoS0On1WfGI/MGPhxQKysib8XKNa2jqxxqGrrFYYA1zp1LqpblQC iqFGeiUi+BWNgKxPXi39xdTwRXcsayc+ZLd1oCOWLNL6iB3L10mX6NSewTpogH+6SRO7 848kndXaH17vq2bMQ/LyDZfUZB/GJKTao6OP3wHBdDScIvks4uWyu3H8U/EcX7RicPXc dheQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DeS/74QsBXxEoVSsUqAMRv7LRpSAI2XT8+bDNQP/Qsk=; b=AVd/rUU/dA9uzXiTEi6Norfd6rVNVOkkoLdWdQxXG2amvNJoWqz2nBowy+rkubfdh8 +xN3d0pfqOEGIoH9j404A/oj3nxab4hh+nFHTXpRo7ZbeF6ofKw6UirktjPo38TwLgLq a5Z3F/2oQt115oUKIvzLQN8OgzLaxm80i7pRZ3Xk8VM2KXpE+850LcVsvDI8buYUHvmX CeWwxR9eVUSvAZlm1z7+1Zfc/vOOx9CMMl5UNARXRH05gkxJSCCM9B/UCWHwGWEIeV2C vr3KdYCDLajbQpYl75YSlRhcAGPySHZEBmAe70CFKW0gRuWiQX34sZ0ac7AL24mA1iVN Kh+Q== X-Gm-Message-State: APf1xPBkeUHsfA5chy3OPbtgKDwFCoustzXP33pYgMWuggM9ECwe+XWe 6RsHuXwHPKMVCA299YU4mdBM/IX14L7Zvd59hZ1LTQ== X-Google-Smtp-Source: AH8x225GMKyQBFtQ7mmTmn8HAGJj8mFIXqwdr5pLyxxIEPeHF7AFkQmzzY72E85mdUmjC3tKCESid5HIhBhwaz+lAkc= X-Received: by 10.36.111.4 with SMTP id x4mr9030884itb.51.1519317248194; Thu, 22 Feb 2018 08:34:08 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 08:34:07 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Warner Losh Date: Thu, 22 Feb 2018 09:34:07 -0700 X-Google-Sender-Auth: X0ynUdQ1fGoV8w9HBmMLouyFk74 Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Wojciech Macek Cc: Alan Somers , Kyle Evans , Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:34:09 -0000 I know all about losing things during the rebase.... I'd be a lot happier if you could confirm that nothing else was lost. It's a large patch, which makes it impossible for others to do it... It seems to build, and seems to be working in the light testing I've done this morning... Warner On Thu, Feb 22, 2018 at 9:31 AM, Wojciech Macek wrote: > Thanks and sorry for troubles! > These lines must have got lost somewhere during rebase as we run tinderbox > with this patch yesterday. > > Regards, > Wojtek > wma@ > > 2018-02-22 17:22 GMT+01:00 Alan Somers : > >> On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: >> >>> On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers >>> wrote: >>> > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek >>> wrote: >>> > >>> >> Author: wma >>> >> Date: Thu Feb 22 13:32:31 2018 >>> >> New Revision: 329824 >>> >> URL: https://svnweb.freebsd.org/changeset/base/329824 >>> >> >>> >> Log: >>> >> NVMe: Add big-endian support >>> >> >>> >> Remove bitfields from defined structures as they are not portable. >>> >> Instead use shift and mask macros in the driver and nvmecontrol >>> >> application. >>> >> >>> >> NVMe is now working on powerpc64 host. >>> >> >>> >> Submitted by: Michal Stanek >>> >> Obtained from: Semihalf >>> >> Reviewed by: imp, wma >>> >> Sponsored by: IBM, QCM Technologies >>> >> Differential revision: https://reviews.freebsd.org/D13916 >>> >> >>> > >>> > It looks like this change broke the build with Clang: >>> > >>> >>> Fixed in r329827... all little endian arch's broken, not so great. =( >>> >> >> Fast work, Kyle. Thanks a bundle. >> -Alan >> > > From owner-svn-src-all@freebsd.org Thu Feb 22 16:50:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49202F15FAD for ; Thu, 22 Feb 2018 16:50:14 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C80046CEEC for ; Thu, 22 Feb 2018 16:50:13 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-qt0-x233.google.com with SMTP id l19so7080121qtj.9 for ; Thu, 22 Feb 2018 08:50:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JQC7+6n7icLWdAt7yhKdboqVLyeJwzxxM5zUprLe0Kk=; b=fSK9Z9hdMIs7rsyXhiccNiRlDdW5rV8zyoLVZJDdbNYr9qmabVRJdKACrg93FfEd9F 4pF5d29ZG0WfS7v5WjQE6k5erFs9+tCJjVkyJUgBtR+AnAIy4apnSZQ/sBGCC9jCzyFQ M+mma/7YBJsbg0Tm7/K0cM5l+25I3nQ5hCGgo0cZSaORy/iiLck7pJ86J2ySUPkahAIx iDKq3r+ouiw7QznPPL6Z8SHtZTklD+2cxzHpQQXwLzj9KXRGLK7nozSSuZpTKTDjyS3K D1NCQnSbUj/DRHU4ZmKHpwz+O6tfCviIHoNjbXk8pKw3JrhV4t31tGPfj6VajpTsqkco TZQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JQC7+6n7icLWdAt7yhKdboqVLyeJwzxxM5zUprLe0Kk=; b=BNIGk8vv9m9GTr7hC55tl9yrDpDQouKi16+Nl/VuXBXh1HX9N9xdXytljYwRrFOK9I IdFBPk7sQSsziwa0SGNmuX/MCBI2X5fFLv/dxg/R3US4Y2sWTvZnrZsDLIjnKLBMjhUO Qpoy4gOtTr4w/X4o86zaZaiIcMXlEAuLQ7rxVk7nhpT6pkA/IT4rLCyDMTgRoqEIsnMF Q9p5+W09XN/MpFBqnvQTuBIwu7WTNVqVWMkIzqieAHJYR363qCehv6J8ZXb2Kk1ACVgR QBnWett31bs3wONzdMilakQG0OTrj2tjitPeFrrThewcIc0nwwsEhGtvmO3zo8RFX7jy cbQw== X-Gm-Message-State: APf1xPCk+HgwFn5sLXa0xpXYFZTmGnow7AzeRkSA95/ZHkfmscwQDhPm IA70wa+jST0aH8BJutTTYK4kfgVD/vxb1udBnuBp4Q== X-Google-Smtp-Source: AH8x224R0j1gEmPgOEK7C2CeQr3u5QOPbESz0op8LAfR2VD4ABw1QWiOh8ozbuNQvlQygZOOpJa9yqy8qSpoDw6dSNw= X-Received: by 10.237.34.172 with SMTP id p41mr12026086qtc.316.1519318213448; Thu, 22 Feb 2018 08:50:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.56.170 with HTTP; Thu, 22 Feb 2018 08:49:53 -0800 (PST) In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Wojciech Macek Date: Thu, 22 Feb 2018 17:49:53 +0100 Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Warner Losh Cc: Alan Somers , Kyle Evans , Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , =?UTF-8?Q?Micha=C5=82_Stanek?= Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 16:50:14 -0000 Yes, I'm doing that right now. So far it seems everything is there, but will confirm to be 100% sure. Warner, I'm very sorry for not waiting for your comments. The review was dead for few days and I thought that all was already said, but maybe should have waited a little longer... Let me know what to do now. If you see any issues, I'll be more than happy to fix them. Also, if you insist, we can revert it, but if no drastic changes are required, I'd prefer to leave it as is and make iterational fixes to this part. Regards, Wojtek wma@ 2018-02-22 17:34 GMT+01:00 Warner Losh : > I know all about losing things during the rebase.... > > I'd be a lot happier if you could confirm that nothing else was lost. It's > a large patch, which makes it impossible for others to do it... It seems > to build, and seems to be working in the light testing I've done this > morning... > > Warner > > > On Thu, Feb 22, 2018 at 9:31 AM, Wojciech Macek wrote: > >> Thanks and sorry for troubles! >> These lines must have got lost somewhere during rebase as we run >> tinderbox with this patch yesterday. >> >> Regards, >> Wojtek >> wma@ >> >> 2018-02-22 17:22 GMT+01:00 Alan Somers : >> >>> On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: >>> >>>> On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers >>>> wrote: >>>> > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek >>>> wrote: >>>> > >>>> >> Author: wma >>>> >> Date: Thu Feb 22 13:32:31 2018 >>>> >> New Revision: 329824 >>>> >> URL: https://svnweb.freebsd.org/changeset/base/329824 >>>> >> >>>> >> Log: >>>> >> NVMe: Add big-endian support >>>> >> >>>> >> Remove bitfields from defined structures as they are not portable. >>>> >> Instead use shift and mask macros in the driver and nvmecontrol >>>> >> application. >>>> >> >>>> >> NVMe is now working on powerpc64 host. >>>> >> >>>> >> Submitted by: Michal Stanek >>>> >> Obtained from: Semihalf >>>> >> Reviewed by: imp, wma >>>> >> Sponsored by: IBM, QCM Technologies >>>> >> Differential revision: https://reviews.freebsd.org/D13916 >>>> >> >>>> > >>>> > It looks like this change broke the build with Clang: >>>> > >>>> >>>> Fixed in r329827... all little endian arch's broken, not so great. =( >>>> >>> >>> Fast work, Kyle. Thanks a bundle. >>> -Alan >>> >> >> > From owner-svn-src-all@freebsd.org Thu Feb 22 17:09:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E32F17B5E; Thu, 22 Feb 2018 17:09:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00EB46DCAD; Thu, 22 Feb 2018 17:09:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFDC7265F; Thu, 22 Feb 2018 17:09:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MH9QBa012259; Thu, 22 Feb 2018 17:09:26 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MH9Qcu012258; Thu, 22 Feb 2018 17:09:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201802221709.w1MH9Qcu012258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Thu, 22 Feb 2018 17:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329829 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 17:09:27 -0000 Author: vangyzen Date: Thu Feb 22 17:09:26 2018 New Revision: 329829 URL: https://svnweb.freebsd.org/changeset/base/329829 Log: sched_ule: update a comment to reflect reality MFC after: 3 days Sponsored by: Dell EMC Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Feb 22 16:59:55 2018 (r329828) +++ head/sys/kern/sched_ule.c Thu Feb 22 17:09:26 2018 (r329829) @@ -1251,7 +1251,7 @@ sched_pickcpu(struct thread *td, int flags) } /* * If the thread can run on the last cpu and the affinity has not - * expired or it is idle run it there. + * expired and it is idle, run it there. */ tdq = TDQ_CPU(ts->ts_cpu); cg = tdq->tdq_cg; From owner-svn-src-all@freebsd.org Thu Feb 22 17:40:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75ABAF19FFD for ; Thu, 22 Feb 2018 17:40:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02C386EE2D for ; Thu, 22 Feb 2018 17:40:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22d.google.com with SMTP id g21so6852301ioj.5 for ; Thu, 22 Feb 2018 09:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z/b9ZdmBTfi7iozMNoDjfo21H4Svj6j2fY35Iq2eVvI=; b=0x4lLtC50oQ4J6PYqUq4D2Na+Acyefg0L1JEpVJMKv5oPdCoMpmV5PIMJwUWCDIrnE kmCbxyWHJ06egtDLlXaaSYJLEdRxaN3k3TXy8SuLe5prvg1DiEMcWPJEIOyUC5eQdLzj 93cRzzkmAc3qTGym9OvvOgr1FydsSM4o4X7920jOS1VLELguar2jYhvnl6NvcEZqjXv7 RWu82Nr/7QjNydT5jD53VBpItf27gcdgzrZQJu2x2f8tEC4rVeUjCN87m6BmwezVqYOm rzNpXnpcacgJYZMrM4ynrixPNJSXY1olmVCjmwWEri86ADa1bvGL0p3TYoX8yQI8JlCS oXzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z/b9ZdmBTfi7iozMNoDjfo21H4Svj6j2fY35Iq2eVvI=; b=pRGPldBylQONcbvG6jkmtjsimpkA/sPKRfQOZ32emcOcfNF8XSQFRIV5KiQWNpBMVk BV0BSnlAzbdImAFutRd//UlyTV+AQepXqJv8SfJ3JqaS3kpC7f1hYniGPLuXSsh3Jf+V HbPRO/VfRLd24GMdPjzlqPMNiL73yuHKhkI2YanSZoqWgUu9GpHCp5mlMpkfMLWQGRyW n+mBkLOU5dr6l7LGAFRCitmkdeN6n8Y2324kGXfjFryiu/qroq1yCakVtJR6i2vmGDY9 uOEwRYfBFoGSgYbQa9GDnuUQZ69SJqB8jG2QulX2ETCzSra6zswPCeUkpZwG88U4CZ9y Jviw== X-Gm-Message-State: APf1xPCnNrQDIZf876yH2H6ZCCiB271Bsr7j8FSnkKL8zB6MD4mxA8mk 56hS9nkL3ULDPR8jZ9ix48EdcwqZm0E6+vNXkQUX1g== X-Google-Smtp-Source: AG47ELuT1RIbT6ftz+H3pQxU3ntXX+y0Lq+/H2axIvkkEbptAErQDa+b67tVqFvICLee0lmhbMsTQDa9qxzIiWHwvCQ= X-Received: by 10.107.2.6 with SMTP id 6mr9600103ioc.117.1519321203177; Thu, 22 Feb 2018 09:40:03 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 09:40:02 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201802221332.w1MDWVao004564@repo.freebsd.org> From: Warner Losh Date: Thu, 22 Feb 2018 10:40:02 -0700 X-Google-Sender-Auth: Ivh6b3eF-dnPROJSDdYmeq2UrXE Message-ID: Subject: Re: svn commit: r329824 - in head: sbin/nvmecontrol sys/cam/nvme sys/conf sys/dev/mpr sys/dev/nvme To: Wojciech Macek Cc: Alan Somers , Kyle Evans , Wojciech Macek , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , =?UTF-8?Q?Micha=C5=82_Stanek?= Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 17:40:04 -0000 On Thu, Feb 22, 2018 at 9:49 AM, Wojciech Macek wrote: > Yes, I'm doing that right now. So far it seems everything is there, but > will confirm to be 100% sure. > > Warner, I'm very sorry for not waiting for your comments. The review was > dead for few days and I thought that all was already said, but maybe > should have waited a little longer... > Let me know what to do now. If you see any issues, I'll be more than happy > to fix them. Also, if you insist, we can revert it, but if no drastic > changes are required, I'd prefer to leave it as is and make iterational > fixes to this part. > I agree. Unless something surfaces that's utterly broken, that's the best path forward. So far the actual driver is coping well with the load I'm giving it and it wasn't too disruptive to other things I had going on.... I understand things get pushed in more quickly than reviews would like sometimes, so I'll look over the changes and see if all of the things I had issues with in the original patches were addressed. I know most of them have, but wanted to make sure before a final sign off is all... If there is stuff, I think it will be minor. Warner > Regards, > Wojtek > wma@ > > 2018-02-22 17:34 GMT+01:00 Warner Losh : > >> I know all about losing things during the rebase.... >> >> I'd be a lot happier if you could confirm that nothing else was lost. >> It's a large patch, which makes it impossible for others to do it... It >> seems to build, and seems to be working in the light testing I've done this >> morning... >> >> Warner >> >> >> On Thu, Feb 22, 2018 at 9:31 AM, Wojciech Macek wrote: >> >>> Thanks and sorry for troubles! >>> These lines must have got lost somewhere during rebase as we run >>> tinderbox with this patch yesterday. >>> >>> Regards, >>> Wojtek >>> wma@ >>> >>> 2018-02-22 17:22 GMT+01:00 Alan Somers : >>> >>>> On Thu, Feb 22, 2018 at 9:20 AM, Kyle Evans wrote: >>>> >>>>> On Thu, Feb 22, 2018 at 10:19 AM, Alan Somers >>>>> wrote: >>>>> > On Thu, Feb 22, 2018 at 6:32 AM, Wojciech Macek >>>>> wrote: >>>>> > >>>>> >> Author: wma >>>>> >> Date: Thu Feb 22 13:32:31 2018 >>>>> >> New Revision: 329824 >>>>> >> URL: https://svnweb.freebsd.org/changeset/base/329824 >>>>> >> >>>>> >> Log: >>>>> >> NVMe: Add big-endian support >>>>> >> >>>>> >> Remove bitfields from defined structures as they are not portable. >>>>> >> Instead use shift and mask macros in the driver and nvmecontrol >>>>> >> application. >>>>> >> >>>>> >> NVMe is now working on powerpc64 host. >>>>> >> >>>>> >> Submitted by: Michal Stanek >>>>> >> Obtained from: Semihalf >>>>> >> Reviewed by: imp, wma >>>>> >> Sponsored by: IBM, QCM Technologies >>>>> >> Differential revision: https://reviews.freebsd.org/D13916 >>>>> >> >>>>> > >>>>> > It looks like this change broke the build with Clang: >>>>> > >>>>> >>>>> Fixed in r329827... all little endian arch's broken, not so great. =( >>>>> >>>> >>>> Fast work, Kyle. Thanks a bundle. >>>> -Alan >>>> >>> >>> >> > From owner-svn-src-all@freebsd.org Thu Feb 22 17:47:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66A5CF1AB12; Thu, 22 Feb 2018 17:47:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19B786F5BD; Thu, 22 Feb 2018 17:47:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14BEB2CE6; Thu, 22 Feb 2018 17:47:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MHlGaa032224; Thu, 22 Feb 2018 17:47:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MHlGJS032223; Thu, 22 Feb 2018 17:47:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802221747.w1MHlGJS032223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 17:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329830 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 329830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 17:47:17 -0000 Author: asomers Date: Thu Feb 22 17:47:16 2018 New Revision: 329830 URL: https://svnweb.freebsd.org/changeset/base/329830 Log: nvmecontrol: fix build on amd64/clang Broken by: 329824 Sponsored by: Spectra Logic Corp Modified: head/sbin/nvmecontrol/identify.c Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Thu Feb 22 17:09:26 2018 (r329829) +++ head/sbin/nvmecontrol/identify.c Thu Feb 22 17:47:16 2018 (r329830) @@ -112,7 +112,7 @@ print_controller(struct nvme_controller_data *cdata) if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%ld\n", PAGE_SIZE * (1 << cdata->mdts)); + printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); printf("Controller ID: 0x%02x\n", cdata->ctrlr_id); printf("\n"); From owner-svn-src-all@freebsd.org Thu Feb 22 18:05:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B296FF1C524 for ; Thu, 22 Feb 2018 18:05:07 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39F7470588 for ; Thu, 22 Feb 2018 18:05:06 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: d9bb1b23-17fa-11e8-bb8e-b35b57339d60 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id d9bb1b23-17fa-11e8-bb8e-b35b57339d60; Thu, 22 Feb 2018 18:04:40 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w1MI4vIX064331; Thu, 22 Feb 2018 11:04:57 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1519322697.91697.138.camel@freebsd.org> Subject: Re: svn commit: r329830 - head/sbin/nvmecontrol From: Ian Lepore To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 22 Feb 2018 11:04:57 -0700 In-Reply-To: <201802221747.w1MHlGJS032223@repo.freebsd.org> References: <201802221747.w1MHlGJS032223@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 18:05:07 -0000 On Thu, 2018-02-22 at 17:47 +0000, Alan Somers wrote: > Author: asomers > Date: Thu Feb 22 17:47:16 2018 > New Revision: 329830 > URL: https://svnweb.freebsd.org/changeset/base/329830 > > Log: >   nvmecontrol: fix build on amd64/clang >    >   Broken by: 329824 >   Sponsored by: Spectra Logic Corp > > Modified: >   head/sbin/nvmecontrol/identify.c > > Modified: head/sbin/nvmecontrol/identify.c > ============================================================================== > --- head/sbin/nvmecontrol/identify.c Thu Feb 22 17:09:26 2018 (r329829) > +++ head/sbin/nvmecontrol/identify.c Thu Feb 22 17:47:16 2018 (r329830) > @@ -112,7 +112,7 @@ print_controller(struct nvme_controller_data *cdata) >   if (cdata->mdts == 0) >   printf("Unlimited\n"); >   else > - printf("%ld\n", PAGE_SIZE * (1 << cdata->mdts)); > + printf("%d\n", PAGE_SIZE * (1 << cdata->mdts)); >   printf("Controller ID:              0x%02x\n", cdata->ctrlr_id); >   printf("\n"); If cdata->mdts > 19 that'll overflow 32 bits.  I'm not sure if that can happen in the real world or not.  If so, maybe it'd be better to do   printf("%ju\n", PAGE_SIZE * ((uintmax_t)1 << cdata->mdts)); -- Ian From owner-svn-src-all@freebsd.org Thu Feb 22 18:49:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4DAF20BE5; Thu, 22 Feb 2018 18:49:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 130387206E; Thu, 22 Feb 2018 18:49:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 099113ABA; Thu, 22 Feb 2018 18:49:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MInr6H061595; Thu, 22 Feb 2018 18:49:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MInrxO061594; Thu, 22 Feb 2018 18:49:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802221849.w1MInrxO061594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 18:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329831 - head/stand/userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/userboot/userboot X-SVN-Commit-Revision: 329831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 18:49:54 -0000 Author: kevans Date: Thu Feb 22 18:49:53 2018 New Revision: 329831 URL: https://svnweb.freebsd.org/changeset/base/329831 Log: Fix userboot w/ ZFS after r329725 r329725 cleaned up ZFS commands duplicated in multiple places, but userboot was not setting HAVE_ZFS when MK_ZFS != "no". This resulted in a failure to boot (as seen in PR 226118) in bhyve, with the following message: /boot/userboot.so: Undefined symbol "ldi_get_size" PR: 226118 Glanced at by: imp Modified: head/stand/userboot/userboot/Makefile Modified: head/stand/userboot/userboot/Makefile ============================================================================== --- head/stand/userboot/userboot/Makefile Thu Feb 22 17:47:16 2018 (r329830) +++ head/stand/userboot/userboot/Makefile Thu Feb 22 18:49:53 2018 (r329831) @@ -42,6 +42,7 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a +HAVE_ZFS=yes .endif # Always add MI sources From owner-svn-src-all@freebsd.org Thu Feb 22 19:12:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AB42F228A5; Thu, 22 Feb 2018 19:12:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF4C7734E6; Thu, 22 Feb 2018 19:12:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA0AF3FF2; Thu, 22 Feb 2018 19:12:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MJCWTs083758; Thu, 22 Feb 2018 19:12:32 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MJCWw1083750; Thu, 22 Feb 2018 19:12:32 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802221912.w1MJCWw1083750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 22 Feb 2018 19:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329832 - in head: share/man/man4 sys/conf sys/dev/gpio sys/modules sys/modules/chvgpio X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/gpio sys/modules sys/modules/chvgpio X-SVN-Commit-Revision: 329832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 19:12:33 -0000 Author: gonzo Date: Thu Feb 22 19:12:32 2018 New Revision: 329832 URL: https://svnweb.freebsd.org/changeset/base/329832 Log: [chvgpio] add GPIO driver for Intel Z8xxx SoC family Add chvgpio(4) driver for Intel Z8xxx SoC family. This product was formerly known as Cherry Trail but Linux and OpenBSD drivers refer to it as Cherry View. This driver is derived from OpenBSD one so the name is kept for alignment with another BSD system. Submitted by: Tom Jones Reviewed by: gonzo, wblock(man page) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13086 Added: head/share/man/man4/chvgpio.4 (contents, props changed) head/sys/dev/gpio/chvgpio.c (contents, props changed) head/sys/dev/gpio/chvgpio_reg.h (contents, props changed) head/sys/modules/chvgpio/ head/sys/modules/chvgpio/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Feb 22 18:49:53 2018 (r329831) +++ head/share/man/man4/Makefile Thu Feb 22 19:12:32 2018 (r329832) @@ -97,6 +97,7 @@ MAN= aac.4 \ bwi.4 \ bwn.4 \ ${_bytgpio.4} \ + ${_chvgpio.4} \ capsicum.4 \ cardbus.4 \ carp.4 \ @@ -796,6 +797,7 @@ _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _bxe.4= bxe.4 _bytgpio.4= bytgpio.4 +_chvgpio.4= chvgpio.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 Added: head/share/man/man4/chvgpio.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/chvgpio.4 Thu Feb 22 19:12:32 2018 (r329832) @@ -0,0 +1,65 @@ +.\" Copyright (c) 2017 +.\" Tom Jones All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 17, 2017 +.Dt CHVGPIO 4 +.Os +.Sh NAME +.Nm chvgpio +.Nd Intel Cherry View SoC GPIO controller +.Sh SYNOPSIS +.Cd "device gpio" +.Cd "device chvgpio" +.Sh DESCRIPTION +.Nm +supports the GPIO controller that can be found in Intel's Cherry View SoC +family. +.Pp +The Cherry View SoC has 5 banks of GPIO pins, NORTH, EAST, SOUTHEAST, SOUTHWEST +and VIRTUAL. +All but VIRTUAL are exposed to userland as +.Pa /dev/gpiocN , +where N is 0-3. +Pins in each bank are pre-named to match names in the Intel® Atomâ„¢ Z8000 +Processor Series Vol 2 +.Sh SEE ALSO +.Xr gpio 3 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Rs +.%T Intel® Atomâ„¢ Z8000 Processor Series Vol 1 +.Re +.Rs +.%T Intel® Atomâ„¢ Z8000 Processor Series Vol 2 +.Re +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 12 . +.Sh AUTHORS +This driver and man page were written by +.An Tom Jones Aq Mt tj@enoti.me . Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Feb 22 18:49:53 2018 (r329831) +++ head/sys/conf/files.amd64 Thu Feb 22 19:12:32 2018 (r329832) @@ -293,6 +293,7 @@ dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa dev/fdc/fdc_pccard.c optional fdc pccard dev/gpio/bytgpio.c optional bytgpio +dev/gpio/chvgpio.c optional chvgpio dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_osm_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_config.c optional hpt27xx Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Feb 22 18:49:53 2018 (r329831) +++ head/sys/conf/files.i386 Thu Feb 22 19:12:32 2018 (r329832) @@ -215,6 +215,7 @@ dev/glxiic/glxiic.c optional glxiic dev/glxsb/glxsb.c optional glxsb dev/glxsb/glxsb_hash.c optional glxsb dev/gpio/bytgpio.c optional bytgpio +dev/gpio/chvgpio.c optional chvgpio dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_osm_bsd.c optional hpt27xx dev/hpt27xx/hpt27xx_config.c optional hpt27xx Added: head/sys/dev/gpio/chvgpio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/chvgpio.c Thu Feb 22 19:12:32 2018 (r329832) @@ -0,0 +1,521 @@ +/*- + * Copyright (c) 2017 Tom Jones + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Copyright (c) 2016 Mark Kettenis + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "opt_platform.h" +#include "opt_acpi.h" +#include "gpio_if.h" + +#include "chvgpio_reg.h" + +/* + * Macros for driver mutex locking + */ +#define CHVGPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) +#define CHVGPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx) +#define CHVGPIO_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ + "chvgpio", MTX_SPIN) +#define CHVGPIO_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) +#define CHVGPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) +#define CHVGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) + +struct chvgpio_softc { + device_t sc_dev; + device_t sc_busdev; + struct mtx sc_mtx; + + ACPI_HANDLE sc_handle; + + int sc_mem_rid; + struct resource *sc_mem_res; + + int sc_irq_rid; + struct resource *sc_irq_res; + void *intr_handle; + + const char *sc_bank_prefix; + const int *sc_pins; + int sc_npins; + int sc_ngroups; + const char **sc_pin_names; +}; + +static void chvgpio_intr(void *); +static int chvgpio_probe(device_t); +static int chvgpio_attach(device_t); +static int chvgpio_detach(device_t); + +static inline int +chvgpio_pad_cfg0_offset(int pin) +{ + return (CHVGPIO_PAD_CFG0 + 1024 * (pin / 15) + 8 * (pin % 15)); +} + +static inline int +chvgpio_read_pad_cfg0(struct chvgpio_softc *sc, int pin) +{ + return bus_read_4(sc->sc_mem_res, chvgpio_pad_cfg0_offset(pin)); +} + +static inline void +chvgpio_write_pad_cfg0(struct chvgpio_softc *sc, int pin, uint32_t val) +{ + bus_write_4(sc->sc_mem_res, chvgpio_pad_cfg0_offset(pin), val); +} + +static inline int +chvgpio_read_pad_cfg1(struct chvgpio_softc *sc, int pin) +{ + return bus_read_4(sc->sc_mem_res, chvgpio_pad_cfg0_offset(pin) + 4); +} + +static device_t +chvgpio_get_bus(device_t dev) +{ + struct chvgpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->sc_busdev); +} + +static int +chvgpio_pin_max(device_t dev, int *maxpin) +{ + struct chvgpio_softc *sc; + + sc = device_get_softc(dev); + + *maxpin = sc->sc_npins - 1; + + return (0); +} + +static int +chvgpio_valid_pin(struct chvgpio_softc *sc, int pin) +{ + if (pin < 0) + return EINVAL; + if ((pin / 15) >= sc->sc_ngroups) + return EINVAL; + if ((pin % 15) >= sc->sc_pins[pin / 15]) + return EINVAL; + return (0); +} + +static int +chvgpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct chvgpio_softc *sc; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + /* return pin name from datasheet */ + snprintf(name, GPIOMAXNAME, "%s", sc->sc_pin_names[pin]); + name[GPIOMAXNAME - 1] = '\0'; + return (0); +} + +static int +chvgpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct chvgpio_softc *sc; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + *caps = 0; + if (chvgpio_valid_pin(sc, pin)) + *caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + + return (0); +} + +static int +chvgpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct chvgpio_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + *flags = 0; + + /* Get the current pin state */ + CHVGPIO_LOCK(sc); + val = chvgpio_read_pad_cfg0(sc, pin); + + if (val & CHVGPIO_PAD_CFG0_GPIOCFG_GPIO || + val & CHVGPIO_PAD_CFG0_GPIOCFG_GPO) + *flags |= GPIO_PIN_OUTPUT; + + if (val & CHVGPIO_PAD_CFG0_GPIOCFG_GPIO || + val & CHVGPIO_PAD_CFG0_GPIOCFG_GPI) + *flags |= GPIO_PIN_INPUT; + + val = chvgpio_read_pad_cfg1(sc, pin); + + CHVGPIO_UNLOCK(sc); + return (0); +} + +static int +chvgpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct chvgpio_softc *sc; + uint32_t val; + uint32_t allowed; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + allowed = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + + /* + * Only direction flag allowed + */ + if (flags & ~allowed) + return (EINVAL); + + /* + * Not both directions simultaneously + */ + if ((flags & allowed) == allowed) + return (EINVAL); + + /* Set the GPIO mode and state */ + CHVGPIO_LOCK(sc); + val = chvgpio_read_pad_cfg0(sc, pin); + if (flags & GPIO_PIN_INPUT) + val = val & CHVGPIO_PAD_CFG0_GPIOCFG_GPI; + if (flags & GPIO_PIN_OUTPUT) + val = val & CHVGPIO_PAD_CFG0_GPIOCFG_GPO; + chvgpio_write_pad_cfg0(sc, pin, val); + CHVGPIO_UNLOCK(sc); + + return (0); +} + +static int +chvgpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct chvgpio_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + CHVGPIO_LOCK(sc); + val = chvgpio_read_pad_cfg0(sc, pin); + if (value == GPIO_PIN_LOW) + val = val & ~CHVGPIO_PAD_CFG0_GPIOTXSTATE; + else + val = val | CHVGPIO_PAD_CFG0_GPIOTXSTATE; + chvgpio_write_pad_cfg0(sc, pin, val); + CHVGPIO_UNLOCK(sc); + + return (0); +} + +static int +chvgpio_pin_get(device_t dev, uint32_t pin, unsigned int *value) +{ + struct chvgpio_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + CHVGPIO_LOCK(sc); + + /* Read pin value */ + val = chvgpio_read_pad_cfg0(sc, pin); + if (val & CHVGPIO_PAD_CFG0_GPIORXSTATE) + *value = GPIO_PIN_HIGH; + else + *value = GPIO_PIN_LOW; + + CHVGPIO_UNLOCK(sc); + + return (0); +} + +static int +chvgpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct chvgpio_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); + if (chvgpio_valid_pin(sc, pin) != 0) + return (EINVAL); + + CHVGPIO_LOCK(sc); + + /* Toggle the pin */ + val = chvgpio_read_pad_cfg0(sc, pin); + val = val ^ CHVGPIO_PAD_CFG0_GPIOTXSTATE; + chvgpio_write_pad_cfg0(sc, pin, val); + + CHVGPIO_UNLOCK(sc); + + return (0); +} + +static char *chvgpio_hids[] = { + "INT33FF", + NULL +}; + +static int +chvgpio_probe(device_t dev) +{ + if (acpi_disabled("chvgpio") || + ACPI_ID_PROBE(device_get_parent(dev), dev, chvgpio_hids) == NULL) + return (ENXIO); + + device_set_desc(dev, "Intel Cherry View GPIO"); + return (0); +} + +static int +chvgpio_attach(device_t dev) +{ + struct chvgpio_softc *sc; + ACPI_STATUS status; + int uid; + int i; + int error; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_handle = acpi_get_handle(dev); + + status = acpi_GetInteger(sc->sc_handle, "_UID", &uid); + if (ACPI_FAILURE(status)) { + device_printf(dev, "failed to read _UID\n"); + return (ENXIO); + } + + CHVGPIO_LOCK_INIT(sc); + + switch (uid) { + case SW_UID: + sc->sc_bank_prefix = SW_BANK_PREFIX; + sc->sc_pins = chv_southwest_pins; + sc->sc_pin_names = chv_southwest_pin_names; + break; + case N_UID: + sc->sc_bank_prefix = N_BANK_PREFIX; + sc->sc_pins = chv_north_pins; + sc->sc_pin_names = chv_north_pin_names; + break; + case E_UID: + sc->sc_bank_prefix = E_BANK_PREFIX; + sc->sc_pins = chv_east_pins; + sc->sc_pin_names = chv_east_pin_names; + break; + case SE_UID: + sc->sc_bank_prefix = SE_BANK_PREFIX; + sc->sc_pins = chv_southeast_pins; + sc->sc_pin_names = chv_southeast_pin_names; + break; + default: + device_printf(dev, "invalid _UID value: %d\n", uid); + return (ENXIO); + } + + for (i = 0; sc->sc_pins[i] >= 0; i++) { + sc->sc_npins += sc->sc_pins[i]; + sc->sc_ngroups++; + } + + sc->sc_mem_rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(sc->sc_dev, SYS_RES_MEMORY, + &sc->sc_mem_rid, RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + CHVGPIO_LOCK_DESTROY(sc); + device_printf(dev, "can't allocate memory resource\n"); + return (ENOMEM); + } + + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->sc_irq_rid, RF_ACTIVE); + + if (!sc->sc_irq_res) { + CHVGPIO_LOCK_DESTROY(sc); + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + device_printf(dev, "can't allocate irq resource\n"); + return (ENOMEM); + } + + error = bus_setup_intr(sc->sc_dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, chvgpio_intr, sc, &sc->intr_handle); + + + if (error) { + device_printf(sc->sc_dev, "unable to setup irq: error %d\n", error); + CHVGPIO_LOCK_DESTROY(sc); + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_irq_rid, sc->sc_irq_res); + return (ENXIO); + } + + /* Mask and ack all interrupts. */ + bus_write_4(sc->sc_mem_res, CHVGPIO_INTERRUPT_MASK, 0); + bus_write_4(sc->sc_mem_res, CHVGPIO_INTERRUPT_STATUS, 0xffff); + + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) { + CHVGPIO_LOCK_DESTROY(sc); + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_irq_rid, sc->sc_irq_res); + return (ENXIO); + } + + return (0); +} + +static void +chvgpio_intr(void *arg) +{ + struct chvgpio_softc *sc = arg; + uint32_t reg; + int line; + + reg = bus_read_4(sc->sc_mem_res, CHVGPIO_INTERRUPT_STATUS); + for (line = 0; line < 16; line++) { + if ((reg & (1 << line)) == 0) + continue; + bus_write_4(sc->sc_mem_res, CHVGPIO_INTERRUPT_STATUS, 1 << line); + } +} + +static int +chvgpio_detach(device_t dev) +{ + struct chvgpio_softc *sc; + sc = device_get_softc(dev); + + if (sc->sc_busdev) + gpiobus_detach_bus(dev); + + if (sc->intr_handle != NULL) + bus_teardown_intr(sc->sc_dev, sc->sc_irq_res, sc->intr_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq_res); + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, sc->sc_mem_res); + + CHVGPIO_LOCK_DESTROY(sc); + + return (0); +} + +static device_method_t chvgpio_methods[] = { + DEVMETHOD(device_probe, chvgpio_probe), + DEVMETHOD(device_attach, chvgpio_attach), + DEVMETHOD(device_detach, chvgpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, chvgpio_get_bus), + DEVMETHOD(gpio_pin_max, chvgpio_pin_max), + DEVMETHOD(gpio_pin_getname, chvgpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, chvgpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, chvgpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, chvgpio_pin_setflags), + DEVMETHOD(gpio_pin_get, chvgpio_pin_get), + DEVMETHOD(gpio_pin_set, chvgpio_pin_set), + DEVMETHOD(gpio_pin_toggle, chvgpio_pin_toggle), + + DEVMETHOD_END +}; + +static driver_t chvgpio_driver = { + .name = "gpio", + .methods = chvgpio_methods, + .size = sizeof(struct chvgpio_softc) +}; + +static devclass_t chvgpio_devclass; +DRIVER_MODULE(chvgpio, acpi, chvgpio_driver, chvgpio_devclass, NULL , NULL); +MODULE_DEPEND(chvgpio, acpi, 1, 1, 1); +MODULE_DEPEND(chvgpio, gpiobus, 1, 1, 1); + +MODULE_VERSION(chvgpio, 1); Added: head/sys/dev/gpio/chvgpio_reg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/chvgpio_reg.h Thu Feb 22 19:12:32 2018 (r329832) @@ -0,0 +1,337 @@ +/*- + * Copyright (c) 2017 Tom Jones + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Copyright (c) 2016 Mark Kettenis + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + + +#define CHVGPIO_INTERRUPT_STATUS 0x0300 +#define CHVGPIO_INTERRUPT_MASK 0x0380 +#define CHVGPIO_PAD_CFG0 0x4400 +#define CHVGPIO_PAD_CFG1 0x4404 + +#define CHVGPIO_PAD_CFG0_GPIORXSTATE 0x00000001 +#define CHVGPIO_PAD_CFG0_GPIOTXSTATE 0x00000002 +#define CHVGPIO_PAD_CFG0_INTSEL_MASK 0xf0000000 +#define CHVGPIO_PAD_CFG0_INTSEL_SHIFT 28 + +#define CHVGPIO_PAD_CFG0_GPIOCFG_SHIFT 8 +#define CHVGPIO_PAD_CFG0_GPIOCFG_MASK (7 << CHVGPIO_PAD_CFG0_GPIOCFG_SHIFT) +#define CHVGPIO_PAD_CFG0_GPIOCFG_GPIO 0 +#define CHVGPIO_PAD_CFG0_GPIOCFG_GPO 1 +#define CHVGPIO_PAD_CFG0_GPIOCFG_GPI 2 +#define CHVGPIO_PAD_CFG0_GPIOCFG_HIZ 3 + +#define CHVGPIO_PAD_CFG1_INTWAKECFG_MASK 0x00000007 +#define CHVGPIO_PAD_CFG1_INTWAKECFG_FALLING 0x00000001 +#define CHVGPIO_PAD_CFG1_INTWAKECFG_RISING 0x00000002 +#define CHVGPIO_PAD_CFG1_INTWAKECFG_BOTH 0x00000003 +#define CHVGPIO_PAD_CFG1_INTWAKECFG_LEVEL 0x00000004 +#define CHVGPIO_PAD_CFG1_INVRXTX_MASK 0x000000f0 +#define CHVGPIO_PAD_CFG1_INVRXTX_RXDATA 0x00000040 + +/* + * The pads for the pins are arranged in groups of maximal 15 pins. + * The arrays below give the number of pins per group, such that we + * can validate the (untrusted) pin numbers from ACPI. + */ +#define E_UID 3 +#define E_BANK_PREFIX "eastbank" + +const int chv_east_pins[] = { + 12, 12, -1 +}; + +const char *chv_east_pin_names[] = { + "PMU_SLP_S3_B", + "PMU_BATLOW_B", + "SUS_STAT_B", + "PMU_SLP_S0IX_B", + "PMU_AC_PRESENT", + "PMU_PLTRST_B", + "PMU_SUSCLK", + "PMU_SLP_LAN_B", + "PMU_PWRBTN_B", + "PMU_SLP_S4_B", + "PMU_WAKE_B", + "PMU_WAKE_LAN_B" + + "MF_ISH_GPIO_3", + "MF_ISH_GPIO_7", + "MF_ISH_I2C1_SCL", + "MF_ISH_GPIO_1", + "MF_ISH_GPIO_5", + "MF_ISH_GPIO_9", + "MF_ISH_GPIO_0", + "MF_ISH_GPIO_4", + "MF_ISH_GPIO_8", + "MF_ISH_GPIO_2", + "MF_ISH_GPIO_6", + "MF_ISH_I2C1_SDA" +}; + +#define N_UID 2 +#define N_BANK_PREFIX "northbank" + +const int chv_north_pins[] = { + 9, 13, 12, 12, 13, -1 +}; + +const char *chv_north_pin_names[] = { + "GPIO_DFX0_PAD", + "GPIO_DFX3_PAD", + "GPIO_DFX7_PAD", + "GPIO_DFX1_PAD", + "GPIO_DFX5_PAD", + "GPIO_DFX4_PAD", + "GPIO_DFX8_PAD", + "GPIO_DFX2_PAD", + "GPIO_DFX6_PAD", + + "GPIO_SUS0_PAD", + "SEC_GPIO_SUS10_PAD", + "GPIO_SUS3_PAD", + "GPIO_SUS7_PAD", + "GPIO_SUS1_PAD", + "GPIO_SUS5_PAD", + "SEC_GPIO_SUS11_PAD", + "GPIO_SUS4_PAD", + "SEC_GPIO_SUS8_PAD", + "GPIO_SUS2_PAD", + "GPIO_SUS6_PAD", + "CX_PREQ_B_PAD", + "SEC_GPIO_SUS9_PAD", + + "TRST_B_PAD", + "TCK_PAD", + "PROCHOT_B_PAD", + "SVID0_DATA_PAD", + "TMS_PAD", + "CX_PRDY_B_2_PAD", + "TDO_2_PAD", + "CX_PRDY_B_PAD", + "SVID0_ALERT_B_PAD", + "TDO_PAD", + "SVID0_CLK_PAD", + "TDI_PAD", + + "GP_CAMERASB05_PAD", + "GP_CAMERASB02_PAD", + "GP_CAMERASB08_PAD", + "GP_CAMERASB00_PAD", + "GP_CAMERASB06_PAD", + "GP_CAMERASB10_PAD", + "GP_CAMERASB03_PAD", + "GP_CAMERASB09_PAD", + "GP_CAMERASB01_PAD", + "GP_CAMERASB07_PAD", + "GP_CAMERASB11_PAD", + "GP_CAMERASB04_PAD", + + "PANEL0_BKLTEN_PAD", + "HV_DDI0_HPD_PAD", + "HV_DDI2_DDC_SDA_PAD", + "PANEL1_BKLTCTL_PAD", + "HV_DDI1_HPD_PAD", + "PANEL0_BKLTCTL_PAD", + "HV_DDI0_DDC_SDA_PAD", + "HV_DDI2_DDC_SCL_PAD", + "HV_DDI2_HPD_PAD", + "PANEL1_VDDEN_PAD", + "PANEL1_BKLTEN_PAD", + "HV_DDI0_DDC_SCL_PAD", + "PANEL0_VDDEN_PAD", +}; + + +#define SE_UID 4 +#define SE_BANK_PREFIX "southeastbank" + +const int chv_southeast_pins[] = { + 8, 12, 6, 8, 10, 11, -1 +}; + +const char *chv_southeast_pin_names[] = { + "MF_PLT_CLK0_PAD", + "PWM1_PAD", + "MF_PLT_CLK1_PAD", + "MF_PLT_CLK4_PAD", + "MF_PLT_CLK3_PAD", + "PWM0_PAD", + "MF_PLT_CLK5_PAD", + "MF_PLT_CLK2_PAD", + + "SDMMC2_D3_CD_B_PAD", + "SDMMC1_CLK_PAD", + "SDMMC1_D0_PAD", + "SDMMC2_D1_PAD", + "SDMMC2_CLK_PAD", + "SDMMC1_D2_PAD", + "SDMMC2_D2_PAD", + "SDMMC2_CMD_PAD", + "SDMMC1_CMD_PAD", + "SDMMC1_D1_PAD", + "SDMMC2_D0_PAD", + "SDMMC1_D3_CD_B_PAD", + + "SDMMC3_D1_PAD", + "SDMMC3_CLK_PAD", + "SDMMC3_D3_PAD", + "SDMMC3_D2_PAD", + "SDMMC3_CMD_PAD", + "SDMMC3_D0_PAD", + + "MF_LPC_AD2_PAD", + "LPC_CLKRUNB_PAD", + "MF_LPC_AD0_PAD", + "LPC_FRAMEB_PAD", + "MF_LPC_CLKOUT1_PAD", + "MF_LPC_AD3_PAD", + "MF_LPC_CLKOUT0_PAD", + "MF_LPC_AD1_PAD", + + "SPI1_MISO_PAD", + "SPI1_CS0_B_PAD", + "SPI1_CLK_PAD", + "MMC1_D6_PAD", + "SPI1_MOSI_PAD", + "MMC1_D5_PAD", + "SPI1_CS1_B_PAD", + "MMC1_D4_SD_WE_PAD", + "MMC1_D7_PAD", + "MMC1_RCLK_PAD", + + "USB_OC1_B_PAD", + "PMU_RESETBUTTON_B_PAD", + "GPIO_ALERT_PAD", + "SDMMC3_PWR_EN_B_PAD", + "ILB_SERIRQ_PAD", + "USB_OC0_B_PAD", + "SDMMC3_CD_B_PAD", + "SPKR_PAD", + "SUSPWRDNACK_PAD", + "SPARE_PIN_PAD", + "SDMMC3_1P8_EN_PAD", +}; + +#define SW_UID 1 +#define SW_BANK_PREFIX "southwestbank" + +const int chv_southwest_pins[] = { + 8, 8, 8, 8, 8, 8, 8, -1 +}; + +const char *chv_southwest_pin_names[] = { + "FST_SPI_D2_PAD", + "FST_SPI_D0_PAD", + "FST_SPI_CLK_PAD", + "FST_SPI_D3_PAD", + "FST_SPI_CS1_B_PAD", + "FST_SPI_D1_PAD", + "FST_SPI_CS0_B_PAD", + "FST_SPI_CS2_B_PAD", + + "UART1_RTS_B_PAD", + "UART1_RXD_PAD", + "UART2_RXD_PAD", + "UART1_CTS_B_PAD", + "UART2_RTS_B_PAD", + "UART1_TXD_PAD", + "UART2_TXD_PAD", + "UART2_CTS_B_PAD", + + "MF_HDA_CLK" + "MF_HDA_RSTB", + "MF_HDA_SDIO", + "MF_HDA_SDO", + "MF_HDA_DOCKRSTB", + "MF_HDA_SYNC", + "MF_HDA_SDI1", + "MF_HDA_DOCKENB", + + "I2C5_SDA_PAD", + "I2C4_SDA_PAD", + "I2C6_SDA_PAD", + "I2C5_SCL_PAD", + "I2C_NFC_SDA_PAD", + "I2C4_SCL_PAD", + "I2C6_SCL_PAD", + "I2C_NFC_SCL_PAD", + + "I2C1_SDA_PAD", + "I2C0_SDA_PAD", + "I2C2_SDA_PAD", + "I2C1_SCL_PAD", + "I2C3_SDA_PAD", + "I2C0_SCL_PAD", + "I2C2_SCL_PAD", + "I2C3_SCL_PAD", + + "SATA_GP0", + "SATA_GP1", + "SATA_LEDN", + "SATA_GP2", + "MF_SMB_ALERTB", + "SATA_GP3", + "MF_SMB_CLK", + "MF_SMB_DATA", + + "PCIE_CLKREQ0B_PAD", + "PCIE_CLKREQ1B_PAD", + "GP_SSP_2_CLK_PAD", + "PCIE_CLKREQ2B_PAD", + "GP_SSP_2_RXD_PAD", + "PCIE_CLKREQ3B_PAD", + "GP_SSP_2_FS_PAD", + "GP_SSP_2_TXD_PAD", +}; + +const char *virtualgpio[] = { + "VIRTUAL0_PAD", + "VIRTUAL1_PAD", + "VIRTUAL2_PAD", + "VIRTUAL3_PAD", + "VIRTUAL4_PAD", + "VIRTUAL5_PAD", + "VIRTUAL6_PAD", + "VIRTUAL7_PAD", +}; Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Feb 22 18:49:53 2018 (r329831) +++ head/sys/modules/Makefile Thu Feb 22 19:12:32 2018 (r329832) @@ -74,6 +74,7 @@ SUBDIR= \ bwi \ bwn \ ${_bytgpio} \ + ${_chvgpio} \ cam \ ${_cardbus} \ ${_carp} \ @@ -636,6 +637,7 @@ _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _bytgpio= bytgpio +_chvgpio= chvgpio _ciss= ciss _chromebook_platform= chromebook_platform _cmx= cmx Added: head/sys/modules/chvgpio/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/chvgpio/Makefile Thu Feb 22 19:12:32 2018 (r329832) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/gpio +KMOD= chvgpio +SRCS= chvgpio.c +SRCS+= acpi_if.h device_if.h bus_if.h gpio_if.h opt_acpi.h opt_platform.h + +.include From owner-svn-src-all@freebsd.org Thu Feb 22 19:39:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA685F24AB2; Thu, 22 Feb 2018 19:39:45 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F6087470B; Thu, 22 Feb 2018 19:39:45 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4602C4364; Thu, 22 Feb 2018 19:39:45 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MJdjG0093977; Thu, 22 Feb 2018 19:39:45 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MJdjIE093976; Thu, 22 Feb 2018 19:39:45 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802221939.w1MJdjIE093976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 22 Feb 2018 19:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329833 - stable/11/sys/dev/mxge X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/11/sys/dev/mxge X-SVN-Commit-Revision: 329833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 19:39:45 -0000 Author: rpokala Date: Thu Feb 22 19:39:44 2018 New Revision: 329833 URL: https://svnweb.freebsd.org/changeset/base/329833 Log: MFC r329295: Panasas discovered that ioctl(SIOCGLAGGPORT) returns ENOTTY for mxge(4) when the NIC is not a member of a lagg. This came as a surprise, because the SIOCGLAGGPORT handler in if_lagg.c only returns ENOENT (if run against the laggX interface, rather than a physical port) or EINVAL (if run against a non-member physical port). This behavior was not seen with other drivers, such as bge(4), igb(4), and cxl(4). When I compared their respective ioctl handlers, I found that they all called ether_ioctl() for the default (i.e. unhandled) case; by contrast, mxge(4) only calls ether_ioctl() for two specific cases, and returns ENOTTY for the default case. Remove the two cases which explicitly call ether_ioctl(), and let the default case call it instead. This matches what the vast majority of the NIC drivers do. Modified: stable/11/sys/dev/mxge/if_mxge.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/11/sys/dev/mxge/if_mxge.c Thu Feb 22 19:12:32 2018 (r329832) +++ stable/11/sys/dev/mxge/if_mxge.c Thu Feb 22 19:39:44 2018 (r329833) @@ -4161,11 +4161,6 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t err = 0; switch (command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - err = ether_ioctl(ifp, command, data); - break; - case SIOCSIFMTU: err = mxge_change_mtu(sc, ifr->ifr_mtu); break; @@ -4289,7 +4284,8 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t break; default: - err = ENOTTY; + err = ether_ioctl(ifp, command, data); + break; } return err; } From owner-svn-src-all@freebsd.org Thu Feb 22 19:40:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 440ECF24B36; Thu, 22 Feb 2018 19:40:04 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAD7B7482E; Thu, 22 Feb 2018 19:40:03 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5C4B4368; Thu, 22 Feb 2018 19:40:03 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MJe3CU094064; Thu, 22 Feb 2018 19:40:03 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MJe3IA094063; Thu, 22 Feb 2018 19:40:03 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802221940.w1MJe3IA094063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 22 Feb 2018 19:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329834 - stable/10/sys/dev/mxge X-SVN-Group: stable-10 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/10/sys/dev/mxge X-SVN-Commit-Revision: 329834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 19:40:04 -0000 Author: rpokala Date: Thu Feb 22 19:40:03 2018 New Revision: 329834 URL: https://svnweb.freebsd.org/changeset/base/329834 Log: MFC r329295: Panasas discovered that ioctl(SIOCGLAGGPORT) returns ENOTTY for mxge(4) when the NIC is not a member of a lagg. This came as a surprise, because the SIOCGLAGGPORT handler in if_lagg.c only returns ENOENT (if run against the laggX interface, rather than a physical port) or EINVAL (if run against a non-member physical port). This behavior was not seen with other drivers, such as bge(4), igb(4), and cxl(4). When I compared their respective ioctl handlers, I found that they all called ether_ioctl() for the default (i.e. unhandled) case; by contrast, mxge(4) only calls ether_ioctl() for two specific cases, and returns ENOTTY for the default case. Remove the two cases which explicitly call ether_ioctl(), and let the default case call it instead. This matches what the vast majority of the NIC drivers do. Modified: stable/10/sys/dev/mxge/if_mxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/10/sys/dev/mxge/if_mxge.c Thu Feb 22 19:39:44 2018 (r329833) +++ stable/10/sys/dev/mxge/if_mxge.c Thu Feb 22 19:40:03 2018 (r329834) @@ -4168,11 +4168,6 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t err = 0; switch (command) { - case SIOCSIFADDR: - case SIOCGIFADDR: - err = ether_ioctl(ifp, command, data); - break; - case SIOCSIFMTU: err = mxge_change_mtu(sc, ifr->ifr_mtu); break; @@ -4296,7 +4291,8 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t break; default: - err = ENOTTY; + err = ether_ioctl(ifp, command, data); + break; } return err; } From owner-svn-src-all@freebsd.org Thu Feb 22 20:09:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E821DF272AF; Thu, 22 Feb 2018 20:09:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 985697708F; Thu, 22 Feb 2018 20:09:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EA42484E; Thu, 22 Feb 2018 20:09:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MK9LFh011877; Thu, 22 Feb 2018 20:09:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MK9LfX011876; Thu, 22 Feb 2018 20:09:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802222009.w1MK9LfX011876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Feb 2018 20:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329835 - stable/10/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 329835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 20:09:22 -0000 Author: hselasky Date: Thu Feb 22 20:09:21 2018 New Revision: 329835 URL: https://svnweb.freebsd.org/changeset/base/329835 Log: Fix for LINT-NOINET kernel build. This is a direct commit. Reported by: rpokala@ Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/addr.c Modified: stable/10/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/addr.c Thu Feb 22 19:40:03 2018 (r329834) +++ stable/10/sys/ofed/drivers/infiniband/core/addr.c Thu Feb 22 20:09:21 2018 (r329835) @@ -194,7 +194,7 @@ static int addr_resolve(struct sockaddr *src_in, struct ifaddr *ifa; struct ifnet *ifp; struct rtentry *rte; -#if defined(INET) || defined(INET6) +#if defined(INET) struct llentry *lle; #endif #if defined(INET6) From owner-svn-src-all@freebsd.org Thu Feb 22 20:10:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5A52F273E2; Thu, 22 Feb 2018 20:10:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 58A11771EB; Thu, 22 Feb 2018 20:10:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 538F54852; Thu, 22 Feb 2018 20:10:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MKAO87011988; Thu, 22 Feb 2018 20:10:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MKAOPG011985; Thu, 22 Feb 2018 20:10:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802222010.w1MKAOPG011985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 22 Feb 2018 20:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329836 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 20:10:24 -0000 Author: kevans Date: Thu Feb 22 20:10:23 2018 New Revision: 329836 URL: https://svnweb.freebsd.org/changeset/base/329836 Log: lualoader: Attend to some 80-col issues, pointed out by luacheck Graphics have a tendency to cause 80-col issues, so make an exception to our standard indentation guidelines for these graphics. This does not hamper readability too badly. Two 40-column strings of spaces is trivially replaced with string.rep(" ", 80) Modified: head/stand/lua/config.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Thu Feb 22 20:09:21 2018 (r329835) +++ head/stand/lua/config.lua Thu Feb 22 20:10:23 2018 (r329836) @@ -336,7 +336,8 @@ function config.loadkernel(other_kernel) local try_load = function (names) for name in names:gmatch("([^;]+)%s*;?") do - local r = loader.perform("load " .. flags .. " " .. name) + local r = loader.perform("load " .. flags .. + " " .. name) if r == 0 then return name end Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Thu Feb 22 20:09:21 2018 (r329835) +++ head/stand/lua/drawer.lua Thu Feb 22 20:10:23 2018 (r329836) @@ -65,109 +65,109 @@ local shift_brand_text = function(shift) end fbsd_logo = { - " ______ ____ _____ _____ ", - " | ____| | _ \\ / ____| __ \\ ", - " | |___ _ __ ___ ___ | |_) | (___ | | | |", - " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", - " | | | | | __/ __/| |_) |____) | |__| |", - " | | | | | | || | | |", - " |_| |_| \\___|\\___||____/|_____/|_____/ " +" ______ ____ _____ _____ ", +" | ____| | _ \\ / ____| __ \\ ", +" | |___ _ __ ___ ___ | |_) | (___ | | | |", +" | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", +" | | | | | __/ __/| |_) |____) | |__| |", +" | | | | | | || | | |", +" |_| |_| \\___|\\___||____/|_____/|_____/ " } beastie_color = { - " \027[31m, ,", - " /( )`", - " \\ \\___ / |", - " /- \027[37m_\027[31m `-/ '", - " (\027[37m/\\/ \\\027[31m \\ /\\", - " \027[37m/ / |\027[31m ` \\", - " \027[34mO O \027[37m) \027[31m/ |", - " \027[37m`-^--'\027[31m`< '", - " (_.) _ ) /", - " `.___/` /", - " `-----' /", - " \027[33m<----.\027[31m __ / __ \\", - " \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|", - " \027[33m<----'\027[31m `--' `.__,' \\", - " | |", - " \\ / /\\", - " \027[36m______\027[31m( (_ / \\______/", - " \027[36m,' ,-----' |", - " `--{__________)\027[37m" +" \027[31m, ,", +" /( )`", +" \\ \\___ / |", +" /- \027[37m_\027[31m `-/ '", +" (\027[37m/\\/ \\\027[31m \\ /\\", +" \027[37m/ / |\027[31m ` \\", +" \027[34mO O \027[37m) \027[31m/ |", +" \027[37m`-^--'\027[31m`< '", +" (_.) _ ) /", +" `.___/` /", +" `-----' /", +" \027[33m<----.\027[31m __ / __ \\", +" \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|", +" \027[33m<----'\027[31m `--' `.__,' \\", +" | |", +" \\ / /\\", +" \027[36m______\027[31m( (_ / \\______/", +" \027[36m,' ,-----' |", +" `--{__________)\027[37m" } beastie = { - " , ,", - " /( )`", - " \\ \\___ / |", - " /- _ `-/ '", - " (/\\/ \\ \\ /\\", - " / / | ` \\", - " O O ) / |", - " `-^--'`< '", - " (_.) _ ) /", - " `.___/` /", - " `-----' /", - " <----. __ / __ \\", - " <----|====O)))==) \\) /====|", - " <----' `--' `.__,' \\", - " | |", - " \\ / /\\", - " ______( (_ / \\______/", - " ,' ,-----' |", - " `--{__________)" +" , ,", +" /( )`", +" \\ \\___ / |", +" /- _ `-/ '", +" (/\\/ \\ \\ /\\", +" / / | ` \\", +" O O ) / |", +" `-^--'`< '", +" (_.) _ ) /", +" `.___/` /", +" `-----' /", +" <----. __ / __ \\", +" <----|====O)))==) \\) /====|", +" <----' `--' `.__,' \\", +" | |", +" \\ / /\\", +" ______( (_ / \\______/", +" ,' ,-----' |", +" `--{__________)" } fbsd_logo_v = { - " ______", - " | ____| __ ___ ___ ", - " | |__ | '__/ _ \\/ _ \\", - " | __|| | | __/ __/", - " | | | | | | |", - " |_| |_| \\___|\\___|", - " ____ _____ _____", - " | _ \\ / ____| __ \\", - " | |_) | (___ | | | |", - " | _ < \\___ \\| | | |", - " | |_) |____) | |__| |", - " | | | |", - " |____/|_____/|_____/" +" ______", +" | ____| __ ___ ___ ", +" | |__ | '__/ _ \\/ _ \\", +" | __|| | | __/ __/", +" | | | | | | |", +" |_| |_| \\___|\\___|", +" ____ _____ _____", +" | _ \\ / ____| __ \\", +" | |_) | (___ | | | |", +" | _ < \\___ \\| | | |", +" | |_) |____) | |__| |", +" | | | |", +" |____/|_____/|_____/" } orb_color = { - " \027[31m``` \027[31;1m`\027[31m", - " s` `.....---...\027[31;1m....--.``` -/\027[31m", - " +o .--` \027[31;1m/y:` +.\027[31m", - " yo`:. \027[31;1m:o `+-\027[31m", - " y/ \027[31;1m-/` -o/\027[31m", - " .- \027[31;1m::/sy+:.\027[31m", - " / \027[31;1m`-- /\027[31m", - " `: \027[31;1m:`\027[31m", - " `: \027[31;1m:`\027[31m", - " / \027[31;1m/\027[31m", - " .- \027[31;1m-.\027[31m", - " -- \027[31;1m-.\027[31m", - " `:` \027[31;1m`:`", - " \027[31;1m.-- `--.", - " .---.....----.\027[37m" +" \027[31m``` \027[31;1m`\027[31m", +" s` `.....---...\027[31;1m....--.``` -/\027[31m", +" +o .--` \027[31;1m/y:` +.\027[31m", +" yo`:. \027[31;1m:o `+-\027[31m", +" y/ \027[31;1m-/` -o/\027[31m", +" .- \027[31;1m::/sy+:.\027[31m", +" / \027[31;1m`-- /\027[31m", +" `: \027[31;1m:`\027[31m", +" `: \027[31;1m:`\027[31m", +" / \027[31;1m/\027[31m", +" .- \027[31;1m-.\027[31m", +" -- \027[31;1m-.\027[31m", +" `:` \027[31;1m`:`", +" \027[31;1m.-- `--.", +" .---.....----.\027[37m" } orb = { - " ``` `", - " s` `.....---.......--.``` -/", - " +o .--` /y:` +.", - " yo`:. :o `+-", - " y/ -/` -o/", - " .- ::/sy+:.", - " / `-- /", - " `: :`", - " `: :`", - " / /", - " .- -.", - " -- -.", - " `:` `:`", - " .-- `--.", - " .---.....----." +" ``` `", +" s` `.....---.......--.``` -/", +" +o .--` /y:` +.", +" yo`:. :o `+-", +" y/ -/` -o/", +" .- ::/sy+:.", +" / `-- /", +" `: :`", +" `: :`", +" / /", +" .- -.", +" -- -.", +" `:` `:`", +" .-- `--.", +" .---.....----." } none = {""} Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Thu Feb 22 20:09:21 2018 (r329835) +++ head/stand/lua/menu.lua Thu Feb 22 20:10:23 2018 (r329836) @@ -456,8 +456,7 @@ function menu.autoboot() else -- erase autoboot msg screen.setcursor(0, y) - print(" " - .. " ") + print(string.rep(" ", 80)) screen.defcursor() return ch end From owner-svn-src-all@freebsd.org Thu Feb 22 20:39:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F855F29009; Thu, 22 Feb 2018 20:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C59E78309; Thu, 22 Feb 2018 20:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373804D2F; Thu, 22 Feb 2018 20:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MKdQRP026317; Thu, 22 Feb 2018 20:39:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MKdQIj026316; Thu, 22 Feb 2018 20:39:26 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802222039.w1MKdQIj026316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 22 Feb 2018 20:39:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329837 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 20:39:26 -0000 Author: mjg Date: Thu Feb 22 20:39:25 2018 New Revision: 329837 URL: https://svnweb.freebsd.org/changeset/base/329837 Log: Fix up sysctl vfs.buffercache broken in r329612 Sample problem: top: sysctl(vfs.bufspace...) expected 8, got 4 Reported by: O. Hartmann Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Feb 22 20:10:23 2018 (r329836) +++ head/sys/kern/vfs_bio.c Thu Feb 22 20:39:25 2018 (r329837) @@ -423,7 +423,7 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) lvalue = 0; for (i = 0; i < clean_domains; i++) lvalue += bdclean[i].bd_bufspace; - return (sysctl_handle_int(oidp, &lvalue, 0, req)); + return (sysctl_handle_long(oidp, &lvalue, 0, req)); } #endif From owner-svn-src-all@freebsd.org Thu Feb 22 20:48:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA64AF29AFF; Thu, 22 Feb 2018 20:48:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5793E78BE4; Thu, 22 Feb 2018 20:48:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E8A64ED5; Thu, 22 Feb 2018 20:48:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MKm3rx031764; Thu, 22 Feb 2018 20:48:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MKm3LR031763; Thu, 22 Feb 2018 20:48:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802222048.w1MKm3LR031763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Feb 2018 20:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329838 - stable/10/sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/conf X-SVN-Commit-Revision: 329838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 20:48:03 -0000 Author: hselasky Date: Thu Feb 22 20:48:02 2018 New Revision: 329838 URL: https://svnweb.freebsd.org/changeset/base/329838 Log: Fix for LINT kernel build. This is a direct commit. Discussed with: np@ Reported by: rpokala@ Sponsored by: Mellanox Technologies Modified: stable/10/sys/conf/files Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Feb 22 20:39:25 2018 (r329837) +++ stable/10/sys/conf/files Thu Feb 22 20:48:02 2018 (r329838) @@ -3590,6 +3590,7 @@ netinet/tcp_syncache.c optional inet | inet6 netinet/tcp_timer.c optional inet | inet6 netinet/tcp_timewait.c optional inet | inet6 netinet/tcp_usrreq.c optional inet | inet6 +netinet/toecore.c optional ofed netinet/udp_usrreq.c optional inet | inet6 netinet/libalias/alias.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_db.c optional libalias inet | netgraph_nat inet From owner-svn-src-all@freebsd.org Thu Feb 22 22:25:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A974F06D71; Thu, 22 Feb 2018 22:25:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00BC27C62F; Thu, 22 Feb 2018 22:25:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFD195EA7; Thu, 22 Feb 2018 22:25:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MMPQ6a081413; Thu, 22 Feb 2018 22:25:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MMPQoC081412; Thu, 22 Feb 2018 22:25:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802222225.w1MMPQoC081412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 22 Feb 2018 22:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329841 - head/sys/modules/imx/imx_i2c X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/imx/imx_i2c X-SVN-Commit-Revision: 329841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 22:25:27 -0000 Author: ian Date: Thu Feb 22 22:25:26 2018 New Revision: 329841 URL: https://svnweb.freebsd.org/changeset/base/329841 Log: Add a missing line continuation. How many commits does it take to get a simple module makefile working? Apparently at least three. Pointy hat to: ian Modified: head/sys/modules/imx/imx_i2c/Makefile Modified: head/sys/modules/imx/imx_i2c/Makefile ============================================================================== --- head/sys/modules/imx/imx_i2c/Makefile Thu Feb 22 22:24:01 2018 (r329840) +++ head/sys/modules/imx/imx_i2c/Makefile Thu Feb 22 22:25:26 2018 (r329841) @@ -8,7 +8,7 @@ SRCS= imx_i2c.c SRCS+= \ bus_if.h \ device_if.h \ - fdt_pinctrl_if.h + fdt_pinctrl_if.h \ gpio_if.h \ iicbus_if.h \ ofw_bus_if.h \ From owner-svn-src-all@freebsd.org Thu Feb 22 23:18:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D666F0BFE5; Thu, 22 Feb 2018 23:18:47 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE4977EA97; Thu, 22 Feb 2018 23:18:46 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D42986735; Thu, 22 Feb 2018 23:18:46 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MNIkp9007069; Thu, 22 Feb 2018 23:18:46 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MNIknL007063; Thu, 22 Feb 2018 23:18:46 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802222318.w1MNIknL007063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 22 Feb 2018 23:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329843 - in head: share/man/man4 sys/conf sys/dev/jedec_dimm sys/modules/i2c sys/modules/i2c/jedec_dimm X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/jedec_dimm sys/modules/i2c sys/modules/i2c/jedec_dimm X-SVN-Commit-Revision: 329843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 23:18:47 -0000 Author: rpokala Date: Thu Feb 22 23:18:46 2018 New Revision: 329843 URL: https://svnweb.freebsd.org/changeset/base/329843 Log: jedec_dimm(4): report asset info and temperatures for DDR3 and DDR4 DIMMs A super-set of the functionality of jedec_ts(4). jedec_dimm(4) reports asset information (Part Number, Serial Number) encoded in the "Serial Presence Detect" (SPD) data on JEDEC DDR3 and DDR4 DIMMs. It also calculates and reports the memory capacity of the DIMM, in megabytes. If the DIMM includes a "Thermal Sensor On DIMM" (TSOD), the temperature is also reported. Reviewed by: cem MFC after: 1 week Relnotes: yes Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D14392 Discussed with: avg, cem Tested by: avg, cem (previous version, no semantic changes) Added: head/share/man/man4/jedec_dimm.4 (contents, props changed) head/sys/dev/jedec_dimm/ head/sys/dev/jedec_dimm/jedec_dimm.c (contents, props changed) head/sys/dev/jedec_dimm/jedec_dimm.h (contents, props changed) head/sys/modules/i2c/jedec_dimm/ head/sys/modules/i2c/jedec_dimm/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/modules/i2c/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Feb 22 23:06:39 2018 (r329842) +++ head/share/man/man4/Makefile Thu Feb 22 23:18:46 2018 (r329843) @@ -248,6 +248,7 @@ MAN= aac.4 \ ixgbe.4 \ ixl.4 \ ixlv.4 \ + jedec_dimm.4 \ jedec_ts.4 \ jme.4 \ joy.4 \ Added: head/share/man/man4/jedec_dimm.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/jedec_dimm.4 Thu Feb 22 23:18:46 2018 (r329843) @@ -0,0 +1,240 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2016 Andriy Gapon +.\" Copyright (c) 2018 Ravi Pokala +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 22, 2018 +.Dt JEDEC_DIMM 4 +.Os +.Sh NAME +.Nm jedec_dimm +.Nd report asset information and temperatures for JEDEC DDR3 / DDR4 DIMMs +.Sh SYNOPSIS +.Bd -ragged -offset indent +.Cd "device jedec_dimm" +.Cd "device smbus" +.Ed +.Pp +Alternatively, to load the driver as a module at boot time, place the following +line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +jedec_dimm_load="YES" +.Ed +.Pp +Addressing information must be manually specified in +.Pa /boot/device.hints : +.Bd -literal -offset indent +.Cd hint.jedec_dimm.0.at="smbus0" +.Cd hint.jedec_dimm.0.addr="0xa0" +.Cd hint.jedec_dimm.0.slotid="Silkscreen" +.Ed +.Sh DESCRIPTION +The +.Nm +driver reports asset information (Part Number, Serial Number) encoded in the +.Dq Serial Presence Detect +(SPD) data on JEDEC DDR3 and DDR4 DIMMs. +It also calculates and reports the memory capacity of the DIMM, in megabytes. +If the DIMM includes a +.Dq Thermal Sensor On DIMM +(TSOD), the temperature is also reported. +.Pp +The +.Nm +driver accesses the SPD and TSOD over the +.Xr smbus 4 . +.Pp +The data is reported via a +.Xr sysctl 8 +interface; all values are read-only: +.Bl -tag -width "dev.jedec_dimm.X.capacity" +.It Va dev.jedec_dimm.X.%desc +a string description of the DIMM, including TSOD and slotid info if present. +.It Va dev.jedec_dimm.X.capacity +the DIMM's memory capacity, in megabytes +.It Va dev.jedec_dimm.X.part +the manufacturer's part number of the DIMM +.It Va dev.jedec_dimm.X.serial +the manufacturer's serial number of the DIMM +.It Va dev.jedec_dimm.X.slotid +a copy of the corresponding hint, if set +.It Va dev.jedec_dimm.X.temp +if a TSOD is present, the reported temperature +.It Va dev.jedec_dimm.X.type +the DIMM type (DDR3 or DDR4) +.El +.Pp +These values are configurable for +.Nm +via +.Xr device.hints 5 : +.Bl -tag -width "hint.jedec_dimm.X.slotid" +.It Va hint.jedec_dimm.X.at +the +.Xr smbus 4 +to which the DIMM is connected +.It Va hint.jedec_dimm.X.addr +the SMBus address of the SPD. +JEDEC specifies that the four most-significant bits of the address are the +.Dq Device Type Identifier +(DTI), and that the DTI of the SPD is 0xa. +Since the least-significant bit of an SMBus address is the read/write bit, and +is always written as 0, that means the four least-significant bits of the +address must be even. +.It Va hint.jedec_dimm.X.slotid +optional slot identifier. +If populated with the DIMM slot name silkscreened on the motherboard, this +provides a mapping between the DIMM slot name and the DIMM serial number. +That mapping is useful for detailed asset tracking, and makes it easier to +physically locate a specific DIMM when doing a replacement. +This is useful when assembling multiple identical systems, as might be done by +a system vendor. +The mapping between bus/address and DIMM slot must first be determined, either +through motherboard documentation or trial-and-error. +.El +.Pp +If the DIMMs are on an I2C bus behind an +.Xr iicbus 4 +controller, then the +.Xr iicsmb 4 +bridge driver can be used to attach the +.Xr smbus 4 . +.Sh EXAMPLES +Consider two DDR4 DIMMs with the following hints: +.Bd -literal -offset indent +hint.jedec_dimm.0.at="smbus0" +hint.jedec_dimm.0.addr="0xa0" +hint.jedec_dimm.0.slotid="A1" + +hint.jedec_dimm.6.at="smbus1" +hint.jedec_dimm.6.addr="0xa8" +.Ed +.Pp +Their +.Xr sysctl 8 +output (sorted): +.Bd -literal -offset indent +dev.jedec_dimm.0.%desc: DDR4 DIMM w/ Atmel TSOD (A1) +dev.jedec_dimm.0.%driver: jedec_dimm +dev.jedec_dimm.0.%location: addr=0xa0 +dev.jedec_dimm.0.%parent: smbus0 +dev.jedec_dimm.0.%pnpinfo: +dev.jedec_dimm.0.capacity: 16384 +dev.jedec_dimm.0.part: 36ASF2G72PZ-2G1A2 +dev.jedec_dimm.0.serial: 0ea815de +dev.jedec_dimm.0.slotid: A1 +dev.jedec_dimm.0.temp: 32.7C +dev.jedec_dimm.0.type: DDR4 + +dev.jedec_dimm.6.%desc: DDR4 DIMM w/ TSE2004av compliant TSOD +dev.jedec_dimm.6.%driver: jedec_dimm +dev.jedec_dimm.6.%location: addr=0xa8 +dev.jedec_dimm.6.%parent: smbus1 +dev.jedec_dimm.6.%pnpinfo: +dev.jedec_dimm.6.capacity: 8192 +dev.jedec_dimm.6.part: VRA9MR8B2H1603 +dev.jedec_dimm.6.serial: 0c4c46ad +dev.jedec_dimm.6.temp: 43.1C +dev.jedec_dimm.6.type: DDR4 +.Ed +.Sh COMPATIBILITY +Hints for +.Xr jedec_ts 4 +can be mechanically converted for use with +.Nm . +Two changes are required: +.Bl -enum +.It +In all +.Xr jedec_ts 4 +hints, replace +.Dq jedec_ts +with +.Dq jedec_dimm +.It +In +.Xr jedec_ts 4 +.Dq addr +hints, replace the TSOD DTI +.Dq 0x3 +with the SPD DTI +.Dq 0xa +.El +.Pp +The following +.Xr sed 1 +script will perform the necessary changes: +.Bd -literal -offset indent +sed -i ".old" -e 's/jedec_ts/jedec_dimm/' \\ + -e '/jedec_dimm/s/addr="0x3/addr="0xa/' /boot/device.hints +.Ed +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicsmb 4 , +.Xr jedec_ts 4 , +.Xr smbus 4 , +.Xr sysctl 8 +.Sh STANDARDS +.Rs +(DDR3 SPD) +.%A JEDEC +.%T Standard 21-C, Annex K +.Re +.Pp +.Rs +(DDR3 TSOD) +.%A JEDEC +.%T Standard 21-C, TSE2002av +.Re +.Pp +.Rs +(DDR4 SPD) +.%A JEDEC +.%T Standard 21-C, Annex L +.Re +.Pp +.Rs +(DDR4 TSOD) +.%A JEDEC +.%T Standard 21-C, TSE2004av +.Re +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Ravi Pokala Aq Mt rpokala@freebsd.org . +They are both based in part on the +.Xr jedec_ts 4 +driver and manual page, written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Feb 22 23:06:39 2018 (r329842) +++ head/sys/conf/NOTES Thu Feb 22 23:18:46 2018 (r329843) @@ -2490,8 +2490,10 @@ device smb # SMBus peripheral devices # +# jedec_dimm Asset and temperature reporting for DDR3 and DDR4 DIMMs # jedec_ts Temperature Sensor compliant with JEDEC Standard 21-C # +device jedec_dimm device jedec_ts # I2C Bus Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Feb 22 23:06:39 2018 (r329842) +++ head/sys/conf/files Thu Feb 22 23:18:46 2018 (r329843) @@ -2274,6 +2274,7 @@ dev/ixgbe/ixgbe_dcb_82598.c optional ix inet | ixv ine compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_dcb_82599.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/jedec_dimm/jedec_dimm.c optional jedec_dimm smbus dev/jedec_ts/jedec_ts.c optional jedec_ts smbus dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy Added: head/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/jedec_dimm/jedec_dimm.c Thu Feb 22 23:18:46 2018 (r329843) @@ -0,0 +1,1010 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Authors: Ravi Pokala (rpokala@freebsd.org), Andriy Gapon (avg@FreeBSD.org) + * + * Copyright (c) 2016 Andriy Gapon + * Copyright (c) 2018 Panasas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This driver is a super-set of jedec_ts(4), and most of the code for reading + * and reporting the temperature is either based on that driver, or copied + * from it verbatim. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "smbus_if.h" + +struct jedec_dimm_softc { + device_t dev; + device_t smbus; + uint8_t spd_addr; /* SMBus address of the SPD EEPROM. */ + uint8_t tsod_addr; /* Address of the Thermal Sensor On DIMM */ + uint32_t capacity_mb; + char type_str[5]; + char part_str[21]; /* 18 (DDR3) or 20 (DDR4) chars, plus terminator */ + char serial_str[9]; /* 4 bytes = 8 nybble characters, plus terminator */ + char *slotid_str; /* Optional DIMM slot identifier (silkscreen) */ +}; + +/* General Thermal Sensor on DIMM (TSOD) identification notes. + * + * The JEDEC TSE2004av specification defines the device ID that all compliant + * devices should use, but very few do in practice. Maybe that's because the + * earlier TSE2002av specification was rather vague about that. + * Rare examples are IDT TSE2004GB2B0 and Atmel AT30TSE004A, not sure if + * they are TSE2004av compliant by design or by accident. + * Also, the specification mandates that PCI SIG manufacturer IDs are to be + * used, but in practice the JEDEC manufacturer IDs are often used. + */ +const struct jedec_dimm_tsod_dev { + uint16_t vendor_id; + uint8_t device_id; + const char *description; +} known_tsod_devices[] = { + /* Analog Devices ADT7408. + * http://www.analog.com/media/en/technical-documentation/data-sheets/ADT7408.pdf + */ + { 0x11d4, 0x08, "Analog Devices TSOD" }, + + /* Atmel AT30TSE002B, AT30TSE004A. + * http://www.atmel.com/images/doc8711.pdf + * http://www.atmel.com/images/atmel-8868-dts-at30tse004a-datasheet.pdf + * Note how one chip uses the JEDEC Manufacturer ID while the other + * uses the PCI SIG one. + */ + { 0x001f, 0x82, "Atmel TSOD" }, + { 0x1114, 0x22, "Atmel TSOD" }, + + /* Integrated Device Technology (IDT) TS3000B3A, TSE2002B3C, + * TSE2004GB2B0 chips and their variants. + * http://www.idt.com/sites/default/files/documents/IDT_TSE2002B3C_DST_20100512_120303152056.pdf + * http://www.idt.com/sites/default/files/documents/IDT_TS3000B3A_DST_20101129_120303152013.pdf + * https://www.idt.com/document/dst/tse2004gb2b0-datasheet + */ + { 0x00b3, 0x29, "IDT TSOD" }, + { 0x00b3, 0x22, "IDT TSOD" }, + + /* Maxim Integrated MAX6604. + * Different document revisions specify different Device IDs. + * Document 19-3837; Rev 0; 10/05 has 0x3e00 while + * 19-3837; Rev 3; 10/11 has 0x5400. + * http://datasheets.maximintegrated.com/en/ds/MAX6604.pdf + */ + { 0x004d, 0x3e, "Maxim Integrated TSOD" }, + { 0x004d, 0x54, "Maxim Integrated TSOD" }, + + /* Microchip Technology MCP9805, MCP9843, MCP98242, MCP98243 + * and their variants. + * http://ww1.microchip.com/downloads/en/DeviceDoc/21977b.pdf + * Microchip Technology EMC1501. + * http://ww1.microchip.com/downloads/en/DeviceDoc/00001605A.pdf + */ + { 0x0054, 0x00, "Microchip TSOD" }, + { 0x0054, 0x20, "Microchip TSOD" }, + { 0x0054, 0x21, "Microchip TSOD" }, + { 0x1055, 0x08, "Microchip TSOD" }, + + /* NXP Semiconductors SE97 and SE98. + * http://www.nxp.com/docs/en/data-sheet/SE97B.pdf + */ + { 0x1131, 0xa1, "NXP TSOD" }, + { 0x1131, 0xa2, "NXP TSOD" }, + + /* ON Semiconductor CAT34TS02 revisions B and C, CAT6095 and compatible. + * https://www.onsemi.com/pub/Collateral/CAT34TS02-D.PDF + * http://www.onsemi.com/pub/Collateral/CAT6095-D.PDF + */ + { 0x1b09, 0x08, "ON Semiconductor TSOD" }, + { 0x1b09, 0x0a, "ON Semiconductor TSOD" }, + + /* ST[Microelectronics] STTS424E02, STTS2002 and others. + * http://www.st.com/resource/en/datasheet/cd00157558.pdf + * http://www.st.com/resource/en/datasheet/stts2002.pdf + */ + { 0x104a, 0x00, "ST Microelectronics TSOD" }, + { 0x104a, 0x03, "ST Microelectronics TSOD" }, +}; + +static int jedec_dimm_attach(device_t dev); + +static int jedec_dimm_capacity(struct jedec_dimm_softc *sc, enum dram_type type, + uint32_t *capacity_mb); + +static int jedec_dimm_detach(device_t dev); + +static int jedec_dimm_dump(struct jedec_dimm_softc *sc, enum dram_type type); + +static int jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, char *dst, + size_t dstsz, uint16_t offset, uint16_t len, bool ascii); + +static int jedec_dimm_probe(device_t dev); + +static int jedec_dimm_readw_be(struct jedec_dimm_softc *sc, uint8_t reg, + uint16_t *val); + +static int jedec_dimm_temp_sysctl(SYSCTL_HANDLER_ARGS); + +static const char *jedec_dimm_tsod_match(uint16_t vid, uint16_t did); + + +/** + * device_attach() method. Read the DRAM type, use that to determine the offsets + * and lengths of the asset string fields. Calculate the capacity. If a TSOD is + * present, figure out exactly what it is, and update the device description. + * If all of that was successful, create the sysctls for the DIMM. If an + * optional slotid has been hinted, create a sysctl for that too. + * + * @author rpokala + * + * @param[in,out] dev + * Device being attached. + */ +static int +jedec_dimm_attach(device_t dev) +{ + uint8_t byte; + uint16_t devid; + uint16_t partnum_len; + uint16_t partnum_offset; + uint16_t serial_len; + uint16_t serial_offset; + uint16_t tsod_present_offset; + uint16_t vendorid; + bool tsod_present; + int rc; + int new_desc_len; + enum dram_type type; + struct jedec_dimm_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *oid; + struct sysctl_oid_list *children; + const char *tsod_match; + const char *slotid_str; + char *new_desc; + + sc = device_get_softc(dev); + ctx = device_get_sysctl_ctx(dev); + oid = device_get_sysctl_tree(dev); + children = SYSCTL_CHILDREN(oid); + + bzero(sc, sizeof(*sc)); + sc->dev = dev; + sc->smbus = device_get_parent(dev); + sc->spd_addr = smbus_get_addr(dev); + + /* The TSOD address has a different DTI from the SPD address, but shares + * the LSA bits. + */ + sc->tsod_addr = JEDEC_DTI_TSOD | (sc->spd_addr & 0x0f); + + /* Read the DRAM type, and set the various offsets and lengths. */ + rc = smbus_readb(sc->smbus, sc->spd_addr, SPD_OFFSET_DRAM_TYPE, &byte); + if (rc != 0) { + device_printf(dev, "failed to read dram_type: %d\n", rc); + goto out; + } + type = (enum dram_type) byte; + switch (type) { + case DRAM_TYPE_DDR3_SDRAM: + (void) snprintf(sc->type_str, sizeof(sc->type_str), "DDR3"); + partnum_len = SPD_LEN_DDR3_PARTNUM; + partnum_offset = SPD_OFFSET_DDR3_PARTNUM; + serial_len = SPD_LEN_DDR3_SERIAL; + serial_offset = SPD_OFFSET_DDR3_SERIAL; + tsod_present_offset = SPD_OFFSET_DDR3_TSOD_PRESENT; + break; + case DRAM_TYPE_DDR4_SDRAM: + (void) snprintf(sc->type_str, sizeof(sc->type_str), "DDR4"); + partnum_len = SPD_LEN_DDR4_PARTNUM; + partnum_offset = SPD_OFFSET_DDR4_PARTNUM; + serial_len = SPD_LEN_DDR4_SERIAL; + serial_offset = SPD_OFFSET_DDR4_SERIAL; + tsod_present_offset = SPD_OFFSET_DDR4_TSOD_PRESENT; + break; + default: + device_printf(dev, "unsupported dram_type 0x%02x\n", type); + rc = EINVAL; + goto out; + } + + if (bootverbose) { + /* bootverbose debuggery is best-effort, so ignore the rc. */ + (void) jedec_dimm_dump(sc, type); + } + + /* Read all the required info from the SPD. If any of it fails, error + * out without creating the sysctls. + */ + rc = jedec_dimm_capacity(sc, type, &sc->capacity_mb); + if (rc != 0) { + goto out; + } + + rc = jedec_dimm_field_to_str(sc, sc->part_str, sizeof(sc->part_str), + partnum_offset, partnum_len, true); + if (rc != 0) { + goto out; + } + + rc = jedec_dimm_field_to_str(sc, sc->serial_str, sizeof(sc->serial_str), + serial_offset, serial_len, false); + if (rc != 0) { + goto out; + } + + /* The MSBit of the TSOD-presence byte reports whether or not the TSOD + * is in fact present. If it is, read manufacturer and device info from + * it to confirm that it's a valid TSOD device. It's an error if any of + * those bytes are unreadable; it's not an error if the device is simply + * not known to us (tsod_match == NULL). + * While DDR3 and DDR4 don't explicitly require a TSOD, essentially all + * DDR3 and DDR4 DIMMs include one. + */ + rc = smbus_readb(sc->smbus, sc->spd_addr, tsod_present_offset, &byte); + if (rc != 0) { + device_printf(dev, "failed to read TSOD-present byte: %d\n", + rc); + goto out; + } + if (byte & 0x80) { + tsod_present = true; + rc = jedec_dimm_readw_be(sc, TSOD_REG_MANUFACTURER, &vendorid); + if (rc != 0) { + device_printf(dev, + "failed to read TSOD Manufacturer ID\n"); + goto out; + } + rc = jedec_dimm_readw_be(sc, TSOD_REG_DEV_REV, &devid); + if (rc != 0) { + device_printf(dev, "failed to read TSOD Device ID\n"); + goto out; + } + + tsod_match = jedec_dimm_tsod_match(vendorid, devid); + if (bootverbose) { + if (tsod_match == NULL) { + device_printf(dev, + "Unknown TSOD Manufacturer and Device IDs," + " 0x%x and 0x%x\n", vendorid, devid); + } else { + device_printf(dev, + "TSOD: %s\n", tsod_match); + } + } + } else { + tsod_match = NULL; + tsod_present = false; + } + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "type", + CTLFLAG_RD | CTLFLAG_MPSAFE, sc->type_str, 0, + "DIMM type"); + + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "capacity", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, sc->capacity_mb, + "DIMM capacity (MB)"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "part", + CTLFLAG_RD | CTLFLAG_MPSAFE, sc->part_str, 0, + "DIMM Part Number"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "serial", + CTLFLAG_RD | CTLFLAG_MPSAFE, sc->serial_str, 0, + "DIMM Serial Number"); + + /* Create the temperature sysctl IFF the TSOD is present and valid */ + if (tsod_present && (tsod_match != NULL)) { + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "temp", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, + jedec_dimm_temp_sysctl, "IK", "DIMM temperature (deg C)"); + } + + /* If a "slotid" was hinted, add the sysctl for it. */ + if (resource_string_value(device_get_name(dev), device_get_unit(dev), + "slotid", &slotid_str) == 0) { + if (slotid_str != NULL) { + sc->slotid_str = malloc(strlen(slotid_str) + 1, + M_DEVBUF, (M_WAITOK | M_ZERO)); + strlcpy(sc->slotid_str, slotid_str, + sizeof(sc->slotid_str)); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "slotid", + CTLFLAG_RD | CTLFLAG_MPSAFE, sc->slotid_str, 0, + "DIMM Slot Identifier"); + } + } + + /* If a TSOD type string or a slotid are present, add them to the + * device description. + */ + if ((tsod_match != NULL) || (sc->slotid_str != NULL)) { + new_desc_len = strlen(device_get_desc(dev)); + if (tsod_match != NULL) { + new_desc_len += strlen(tsod_match); + new_desc_len += 4; /* " w/ " */ + } + if (sc->slotid_str != NULL) { + new_desc_len += strlen(sc->slotid_str); + new_desc_len += 3; /* space + parens */ + } + new_desc_len++; /* terminator */ + new_desc = malloc(new_desc_len, M_TEMP, (M_WAITOK | M_ZERO)); + (void) snprintf(new_desc, new_desc_len, "%s%s%s%s%s%s", + device_get_desc(dev), + (tsod_match ? " w/ " : ""), + (tsod_match ? tsod_match : ""), + (sc->slotid_str ? " (" : ""), + (sc->slotid_str ? sc->slotid_str : ""), + (sc->slotid_str ? ")" : "")); + device_set_desc_copy(dev, new_desc); + free(new_desc, M_TEMP); + } + +out: + return (rc); +} + +/** + * Calculate the capacity of a DIMM. Both DDR3 and DDR4 encode "geometry" + * information in various SPD bytes. The standards documents codify everything + * in look-up tables, but it's trivial to reverse-engineer the the formulas for + * most of them. Unless otherwise noted, the same formulas apply for both DDR3 + * and DDR4. The SPD offsets of where the data comes from are different between + * the two types, because having them be the same would be too easy. + * + * @author rpokala + * + * @param[in] sc + * Instance-specific context data + * + * @param[in] dram_type + * The locations of the data used to calculate the capacity depends on the + * type of the DIMM. + * + * @param[out] capacity_mb + * The calculated capacity, in MB + */ +static int +jedec_dimm_capacity(struct jedec_dimm_softc *sc, enum dram_type type, + uint32_t *capacity_mb) +{ + uint8_t bus_width_byte; + uint8_t bus_width_offset; + uint8_t dimm_ranks_byte; + uint8_t dimm_ranks_offset; + uint8_t sdram_capacity_byte; + uint8_t sdram_capacity_offset; + uint8_t sdram_pkg_type_byte; + uint8_t sdram_pkg_type_offset; + uint8_t sdram_width_byte; + uint8_t sdram_width_offset; + uint32_t bus_width; + uint32_t dimm_ranks; + uint32_t sdram_capacity; + uint32_t sdram_pkg_type; + uint32_t sdram_width; + int rc; + + switch (type) { + case DRAM_TYPE_DDR3_SDRAM: + bus_width_offset = SPD_OFFSET_DDR3_BUS_WIDTH; + dimm_ranks_offset = SPD_OFFSET_DDR3_DIMM_RANKS; + sdram_capacity_offset = SPD_OFFSET_DDR3_SDRAM_CAPACITY; + sdram_width_offset = SPD_OFFSET_DDR3_SDRAM_WIDTH; + break; + case DRAM_TYPE_DDR4_SDRAM: + bus_width_offset = SPD_OFFSET_DDR4_BUS_WIDTH; + dimm_ranks_offset = SPD_OFFSET_DDR4_DIMM_RANKS; + sdram_capacity_offset = SPD_OFFSET_DDR4_SDRAM_CAPACITY; + sdram_pkg_type_offset = SPD_OFFSET_DDR4_SDRAM_PKG_TYPE; + sdram_width_offset = SPD_OFFSET_DDR4_SDRAM_WIDTH; + break; + default: + device_printf(sc->dev, "unsupported dram_type 0x%02x\n", type); + rc = EINVAL; + goto out; + } + + rc = smbus_readb(sc->smbus, sc->spd_addr, bus_width_offset, + &bus_width_byte); + if (rc != 0) { + device_printf(sc->dev, "failed to read bus_width: %d\n", rc); + goto out; + } + + rc = smbus_readb(sc->smbus, sc->spd_addr, dimm_ranks_offset, + &dimm_ranks_byte); + if (rc != 0) { + device_printf(sc->dev, "failed to read dimm_ranks: %d\n", rc); + goto out; + } + + rc = smbus_readb(sc->smbus, sc->spd_addr, sdram_capacity_offset, + &sdram_capacity_byte); + if (rc != 0) { + device_printf(sc->dev, "failed to read sdram_capacity: %d\n", + rc); + goto out; + } + + rc = smbus_readb(sc->smbus, sc->spd_addr, sdram_width_offset, + &sdram_width_byte); + if (rc != 0) { + device_printf(sc->dev, "failed to read sdram_width: %d\n", rc); + goto out; + } + + /* The "SDRAM Package Type" is only needed for DDR4 DIMMs. */ + if (type == DRAM_TYPE_DDR4_SDRAM) { + rc = smbus_readb(sc->smbus, sc->spd_addr, sdram_pkg_type_offset, + &sdram_pkg_type_byte); + if (rc != 0) { + device_printf(sc->dev, + "failed to read sdram_pkg_type: %d\n", rc); + goto out; + } + } + + /* "Primary bus width, in bits" is in bits [2:0]. */ + bus_width_byte &= 0x07; + if (bus_width_byte <= 3) { + bus_width = 1 << bus_width_byte; + bus_width *= 8; + } else { + device_printf(sc->dev, "invalid bus width info\n"); + rc = EINVAL; + goto out; + } + + /* "Number of ranks per DIMM" is in bits [5:3]. Values 4-7 are only + * valid for DDR4. + */ + dimm_ranks_byte >>= 3; + dimm_ranks_byte &= 0x07; + if (dimm_ranks_byte <= 7) { + dimm_ranks = dimm_ranks_byte + 1; + } else { + device_printf(sc->dev, "invalid DIMM Rank info\n"); + rc = EINVAL; + goto out; + } + if ((dimm_ranks_byte >= 4) && (type != DRAM_TYPE_DDR4_SDRAM)) { + device_printf(sc->dev, "invalid DIMM Rank info\n"); + rc = EINVAL; + goto out; + } + + /* "Total SDRAM capacity per die, in Mb" is in bits [3:0]. There are two + * different formulas, for values 0-7 and for values 8-9. Also, values + * 7-9 are only valid for DDR4. + */ + sdram_capacity_byte &= 0x0f; + if (sdram_capacity_byte <= 7) { + sdram_capacity = 1 << sdram_capacity_byte; + sdram_capacity *= 256; + } else if (sdram_capacity_byte <= 9) { + sdram_capacity = 12 << (sdram_capacity_byte - 8); + sdram_capacity *= 1024; + } else { + device_printf(sc->dev, "invalid SDRAM capacity info\n"); + rc = EINVAL; + goto out; + } + if ((sdram_capacity_byte >= 7) && (type != DRAM_TYPE_DDR4_SDRAM)) { + device_printf(sc->dev, "invalid SDRAM capacity info\n"); + rc = EINVAL; + goto out; + } + + /* "SDRAM device width" is in bits [2:0]. */ + sdram_width_byte &= 0x7; + if (sdram_width_byte <= 3) { + sdram_width = 1 << sdram_width_byte; + sdram_width *= 4; + } else { + device_printf(sc->dev, "invalid SDRAM width info\n"); + rc = EINVAL; + goto out; + } + + /* DDR4 has something called "3DS", which is indicated by [1:0] = 2; + * when that is the case, the die count is encoded in [6:4], and + * dimm_ranks is multiplied by it. + */ + if ((type == DRAM_TYPE_DDR4_SDRAM) && + ((sdram_pkg_type_byte & 0x3) == 2)) { + sdram_pkg_type_byte >>= 4; + sdram_pkg_type_byte &= 0x07; + sdram_pkg_type = sdram_pkg_type_byte + 1; + dimm_ranks *= sdram_pkg_type; + } + + /* Finally, assemble the actual capacity. The formula is the same for + * both DDR3 and DDR4. + */ + *capacity_mb = sdram_capacity / 8 * bus_width / sdram_width * + dimm_ranks; + +out: + return (rc); +} + +/** + * device_detach() method. If we allocated sc->slotid_str, free it. Even if we + * didn't allocate, free it anyway; free(NULL) is safe. + * + * @author rpokala + * + * @param[in,out] dev + * Device being detached. + */ +static int +jedec_dimm_detach(device_t dev) +{ + struct jedec_dimm_softc *sc; + + sc = device_get_softc(dev); + free(sc->slotid_str, M_DEVBUF); + + return (0); +} + +/** + * Read and dump the entire SPD contents. + * + * @author rpokala + * + * @param[in] sc + * Instance-specific context data + * + * @param[in] dram_type + * The length of data which needs to be read and dumped differs based on + * the type of the DIMM. + */ +static int +jedec_dimm_dump(struct jedec_dimm_softc *sc, enum dram_type type) +{ + int i; + int rc; + bool page_changed; + uint8_t bytes[512]; + + page_changed = false; + + for (i = 0; i < 256; i++) { + rc = smbus_readb(sc->smbus, sc->spd_addr, i, &bytes[i]); + if (rc != 0) { + device_printf(sc->dev, + "unable to read page0:0x%02x: %d\n", i, rc); + goto out; + } + } + + /* The DDR4 SPD is 512 bytes, but SMBus only allows for 8-bit offsets. + * JEDEC gets around this by defining the "PAGE" DTI and LSAs. + */ + if (type == DRAM_TYPE_DDR4_SDRAM) { + page_changed = true; + rc = smbus_writeb(sc->smbus, + (JEDEC_DTI_PAGE | JEDEC_LSA_PAGE_SET1), 0, 0); + if (rc != 0) { + device_printf(sc->dev, "unable to change page: %d\n", + rc); + goto out; + } + /* Add 256 to the store location, because we're in the second + * page. + */ + for (i = 0; i < 256; i++) { + rc = smbus_readb(sc->smbus, sc->spd_addr, i, + &bytes[256 + i]); + if (rc != 0) { + device_printf(sc->dev, + "unable to read page1:0x%02x: %d\n", i, rc); + goto out; + } + } + } + + /* Display the data in a nice hexdump format, with byte offsets. */ + hexdump(bytes, (page_changed ? 512 : 256), NULL, 0); + +out: + if (page_changed) { + int rc2; + /* Switch back to page0 before returning. */ + rc2 = smbus_writeb(sc->smbus, + (JEDEC_DTI_PAGE | JEDEC_LSA_PAGE_SET0), 0, 0); + if (rc2 != 0) { + device_printf(sc->dev, "unable to restore page: %d\n", + rc2); + } + } + return (rc); +} + +/** + * Read a specified range of bytes from the SPD, convert them to a string, and + * store them in the provided buffer. Some SPD fields are space-padded ASCII, + * and some are just a string of bits that we want to convert to a hex string. + * + * @author rpokala + * + * @param[in] sc + * Instance-specific context data + * + * @param[out] dst + * The output buffer to populate + * + * @param[in] dstsz + * The size of the output buffer + * + * @param[in] offset + * The starting offset of the field within the SPD + * + * @param[in] len + * The length in bytes of the field within the SPD + * + * @param[in] ascii + * Is the field a sequence of ASCII characters? If not, it is binary data + * which should be converted to characters. + */ +static int +jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, char *dst, size_t dstsz, + uint16_t offset, uint16_t len, bool ascii) +{ + uint8_t byte; + int i; + int rc; + bool page_changed; + + /* Change to the proper page. Offsets [0, 255] are in page0; offsets + * [256, 512] are in page1. + * + * *The page must be reset to page0 before returning.* + * + * For the page-change operation, only the DTI and LSA matter; the + * offset and write-value are ignored, so use just 0. + * + * Mercifully, JEDEC defined the fields such that none of them cross + * pages, so we don't need to worry about that complication. + */ + if (offset < JEDEC_SPD_PAGE_SIZE) { + page_changed = false; + } else if (offset < (2 * JEDEC_SPD_PAGE_SIZE)) { + page_changed = true; + rc = smbus_writeb(sc->smbus, + (JEDEC_DTI_PAGE | JEDEC_LSA_PAGE_SET1), 0, 0); + if (rc != 0) { + device_printf(sc->dev, + "unable to change page for offset 0x%04x: %d\n", + offset, rc); + } + /* Adjust the offset to account for the page change. */ + offset -= JEDEC_SPD_PAGE_SIZE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 23 00:12:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15C03F11876; Fri, 23 Feb 2018 00:12:52 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B670080E82; Fri, 23 Feb 2018 00:12:51 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE604712F; Fri, 23 Feb 2018 00:12:51 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N0CpXK036967; Fri, 23 Feb 2018 00:12:51 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N0Cpbq036966; Fri, 23 Feb 2018 00:12:51 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201802230012.w1N0Cpbq036966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Fri, 23 Feb 2018 00:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329844 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 00:12:52 -0000 Author: truckman Date: Fri Feb 23 00:12:51 2018 New Revision: 329844 URL: https://svnweb.freebsd.org/changeset/base/329844 Log: Decrease latency by not wrapping the idle loop's potentially lengthy search for a thread to steal inside a critical section. Since this allows the search to be preempted, restart the search if preemption happens since the search results found earlier may no longer be valid. Decrease the latency of starting a thread that may be assigned to this CPU during the search by polling for incoming threads during the search and switching to that thread instead of continuing the search. Test for stale search results and restart the search before going through the expense of calling tdq_lock_pair(). Retry some tests after grabbing the locks since things may have changed while waiting to get both locks. Eliminate special case handling for stealing from an SMT peer that uses 1 as the steal threshold. This can only succeed if a thread has been assigned but our SMT peer has not yet started executing it. This is quite rare and when it happens the other SMT thread is generally waiting for the same tdq lock that we hold. Basically both SMT threads are racing to grab the same spin lock. Add the kern.sched.always_steal knob from a ULE patch by jeff@. Incorporate another idea from Jeff's ULE patch. If the sched_switch() detects that the CPU is about to go idle, try to steal a thread before switching to the idle thread. Since the search for a thread to steal has to be done inside a critical section in this context, limit the impact on latency by adding the knob kern.sched.trysteal_limit to limit the topological distance of the search and don't restart the search if we detect stale results. If this search can't find an stealable thread, the idle loop can do a more complete search. Also poll for threads being assigned to this CPU during the search and switch to them instead of continuing the search. This change is responsibile for the majority of the improvement in parallel buildworld times. In sched_balance_group() change the minimum threshold from stealing a thread from 1 to 2. Poaching a newly assigned thread from a CPU that is waking up hasn't yet switched to that thread from idle is likely very rare and is likely to have the same lock race as is seen when stealing threads in the idle loop. Also use tdq_notify() to kick the destintation CPU instead of always sending an IPI. Update a stale comment, the number of transferable threads is not calculated. Reviewed by: kib (earlier version) Comments by: avg, jeff, mav MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12130 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Feb 22 23:18:46 2018 (r329843) +++ head/sys/kern/sched_ule.c Fri Feb 23 00:12:51 2018 (r329844) @@ -240,9 +240,9 @@ struct tdq { volatile int tdq_load; /* Aggregate load. */ volatile int tdq_cpu_idle; /* cpu_idle() is active. */ int tdq_sysload; /* For loadavg, !ITHD load. */ - int tdq_transferable; /* Transferable thread count. */ - short tdq_switchcnt; /* Switches this tick. */ - short tdq_oldswitchcnt; /* Switches last tick. */ + volatile int tdq_transferable; /* Transferable thread count. */ + volatile short tdq_switchcnt; /* Switches this tick. */ + volatile short tdq_oldswitchcnt; /* Switches last tick. */ u_char tdq_lowpri; /* Lowest priority thread. */ u_char tdq_ipipending; /* IPI pending. */ u_char tdq_idx; /* Current insert index. */ @@ -274,6 +274,8 @@ static int balance_interval = 128; /* Default set in s static int affinity; static int steal_idle = 1; static int steal_thresh = 2; +static int always_steal = 0; +static int trysteal_limit = 2; /* * One thread queue per processor. @@ -319,7 +321,7 @@ void tdq_print(int cpu); static void runq_print(struct runq *rq); static void tdq_add(struct tdq *, struct thread *, int); #ifdef SMP -static int tdq_move(struct tdq *, struct tdq *); +static struct thread *tdq_move(struct tdq *, struct tdq *); static int tdq_idled(struct tdq *); static void tdq_notify(struct tdq *, struct thread *); static struct thread *tdq_steal(struct tdq *, int); @@ -841,7 +843,7 @@ sched_balance_group(struct cpu_group *cg) CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, hmask, 1); + high = sched_highest(cg, hmask, 2); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -924,33 +926,32 @@ tdq_unlock_pair(struct tdq *one, struct tdq *two) static int sched_balance_pair(struct tdq *high, struct tdq *low) { - int moved; + struct thread *td; int cpu; tdq_lock_pair(high, low); - moved = 0; + td = NULL; /* - * Determine what the imbalance is and then adjust that to how many - * threads we actually have to give up (transferable). + * Transfer a thread from high to low. */ if (high->tdq_transferable != 0 && high->tdq_load > low->tdq_load && - (moved = tdq_move(high, low)) > 0) { + (td = tdq_move(high, low)) != NULL) { /* - * In case the target isn't the current cpu IPI it to force a - * reschedule with the new workload. + * In case the target isn't the current cpu notify it of the + * new load, possibly sending an IPI to force it to reschedule. */ cpu = TDQ_ID(low); if (cpu != PCPU_GET(cpuid)) - ipi_cpu(cpu, IPI_PREEMPT); + tdq_notify(low, td); } tdq_unlock_pair(high, low); - return (moved); + return (td != NULL); } /* * Move a thread from one thread queue to another. */ -static int +static struct thread * tdq_move(struct tdq *from, struct tdq *to) { struct td_sched *ts; @@ -965,7 +966,7 @@ tdq_move(struct tdq *from, struct tdq *to) cpu = TDQ_ID(to); td = tdq_steal(tdq, cpu); if (td == NULL) - return (0); + return (NULL); ts = td_get_sched(td); /* * Although the run queue is locked the thread may be blocked. Lock @@ -978,7 +979,7 @@ tdq_move(struct tdq *from, struct tdq *to) ts->ts_cpu = cpu; td->td_lock = TDQ_LOCKPTR(to); tdq_add(to, td, SRQ_YIELDING); - return (1); + return (td); } /* @@ -991,51 +992,80 @@ tdq_idled(struct tdq *tdq) struct cpu_group *cg; struct tdq *steal; cpuset_t mask; - int thresh; - int cpu; + int cpu, switchcnt; - if (smp_started == 0 || steal_idle == 0) + if (smp_started == 0 || steal_idle == 0 || tdq->tdq_cg == NULL) return (1); CPU_FILL(&mask); CPU_CLR(PCPU_GET(cpuid), &mask); - /* We don't want to be preempted while we're iterating. */ - spinlock_enter(); - for (cg = tdq->tdq_cg; cg != NULL; ) { - if ((cg->cg_flags & CG_FLAG_THREAD) == 0) - thresh = steal_thresh; - else - thresh = 1; - cpu = sched_highest(cg, mask, thresh); + restart: + switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; + for (cg = tdq->tdq_cg; ; ) { + cpu = sched_highest(cg, mask, steal_thresh); + /* + * We were assigned a thread but not preempted. Returning + * 0 here will cause our caller to switch to it. + */ + if (tdq->tdq_load) + return (0); if (cpu == -1) { cg = cg->cg_parent; + if (cg == NULL) + return (1); continue; } steal = TDQ_CPU(cpu); - CPU_CLR(cpu, &mask); + /* + * The data returned by sched_highest() is stale and + * the chosen CPU no longer has an eligible thread. + * + * Testing this ahead of tdq_lock_pair() only catches + * this situation about 20% of the time on an 8 core + * 16 thread Ryzen 7, but it still helps performance. + */ + if (steal->tdq_load < steal_thresh || + steal->tdq_transferable == 0) + goto restart; tdq_lock_pair(tdq, steal); - if (steal->tdq_load < thresh || steal->tdq_transferable == 0) { - tdq_unlock_pair(tdq, steal); - continue; - } /* - * If a thread was added while interrupts were disabled don't - * steal one here. If we fail to acquire one due to affinity - * restrictions loop again with this cpu removed from the - * set. + * We were assigned a thread while waiting for the locks. + * Switch to it now instead of stealing a thread. */ - if (tdq->tdq_load == 0 && tdq_move(steal, tdq) == 0) { + if (tdq->tdq_load) + break; + /* + * The data returned by sched_highest() is stale and + * the chosen CPU no longer has an eligible thread, or + * we were preempted and the CPU loading info may be out + * of date. The latter is rare. In either case restart + * the search. + */ + if (steal->tdq_load < steal_thresh || + steal->tdq_transferable == 0 || + switchcnt != tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt) { tdq_unlock_pair(tdq, steal); - continue; + goto restart; } - spinlock_exit(); - TDQ_UNLOCK(steal); - mi_switch(SW_VOL | SWT_IDLE, NULL); - thread_unlock(curthread); - - return (0); + /* + * Steal the thread and switch to it. + */ + if (tdq_move(steal, tdq) != NULL) + break; + /* + * We failed to acquire a thread even though it looked + * like one was available. This could be due to affinity + * restrictions or for other reasons. Loop again after + * removing this CPU from the set. The restart logic + * above does not restore this CPU to the set due to the + * likelyhood of failing here again. + */ + CPU_CLR(cpu, &mask); + tdq_unlock_pair(tdq, steal); } - spinlock_exit(); - return (1); + TDQ_UNLOCK(steal); + mi_switch(SW_VOL | SWT_IDLE, NULL); + thread_unlock(curthread); + return (0); } /* @@ -1835,6 +1865,88 @@ sched_lend_user_prio(struct thread *td, u_char prio) } /* + * This tdq is about to idle. Try to steal a thread from another CPU before + * choosing the idle thread. + */ +static void +tdq_trysteal(struct tdq *tdq) +{ + struct cpu_group *cg; + struct tdq *steal; + cpuset_t mask; + int cpu, i; + + if (smp_started == 0 || trysteal_limit == 0 || tdq->tdq_cg == NULL) + return; + CPU_FILL(&mask); + CPU_CLR(PCPU_GET(cpuid), &mask); + /* We don't want to be preempted while we're iterating. */ + spinlock_enter(); + TDQ_UNLOCK(tdq); + for (i = 1, cg = tdq->tdq_cg; ; ) { + cpu = sched_highest(cg, mask, steal_thresh); + /* + * If a thread was added while interrupts were disabled don't + * steal one here. + */ + if (tdq->tdq_load > 0) { + TDQ_LOCK(tdq); + break; + } + if (cpu == -1) { + i++; + cg = cg->cg_parent; + if (cg == NULL || i > trysteal_limit) { + TDQ_LOCK(tdq); + break; + } + continue; + } + steal = TDQ_CPU(cpu); + /* + * The data returned by sched_highest() is stale and + * the chosen CPU no longer has an eligible thread. + */ + if (steal->tdq_load < steal_thresh || + steal->tdq_transferable == 0) + continue; + tdq_lock_pair(tdq, steal); + /* + * If we get to this point, unconditonally exit the loop + * to bound the time spent in the critcal section. + * + * If a thread was added while interrupts were disabled don't + * steal one here. + */ + if (tdq->tdq_load > 0) { + TDQ_UNLOCK(steal); + break; + } + /* + * The data returned by sched_highest() is stale and + * the chosen CPU no longer has an eligible thread. + */ + if (steal->tdq_load < steal_thresh || + steal->tdq_transferable == 0) { + TDQ_UNLOCK(steal); + break; + } + /* + * If we fail to acquire one due to affinity restrictions, + * bail out and let the idle thread to a more complete search + * outside of a critical section. + */ + if (tdq_move(steal, tdq) == NULL) { + TDQ_UNLOCK(steal); + break; + } + TDQ_UNLOCK(steal); + break; + } + spinlock_exit(); +} + +/* * Handle migration from sched_switch(). This happens only for * cpu binding. */ @@ -1946,6 +2058,8 @@ sched_switch(struct thread *td, struct thread *newtd, TDQ_LOCK(tdq); mtx = thread_lock_block(td); tdq_load_rem(tdq, td); + if (tdq->tdq_load == 0) + tdq_trysteal(tdq); } #if (KTR_COMPILE & KTR_SCHED) != 0 @@ -2677,7 +2791,7 @@ sched_idletd(void *dummy) } switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; #ifdef SMP - if (switchcnt != oldswitchcnt) { + if (always_steal || switchcnt != oldswitchcnt) { oldswitchcnt = switchcnt; if (tdq_idled(tdq) == 0) continue; @@ -2714,6 +2828,15 @@ sched_idletd(void *dummy) * to avoid race with tdq_notify. */ atomic_thread_fence_seq_cst(); + /* + * Checking for again after the fence picks up assigned + * threads often enough to make it worthwhile to do so in + * order to avoid calling cpu_idle(). + */ + if (tdq->tdq_load != 0) { + tdq->tdq_cpu_idle = 0; + continue; + } cpu_idle(switchcnt * 4 > sched_idlespinthresh); tdq->tdq_cpu_idle = 0; @@ -2948,6 +3071,10 @@ SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_ "Attempts to steal work from other cores before idling"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0, "Minimum load on remote CPU before we'll steal"); +SYSCTL_INT(_kern_sched, OID_AUTO, trysteal_limit, CTLFLAG_RW, &trysteal_limit, + 0, "Topological distance limit for stealing threads in sched_switch()"); +SYSCTL_INT(_kern_sched, OID_AUTO, always_steal, CTLFLAG_RW, &always_steal, 0, + "Always run the stealer from the idle thread"); SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", "XML dump of detected CPU topology"); From owner-svn-src-all@freebsd.org Fri Feb 23 00:17:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 386AAF11E8A; Fri, 23 Feb 2018 00:17:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC71A8113B; Fri, 23 Feb 2018 00:17:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE998713B; Fri, 23 Feb 2018 00:17:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N0HoB4037175; Fri, 23 Feb 2018 00:17:50 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N0HoFf037170; Fri, 23 Feb 2018 00:17:50 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802230017.w1N0HoFf037170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 00:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329845 - head/usr.sbin/mptutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/mptutil X-SVN-Commit-Revision: 329845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 00:17:51 -0000 Author: asomers Date: Fri Feb 23 00:17:50 2018 New Revision: 329845 URL: https://svnweb.freebsd.org/changeset/base/329845 Log: Fix numerous Coverity issues in mptutil Most are memory or file descriptor leaks. Three were unannotated fallthroughs in a switch/case statement. One was an integer overflow before widen. Reported by: Coverity CID: 1007463 1007462 1007461 1007460 1007459 1007458 1007457 CID: 1006855 1006854 1006853 1006852 1006851 1006850 1006849 CID: 1006848 1006845 1006844 1006843 1006842 1006841 1006840 CID: 1006839 1006838 1006837 1006836 1006835 1006834 1006833 CID: 1006832 1006831 1006831 1006830 1006829 1008334 1008170 CID: 1008169 1008168 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11013 Modified: head/usr.sbin/mptutil/mpt_config.c head/usr.sbin/mptutil/mpt_drive.c head/usr.sbin/mptutil/mpt_evt.c head/usr.sbin/mptutil/mpt_show.c head/usr.sbin/mptutil/mpt_volume.c Modified: head/usr.sbin/mptutil/mpt_config.c ============================================================================== --- head/usr.sbin/mptutil/mpt_config.c Fri Feb 23 00:12:51 2018 (r329844) +++ head/usr.sbin/mptutil/mpt_config.c Fri Feb 23 00:17:50 2018 (r329845) @@ -67,12 +67,16 @@ dehumanize(const char *value) switch (vtp[0]) { case 't': case 'T': iv *= 1024; + /* FALLTHROUGH */ case 'g': case 'G': iv *= 1024; + /* FALLTHROUGH */ case 'm': case 'M': iv *= 1024; + /* FALLTHROUGH */ case 'k': case 'K': iv *= 1024; + /* FALLTHROUGH */ case '\0': break; default: @@ -244,6 +248,7 @@ clear_config(int ac, char **av) if (ioc2 == NULL) { error = errno; warn("Failed to fetch volume list"); + close(fd); return (error); } @@ -253,6 +258,8 @@ clear_config(int ac, char **av) if (mpt_lock_volume(vol->VolumeBus, vol->VolumeID) < 0) { warnx("Volume %s is busy and cannot be deleted", mpt_volume_name(vol->VolumeBus, vol->VolumeID)); + free(ioc2); + close(fd); return (EBUSY); } } @@ -263,6 +270,8 @@ clear_config(int ac, char **av) ch = getchar(); if (ch != 'y' && ch != 'Y') { printf("\nAborting\n"); + free(ioc2); + close(fd); return (0); } @@ -557,16 +566,16 @@ build_volume(int fd, struct volume_info *info, int rai case RT_RAID0: vol->VolumeType = MPI_RAID_VOL_TYPE_IS; vol->StripeSize = stripe_size / 512; - MaxLBA = MinLBA * info->drive_count; + MaxLBA = (uint64_t)MinLBA * info->drive_count; break; case RT_RAID1: vol->VolumeType = MPI_RAID_VOL_TYPE_IM; - MaxLBA = MinLBA * (info->drive_count / 2); + MaxLBA = (uint64_t)MinLBA * (info->drive_count / 2); break; case RT_RAID1E: vol->VolumeType = MPI_RAID_VOL_TYPE_IME; vol->StripeSize = stripe_size / 512; - MaxLBA = MinLBA * info->drive_count / 2; + MaxLBA = (uint64_t)MinLBA * info->drive_count / 2; break; default: /* Pacify gcc. */ @@ -645,6 +654,7 @@ create_volume(int ac, char **av) if (raid_type == -1) { warnx("Unknown or unsupported volume type %s", av[1]); + close(fd); return (EINVAL); } @@ -671,6 +681,7 @@ create_volume(int ac, char **av) stripe_size = dehumanize(optarg); if ((stripe_size < 512) || (!powerof2(stripe_size))) { warnx("Invalid stripe size %s", optarg); + close(fd); return (EINVAL); } break; @@ -679,6 +690,7 @@ create_volume(int ac, char **av) break; case '?': default: + close(fd); return (EINVAL); } } @@ -690,14 +702,18 @@ create_volume(int ac, char **av) if (state.ioc2 == NULL) { error = errno; warn("Failed to read volume list"); + close(fd); return (error); } state.list = mpt_pd_list(fd); - if (state.list == NULL) + if (state.list == NULL) { + close(fd); return (errno); + } error = mpt_fetch_disks(fd, &state.nsdisks, &state.sdisks); if (error) { warn("Failed to fetch standalone disk list"); + close(fd); return (error); } state.target_id = 0xff; @@ -705,24 +721,36 @@ create_volume(int ac, char **av) /* Parse the drive list. */ if (ac != 1) { warnx("Exactly one drive list is required"); + close(fd); return (EINVAL); } info = calloc(1, sizeof(*info)); - if (info == NULL) + if (info == NULL) { + close(fd); return (ENOMEM); + } error = parse_volume(fd, raid_type, &state, av[0], info); - if (error) + if (error) { + free(info); + close(fd); return (error); + } /* Create RAID physdisk pages for standalone disks. */ error = add_drives(fd, info, verbose); - if (error) + if (error) { + free(info); + close(fd); return (error); + } /* Build the volume. */ vol = build_volume(fd, info, raid_type, stripe_size, &state, verbose); - if (vol == NULL) + if (vol == NULL) { + free(info); + close(fd); return (errno); + } #ifdef DEBUG if (dump) { @@ -738,6 +766,8 @@ create_volume(int ac, char **av) if (error) { errno = error; warn("Failed to add volume"); + free(info); + close(fd); return (error); } @@ -779,11 +809,14 @@ delete_volume(int ac, char **av) error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID); if (error) { warnc(error, "Invalid volume %s", av[1]); + close(fd); return (error); } - if (mpt_lock_volume(VolumeBus, VolumeID) < 0) + if (mpt_lock_volume(VolumeBus, VolumeID) < 0) { + close(fd); return (errno); + } error = mpt_raid_action(fd, MPI_RAID_ACTION_DELETE_VOLUME, VolumeBus, VolumeID, 0, MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS | @@ -791,6 +824,7 @@ delete_volume(int ac, char **av) NULL, 0); if (error) { warnc(error, "Failed to delete volume"); + close(fd); return (error); } @@ -828,6 +862,7 @@ find_volume_spare_pool(int fd, const char *name, int * 0) { *pool = 1 << (ffs(info->VolumeSettings.HotSparePool & ~MPI_RAID_HOT_SPARE_POOL_0) - 1); + free(info); return (0); } free(info); @@ -873,6 +908,7 @@ find_volume_spare_pool(int fd, const char *name, int * if (error) { warnx("Failed to add spare pool %d to %s", new_pool, mpt_volume_name(VolumeBus, VolumeID)); + free(info); return (error); } free(info); @@ -908,8 +944,10 @@ add_spare(int ac, char **av) if (ac == 3) { error = find_volume_spare_pool(fd, av[2], &pool); - if (error) + if (error) { + close(fd); return (error); + } } else pool = MPI_RAID_HOT_SPARE_POOL_0; @@ -922,6 +960,9 @@ add_spare(int ac, char **av) error = mpt_fetch_disks(fd, &nsdisks, &sdisks); if (error != 0) { warn("Failed to fetch standalone disk list"); + mpt_free_pd_list(list); + mpt_free_pd_list(list); + close(fd); return (error); } @@ -929,15 +970,25 @@ add_spare(int ac, char **av) 0) { error = errno; warn("Unable to lookup drive %s", av[1]); + mpt_free_pd_list(list); + mpt_free_pd_list(list); + close(fd); return (error); } - if (mpt_lock_physdisk(&sdisks[i]) < 0) + if (mpt_lock_physdisk(&sdisks[i]) < 0) { + mpt_free_pd_list(list); + mpt_free_pd_list(list); + close(fd); return (errno); + } if (mpt_create_physdisk(fd, &sdisks[i], &PhysDiskNum) < 0) { error = errno; warn("Failed to create physical disk page"); + mpt_free_pd_list(list); + mpt_free_pd_list(list); + close(fd); return (error); } free(sdisks); @@ -948,6 +999,7 @@ add_spare(int ac, char **av) if (info == NULL) { error = errno; warn("Failed to fetch drive info"); + close(fd); return (error); } @@ -957,6 +1009,7 @@ add_spare(int ac, char **av) NULL, 0, NULL, NULL, 0); if (error) { warnc(error, "Failed to assign spare"); + close(fd); return (error); } @@ -988,12 +1041,15 @@ remove_spare(int ac, char **av) } list = mpt_pd_list(fd); - if (list == NULL) + if (list == NULL) { + close(fd); return (errno); + } error = mpt_lookup_drive(list, av[1], &PhysDiskNum); if (error) { warn("Failed to find drive %s", av[1]); + close(fd); return (error); } mpt_free_pd_list(list); @@ -1003,17 +1059,22 @@ remove_spare(int ac, char **av) if (info == NULL) { error = errno; warn("Failed to fetch drive info"); + close(fd); return (error); } if (info->PhysDiskSettings.HotSparePool == 0) { warnx("Drive %u is not a hot spare", PhysDiskNum); + free(info); + close(fd); return (EINVAL); } if (mpt_delete_physdisk(fd, PhysDiskNum) < 0) { error = errno; warn("Failed to delete physical disk page"); + free(info); + close(fd); return (error); } Modified: head/usr.sbin/mptutil/mpt_drive.c ============================================================================== --- head/usr.sbin/mptutil/mpt_drive.c Fri Feb 23 00:12:51 2018 (r329844) +++ head/usr.sbin/mptutil/mpt_drive.c Fri Feb 23 00:17:50 2018 (r329845) @@ -149,6 +149,7 @@ mpt_pd_list(int fd) IOC_5_HOT_SPARE *spare; struct mpt_drive_list *list; int count, error, i, j; + size_t listsize; ioc2 = mpt_read_ioc_page(fd, 2, NULL); if (ioc2 == NULL) { @@ -191,6 +192,10 @@ mpt_pd_list(int fd) error = errno; warn("Failed to read volume info"); errno = error; + free(volumes); + free(ioc5); + free(ioc3); + free(ioc2); return (NULL); } count += volumes[i]->NumPhysDisks; @@ -199,15 +204,20 @@ mpt_pd_list(int fd) count += ioc5->NumHotSpares; /* Walk the various lists enumerating drives. */ - list = malloc(sizeof(*list) + sizeof(CONFIG_PAGE_RAID_PHYS_DISK_0) * - count); - list->ndrives = 0; + listsize = sizeof(*list) + sizeof(CONFIG_PAGE_RAID_PHYS_DISK_0) * count; + list = calloc(1, listsize); for (i = 0; i < ioc2->NumActiveVolumes; i++) { rdisk = volumes[i]->PhysDisk; for (j = 0; j < volumes[i]->NumPhysDisks; rdisk++, j++) - if (mpt_pd_insert(fd, list, rdisk->PhysDiskNum) < 0) + if (mpt_pd_insert(fd, list, rdisk->PhysDiskNum) < 0) { + mpt_free_pd_list(list); + free(volumes); + free(ioc5); + free(ioc3); + free(ioc2); return (NULL); + } free(volumes[i]); } free(ioc2); @@ -215,14 +225,21 @@ mpt_pd_list(int fd) spare = ioc5->HotSpare; for (i = 0; i < ioc5->NumHotSpares; spare++, i++) - if (mpt_pd_insert(fd, list, spare->PhysDiskNum) < 0) + if (mpt_pd_insert(fd, list, spare->PhysDiskNum) < 0) { + mpt_free_pd_list(list); + free(ioc5); + free(ioc3); return (NULL); + } free(ioc5); disk = ioc3->PhysDisk; for (i = 0; i < ioc3->NumPhysDisks; disk++, i++) - if (mpt_pd_insert(fd, list, disk->PhysDiskNum) < 0) + if (mpt_pd_insert(fd, list, disk->PhysDiskNum) < 0) { + mpt_free_pd_list(list); + free(ioc3); return (NULL); + } free(ioc3); return (list); @@ -324,12 +341,15 @@ drive_set_state(char *drive, U8 Action, U8 State, cons } list = mpt_pd_list(fd); - if (list == NULL) + if (list == NULL) { + close(fd); return (errno); + } if (mpt_lookup_drive(list, drive, &PhysDiskNum) < 0) { error = errno; warn("Failed to find drive %s", drive); + close(fd); return (error); } mpt_free_pd_list(list); @@ -339,12 +359,15 @@ drive_set_state(char *drive, U8 Action, U8 State, cons if (info == NULL) { error = errno; warn("Failed to fetch info for drive %u", PhysDiskNum); + close(fd); return (error); } /* Try to change the state. */ if (info->PhysDiskStatus.State == State) { warnx("Drive %u is already in the desired state", PhysDiskNum); + free(info); + close(fd); return (EINVAL); } @@ -352,6 +375,8 @@ drive_set_state(char *drive, U8 Action, U8 State, cons NULL, 0, NULL, NULL, 0); if (error) { warnc(error, "Failed to set drive %u to %s", PhysDiskNum, name); + free(info); + close(fd); return (error); } Modified: head/usr.sbin/mptutil/mpt_evt.c ============================================================================== --- head/usr.sbin/mptutil/mpt_evt.c Fri Feb 23 00:12:51 2018 (r329844) +++ head/usr.sbin/mptutil/mpt_evt.c Fri Feb 23 00:17:50 2018 (r329845) @@ -124,6 +124,8 @@ show_events(int ac, char **av) break; case '?': default: + free(log); + close(fd); return (EINVAL); } } @@ -132,8 +134,11 @@ show_events(int ac, char **av) /* Build a list of valid entries and sort them by sequence. */ entries = malloc(sizeof(MPI_LOG_0_ENTRY *) * log->NumLogEntries); - if (entries == NULL) + if (entries == NULL) { + free(log); + close(fd); return (ENOMEM); + } num_events = 0; for (i = 0; i < log->NumLogEntries; i++) { if (log->LogEntry[i].LogEntryQualifier == @@ -154,6 +159,7 @@ show_events(int ac, char **av) } free(entries); + free(log); close(fd); return (0); Modified: head/usr.sbin/mptutil/mpt_show.c ============================================================================== --- head/usr.sbin/mptutil/mpt_show.c Fri Feb 23 00:12:51 2018 (r329844) +++ head/usr.sbin/mptutil/mpt_show.c Fri Feb 23 00:17:50 2018 (r329845) @@ -99,10 +99,13 @@ show_adapter(int ac, char **av) if (man0 == NULL) { error = errno; warn("Failed to get controller info"); + close(fd); return (error); } if (man0->Header.PageLength < sizeof(*man0) / 4) { warnx("Invalid controller info"); + free(man0); + close(fd); return (EINVAL); } printf("mpt%d Adapter:\n", mpt_unit); @@ -307,11 +310,16 @@ show_config(int ac, char **av) if (ioc2 == NULL || ioc5 == NULL) { error = errno; warn("Failed to get config"); + free(ioc2); + close(fd); return (error); } if (mpt_fetch_disks(fd, &nsdisks, &sdisks) < 0) { error = errno; warn("Failed to get standalone drive list"); + free(ioc5); + free(ioc2); + close(fd); return (error); } @@ -463,6 +471,7 @@ show_volumes(int ac, char **av) } printf("\n"); } + free(volumes); free(ioc2); close(fd); @@ -493,6 +502,7 @@ show_drives(int ac, char **av) list = mpt_pd_list(fd); if (list == NULL) { error = errno; + close(fd); warn("Failed to get drive list"); return (error); } Modified: head/usr.sbin/mptutil/mpt_volume.c ============================================================================== --- head/usr.sbin/mptutil/mpt_volume.c Fri Feb 23 00:12:51 2018 (r329844) +++ head/usr.sbin/mptutil/mpt_volume.c Fri Feb 23 00:17:50 2018 (r329845) @@ -100,11 +100,14 @@ volume_name(int ac, char **av) if (vnames == NULL) { error = errno; warn("Failed to fetch volume names"); + close(fd); return (error); } if (vnames->Header.PageType != MPI_CONFIG_PAGEATTR_CHANGEABLE) { warnx("Volume name is read only"); + free(vnames); + close(fd); return (EOPNOTSUPP); } printf("mpt%u changing volume %s name from \"%s\" to \"%s\"\n", @@ -116,6 +119,8 @@ volume_name(int ac, char **av) if (mpt_write_config_page(fd, vnames, NULL) < 0) { error = errno; warn("Failed to set volume name"); + free(vnames); + close(fd); return (error); } @@ -152,6 +157,7 @@ volume_status(int ac, char **av) error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID); if (error) { warnc(error, "Invalid volume: %s", av[1]); + close(fd); return (error); } @@ -160,6 +166,7 @@ volume_status(int ac, char **av) NULL, NULL, 0); if (error) { warnc(error, "Fetching volume status failed"); + close(fd); return (error); } @@ -226,12 +233,15 @@ volume_cache(int ac, char **av) error = mpt_lookup_volume(fd, av[1], &VolumeBus, &VolumeID); if (error) { warnc(error, "Invalid volume: %s", av[1]); + close(fd); return (error); } volume = mpt_vol_info(fd, VolumeBus, VolumeID, NULL); - if (volume == NULL) + if (volume == NULL) { + close(fd); return (errno); + } Settings = volume->VolumeSettings.Settings; @@ -243,6 +253,7 @@ volume_cache(int ac, char **av) if (NewSettings == Settings) { warnx("volume cache unchanged"); + free(volume); close(fd); return (0); } From owner-svn-src-all@freebsd.org Fri Feb 23 00:28:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD56BF1299A; Fri, 23 Feb 2018 00:28:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 836BF8173F; Fri, 23 Feb 2018 00:28:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A18B72CD; Fri, 23 Feb 2018 00:28:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N0S0du042023; Fri, 23 Feb 2018 00:28:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N0S0Ef042022; Fri, 23 Feb 2018 00:28:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201802230028.w1N0S0Ef042022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 23 Feb 2018 00:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329846 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 329846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 00:28:01 -0000 Author: pfg Date: Fri Feb 23 00:28:00 2018 New Revision: 329846 URL: https://svnweb.freebsd.org/changeset/base/329846 Log: getpeereid(3): Fix behavior on failure to match documentation. According to the getpeereid(3) documentation, on failure the value -1 is returned and the global variable errno is set to indicate the error. We were returning the error instead. Obtained from: Apple's Libc-1244.30.3 MFC after: 5 days Modified: head/lib/libc/gen/getpeereid.c Modified: head/lib/libc/gen/getpeereid.c ============================================================================== --- head/lib/libc/gen/getpeereid.c Fri Feb 23 00:17:50 2018 (r329845) +++ head/lib/libc/gen/getpeereid.c Fri Feb 23 00:28:00 2018 (r329846) @@ -50,8 +50,10 @@ getpeereid(int s, uid_t *euid, gid_t *egid) error = _getsockopt(s, 0, LOCAL_PEERCRED, &xuc, &xuclen); if (error != 0) return (error); - if (xuc.cr_version != XUCRED_VERSION) - return (EINVAL); + if (xuc.cr_version != XUCRED_VERSION) { + errno = EINVAL; + return (-1); + } *euid = xuc.cr_uid; *egid = xuc.cr_gid; return (0); From owner-svn-src-all@freebsd.org Fri Feb 23 00:38:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81BEFF1348D; Fri, 23 Feb 2018 00:38:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2546281DF9; Fri, 23 Feb 2018 00:38:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E65C745D; Fri, 23 Feb 2018 00:38:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N0cgOJ047253; Fri, 23 Feb 2018 00:38:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N0cgel047252; Fri, 23 Feb 2018 00:38:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802230038.w1N0cgel047252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Feb 2018 00:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329847 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 00:38:43 -0000 Author: mav Date: Fri Feb 23 00:38:42 2018 New Revision: 329847 URL: https://svnweb.freebsd.org/changeset/base/329847 Log: MFC r329091: Add sysctls for dnode block and indirect block shifts. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Feb 23 00:28:00 2018 (r329846) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Feb 23 00:38:42 2018 (r329847) @@ -59,6 +59,12 @@ static dnode_phys_t dnode_phys_zero; int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT; +SYSCTL_DECL(_vfs_zfs); +SYSCTL_INT(_vfs_zfs, OID_AUTO, default_bs, CTLFLAG_RWTUN, + &zfs_default_bs, 0, "Default dnode block shift"); +SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RWTUN, + &zfs_default_ibs, 0, "Default dnode indirect block shift"); + #ifdef illumos static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); #endif From owner-svn-src-all@freebsd.org Fri Feb 23 01:11:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0322FF15867; Fri, 23 Feb 2018 01:11:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A975482FD1; Fri, 23 Feb 2018 01:11:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A47EB7A93; Fri, 23 Feb 2018 01:11:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N1Bvk4066266; Fri, 23 Feb 2018 01:11:57 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N1Bvrm066265; Fri, 23 Feb 2018 01:11:57 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201802230111.w1N1Bvrm066265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 23 Feb 2018 01:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329848 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 329848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 01:11:58 -0000 Author: pfg Date: Fri Feb 23 01:11:57 2018 New Revision: 329848 URL: https://svnweb.freebsd.org/changeset/base/329848 Log: __printf_render_int(): small type change to match use. Variable l is consistently used as an int rather than a char. Sort names while here. Obtained from: Apple's Libc-1244.30.3 MFC after: 5 days Modified: head/lib/libc/stdio/xprintf_int.c Modified: head/lib/libc/stdio/xprintf_int.c ============================================================================== --- head/lib/libc/stdio/xprintf_int.c Fri Feb 23 00:38:42 2018 (r329847) +++ head/lib/libc/stdio/xprintf_int.c Fri Feb 23 01:11:57 2018 (r329848) @@ -260,8 +260,8 @@ __printf_render_int(struct __printf_io *io, const stru const union arg *argp; char buf[BUF]; char *p, *pe; - char ns, l; - int rdx, sign, zext, ngrp; + char ns; + int l, ngrp, rdx, sign, zext; const char *nalt, *digit; char thousands_sep; /* locale specific thousands separator */ const char *grouping; /* locale specific numeric grouping rules */ From owner-svn-src-all@freebsd.org Fri Feb 23 02:47:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2711F1D244; Fri, 23 Feb 2018 02:47:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1B0486B23; Fri, 23 Feb 2018 02:47:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 980B21099C; Fri, 23 Feb 2018 02:47:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N2lpgD012190; Fri, 23 Feb 2018 02:47:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N2lpju012189; Fri, 23 Feb 2018 02:47:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230247.w1N2lpju012189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 02:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329850 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 02:47:52 -0000 Author: kevans Date: Fri Feb 23 02:47:51 2018 New Revision: 329850 URL: https://svnweb.freebsd.org/changeset/base/329850 Log: lualoader: Drop unused return values; we'll only use the first Modified: head/stand/lua/loader.lua Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Fri Feb 23 01:20:14 2018 (r329849) +++ head/stand/lua/loader.lua Fri Feb 23 02:47:51 2018 (r329850) @@ -32,7 +32,7 @@ local config = require("config") local menu = require("menu") local password = require("password") -local result, _, _ = lfs.attributes("/boot/lua/local.lua") +local result = lfs.attributes("/boot/lua/local.lua") -- Effectively discard any errors; we'll just act if it succeeds. if result ~= nil then require("local") From owner-svn-src-all@freebsd.org Fri Feb 23 02:51:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EF1AF1D7AE; Fri, 23 Feb 2018 02:51:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E3F686FC4; Fri, 23 Feb 2018 02:51:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092A510AED; Fri, 23 Feb 2018 02:51:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N2pacj013600; Fri, 23 Feb 2018 02:51:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N2pZuO012493; Fri, 23 Feb 2018 02:51:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230251.w1N2pZuO012493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 02:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329851 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 02:51:37 -0000 Author: kevans Date: Fri Feb 23 02:51:35 2018 New Revision: 329851 URL: https://svnweb.freebsd.org/changeset/base/329851 Log: Add SPDX tags to lua files Modified: head/stand/lua/cli.lua head/stand/lua/color.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/loader.lua head/stand/lua/menu.lua head/stand/lua/password.lua head/stand/lua/screen.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/cli.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2018 Kyle Evans -- All rights reserved. -- Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/color.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- All rights reserved. -- Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/config.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- Copyright (C) 2018 Kyle Evans -- All rights reserved. Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/core.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- All rights reserved. -- Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/drawer.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- Copyright (c) 2018 Kyle Evans -- All rights reserved. Modified: head/stand/lua/loader.lua ============================================================================== --- head/stand/lua/loader.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/loader.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- Copyright (c) 2018 Kyle Evans -- All rights reserved. Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/menu.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- Copyright (C) 2018 Kyle Evans -- All rights reserved. Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/password.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- Copyright (C) 2018 Kyle Evans -- All rights reserved. Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Fri Feb 23 02:47:51 2018 (r329850) +++ head/stand/lua/screen.lua Fri Feb 23 02:51:35 2018 (r329851) @@ -1,4 +1,6 @@ -- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- -- Copyright (c) 2015 Pedro Souza -- All rights reserved. -- From owner-svn-src-all@freebsd.org Fri Feb 23 02:53:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43F5BF1DA11; Fri, 23 Feb 2018 02:53:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA582872EA; Fri, 23 Feb 2018 02:53:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E431210B30; Fri, 23 Feb 2018 02:53:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N2rone017281; Fri, 23 Feb 2018 02:53:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N2rowH017280; Fri, 23 Feb 2018 02:53:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230253.w1N2rowH017280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 02:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329852 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 02:53:51 -0000 Author: kevans Date: Fri Feb 23 02:53:50 2018 New Revision: 329852 URL: https://svnweb.freebsd.org/changeset/base/329852 Log: Add copyright notice to core.lua I've also made some not-insignificant changes/additions to this file, to include the added constants, ACPI changes, boot environment listing, and some utility functions. Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Fri Feb 23 02:51:35 2018 (r329851) +++ head/stand/lua/core.lua Fri Feb 23 02:53:50 2018 (r329852) @@ -2,6 +2,7 @@ -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD -- -- Copyright (c) 2015 Pedro Souza +-- Copyright (c) 2018 Kyle Evans -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Fri Feb 23 03:11:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 746C9F20E9F; Fri, 23 Feb 2018 03:11:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18DE768249; Fri, 23 Feb 2018 03:11:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 139D410E8D; Fri, 23 Feb 2018 03:11:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N3Bilt023946; Fri, 23 Feb 2018 03:11:44 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N3BhiJ023939; Fri, 23 Feb 2018 03:11:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802230311.w1N3BhiJ023939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 03:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug X-SVN-Commit-Revision: 329853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 03:11:44 -0000 Author: asomers Date: Fri Feb 23 03:11:43 2018 New Revision: 329853 URL: https://svnweb.freebsd.org/changeset/base/329853 Log: libifconfig: multiple feature additions Added the ability to: * Create virtual interfaces * Create vlan interfaces * Get interface fib * Get interface groups * Get interface status * Get nd6 info * Get media status * Get additional ifaddr info in a convenient struct * Get vhids * Get carp info * Get lagg and laggport status * Iterate over all interfaces and ifaddrs And add more examples, too. Note that this is a backwards-incompatible change. But that's ok, because it's a private library. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14463 Added: head/lib/libifconfig/libifconfig_carp.c (contents, props changed) head/lib/libifconfig/libifconfig_inet.c (contents, props changed) head/lib/libifconfig/libifconfig_inet6.c (contents, props changed) head/lib/libifconfig/libifconfig_lagg.c (contents, props changed) head/lib/libifconfig/libifconfig_media.c (contents, props changed) head/share/examples/libifconfig/ifchangevlan.c (contents, props changed) head/share/examples/libifconfig/ifcreatevlan.c (contents, props changed) head/share/examples/libifconfig/status.c (contents, props changed) Modified: head/lib/libifconfig/Makefile head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h head/lib/libifconfig/libifconfig_internal.c head/lib/libifconfig/libifconfig_internal.h head/share/examples/libifconfig/Makefile head/share/examples/libifconfig/ifcreate.c head/share/examples/libifconfig/ifdestroy.c head/share/examples/libifconfig/setdescription.c head/share/examples/libifconfig/setmtu.c head/usr.sbin/wlandebug/wlandebug.c Modified: head/lib/libifconfig/Makefile ============================================================================== --- head/lib/libifconfig/Makefile Fri Feb 23 02:53:50 2018 (r329852) +++ head/lib/libifconfig/Makefile Fri Feb 23 03:11:43 2018 (r329853) @@ -8,7 +8,9 @@ NO_PIC= SHLIBDIR?= /lib SHLIB_MAJOR= 1 -SRCS= libifconfig.c libifconfig_internal.c +SRCS= libifconfig.c libifconfig_carp.c libifconfig_inet.c +SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c +SRCS+= libifconfig_media.c INCSDIR= ${INCLUDEDIR} INCS= libifconfig.h @@ -16,6 +18,6 @@ INCS= libifconfig.h #MAN= libifconfig.3 CFLAGS+= -I${.CURDIR} -WARNS?=6 +NO_WCAST_ALIGN= yes .include Modified: head/lib/libifconfig/libifconfig.c ============================================================================== --- head/lib/libifconfig/libifconfig.c Fri Feb 23 02:53:50 2018 (r329852) +++ head/lib/libifconfig/libifconfig.c Fri Feb 23 03:11:43 2018 (r329853) @@ -1,38 +1,7 @@ /* - * Copyright (c) 2016, Marie Helene Kvello-Aune - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * thislist of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2016-2017, Marie Helene Kvello-Aune. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,65 +30,63 @@ * $FreeBSD$ */ - /* - * Copyright 1996 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - #include #include #include #include #include +#include +#include +#include #include #include #include +#include +#include #include #include #include #include +#include + #include "libifconfig.h" #include "libifconfig_internal.h" +#define NOTAG ((u_short) -1) +static bool +isnd6defif(ifconfig_handle_t *h, const char *name) +{ + struct in6_ndifreq ndifreq; + unsigned int ifindex; + + memset(&ndifreq, 0, sizeof(ndifreq)); + strlcpy(ndifreq.ifname, name, sizeof(ndifreq.ifname)); + ifindex = if_nametoindex(ndifreq.ifname); + if (ifconfig_ioctlwrap(h, AF_INET6, SIOCGDEFIFACE_IN6, &ndifreq) < 0) { + return (false); + } + h->error.errtype = OK; + return (ndifreq.ifindex == ifindex); +} + ifconfig_handle_t * ifconfig_open(void) { - struct ifconfig_handle *h; + ifconfig_handle_t *h; h = calloc(1, sizeof(*h)); + + if (h == NULL) { + return (NULL); + } for (int i = 0; i <= AF_MAX; i++) { h->sockets[i] = -1; } + return (h); } @@ -132,6 +99,7 @@ ifconfig_close(ifconfig_handle_t *h) (void)close(h->sockets[i]); } } + freeifaddrs(h->ifap); free(h); } @@ -157,6 +125,46 @@ ifconfig_err_ioctlreq(ifconfig_handle_t *h) } int +ifconfig_foreach_iface(ifconfig_handle_t *h, + ifconfig_foreach_func_t cb, void *udata) +{ + int ret; + + ret = ifconfig_getifaddrs(h); + if (ret == 0) { + struct ifaddrs *ifa; + char *ifname = NULL; + + for (ifa = h->ifap; ifa; ifa = ifa->ifa_next) { + if (ifname != ifa->ifa_name) { + ifname = ifa->ifa_name; + cb(h, ifa, udata); + } + } + } + /* Free ifaddrs so we don't accidentally cache stale data */ + freeifaddrs(h->ifap); + h->ifap = NULL; + + return (ret); +} + +void +ifconfig_foreach_ifaddr(ifconfig_handle_t *h, struct ifaddrs *ifa, + ifconfig_foreach_func_t cb, void *udata) +{ + struct ifaddrs *ift; + + for (ift = ifa; + ift != NULL && + ift->ifa_addr != NULL && + strcmp(ift->ifa_name, ifa->ifa_name) == 0; + ift = ift->ifa_next) { + cb(h, ift, udata); + } +} + +int ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description) { @@ -179,6 +187,7 @@ ifconfig_get_description(ifconfig_handle_t *h, const c ifr.ifr_buffer.buffer = descr; ifr.ifr_buffer.length = descrlen; if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { + free(descr); return (-1); } @@ -186,6 +195,13 @@ ifconfig_get_description(ifconfig_handle_t *h, const c if (strlen(descr) > 0) { *description = strdup(descr); free(descr); + + if (description == NULL) { + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); + } + return (0); } } else if (ifr.ifr_buffer.length > descrlen) { @@ -228,8 +244,7 @@ ifconfig_set_description(ifconfig_handle_t *h, const c return (-1); } - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, - &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { free(ifr.ifr_buffer.buffer); return (-1); } @@ -248,8 +263,7 @@ ifconfig_unset_description(ifconfig_handle_t *h, const ifr.ifr_buffer.length = 0; ifr.ifr_buffer.buffer = NULL; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { return (-1); } return (0); @@ -271,8 +285,7 @@ ifconfig_set_name(ifconfig_handle_t *h, const char *na (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_data = tmpname; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, - &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { free(tmpname); return (-1); } @@ -285,61 +298,60 @@ int ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, char **orig_name) { - struct ifmibdata ifmd; size_t len; + unsigned int ifindex; int name[6]; - int i, maxifno; + ifindex = if_nametoindex(ifname); + if (ifindex == 0) { + goto fail; + } + name[0] = CTL_NET; name[1] = PF_LINK; name[2] = NETLINK_GENERIC; - name[3] = IFMIB_SYSTEM; - name[4] = IFMIB_IFCOUNT; + name[3] = IFMIB_IFDATA; + name[4] = ifindex; + name[5] = IFDATA_DRIVERNAME; - len = sizeof maxifno; - if (sysctl(name, 5, &maxifno, &len, 0, 0) < 0) { - h->error.errtype = OTHER; - h->error.errcode = errno; - return (-1); + len = 0; + if (sysctl(name, 6, NULL, &len, 0, 0) < 0) { + goto fail; } - name[3] = IFMIB_IFDATA; - name[5] = IFDATA_GENERAL; - for (i = 1; i <= maxifno; i++) { - len = sizeof ifmd; - name[4] = i; - if (sysctl(name, 6, &ifmd, &len, 0, 0) < 0) { - if (errno == ENOENT) - continue; + *orig_name = malloc(len); + if (*orig_name == NULL) { + goto fail; + } - goto fail; - } + if (sysctl(name, 6, *orig_name, &len, 0, 0) < 0) { + free(*orig_name); + *orig_name = NULL; + goto fail; + } - if (strncmp(ifmd.ifmd_name, ifname, IFNAMSIZ) != 0) - continue; + return (0); - len = 0; - name[5] = IFDATA_DRIVERNAME; - if (sysctl(name, 6, NULL, &len, 0, 0) < 0) - goto fail; +fail: + h->error.errtype = OTHER; + h->error.errcode = (errno != 0) ? errno : ENOENT; + return (-1); +} - *orig_name = malloc(len); - if (*orig_name == NULL) - goto fail; +int +ifconfig_get_fib(ifconfig_handle_t *h, const char *name, int *fib) +{ + struct ifreq ifr; - if (sysctl(name, 6, *orig_name, &len, 0, 0) < 0) { - free(*orig_name); - *orig_name = NULL; - goto fail; - } + memset(&ifr, 0, sizeof(ifr)); + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - return (0); + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFFIB, &ifr) == -1) { + return (-1); } -fail: - h->error.errtype = OTHER; - h->error.errcode = (i <= maxifno) ? errno : ENOENT; - return (-1); + *fib = ifr.ifr_fib; + return (0); } int @@ -351,8 +363,7 @@ ifconfig_set_mtu(ifconfig_handle_t *h, const char *nam (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { return (-1); } @@ -367,8 +378,7 @@ ifconfig_get_mtu(ifconfig_handle_t *h, const char *nam memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, - &ifr) == -1) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { return (-1); } @@ -377,6 +387,24 @@ ifconfig_get_mtu(ifconfig_handle_t *h, const char *nam } int +ifconfig_get_nd6(ifconfig_handle_t *h, const char *name, + struct in6_ndireq *nd) +{ + memset(nd, 0, sizeof(*nd)); + strlcpy(nd->ifname, name, sizeof(nd->ifname)); + if (ifconfig_ioctlwrap(h, AF_INET6, SIOCGIFINFO_IN6, nd) == -1) { + return (-1); + } + if (isnd6defif(h, name)) { + nd->ndi.flags |= ND6_IFF_DEFAULTIF; + } else if (h->error.errtype != OK) { + return (-1); + } + + return (0); +} + +int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric) { struct ifreq ifr; @@ -385,8 +413,7 @@ ifconfig_set_metric(ifconfig_handle_t *h, const char * (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_metric = metric; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { return (-1); } @@ -401,8 +428,7 @@ ifconfig_get_metric(ifconfig_handle_t *h, const char * memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, - &ifr) == -1) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { return (-1); } @@ -420,8 +446,7 @@ ifconfig_set_capability(ifconfig_handle_t *h, const ch memset(&ifr, 0, sizeof(ifr)); - if (ifconfig_get_capability(h, name, - &ifcap) != 0) { + if (ifconfig_get_capability(h, name, &ifcap) != 0) { return (-1); } @@ -442,8 +467,7 @@ ifconfig_set_capability(ifconfig_handle_t *h, const ch * set for this request. */ ifr.ifr_reqcap = flags; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { return (-1); } return (0); @@ -458,8 +482,7 @@ ifconfig_get_capability(ifconfig_handle_t *h, const ch memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { return (-1); } capability->curcap = ifr.ifr_curcap; @@ -468,6 +491,45 @@ ifconfig_get_capability(ifconfig_handle_t *h, const ch } int +ifconfig_get_groups(ifconfig_handle_t *h, const char *name, + struct ifgroupreq *ifgr) +{ + int len; + + memset(ifgr, 0, sizeof(*ifgr)); + strlcpy(ifgr->ifgr_name, name, IFNAMSIZ); + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { + if ((h->error.errcode == EINVAL) || + (h->error.errcode == ENOTTY)) { + return (0); + } else { + return (-1); + } + } + + len = ifgr->ifgr_len; + ifgr->ifgr_groups = (struct ifg_req *)malloc(len); + if (ifgr->ifgr_groups == NULL) { + return (1); + } + bzero(ifgr->ifgr_groups, len); + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { + return (-1); + } + + return (0); +} + +int +ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, + struct ifstat *ifs) +{ + strlcpy(ifs->ifs_name, name, sizeof(ifs->ifs_name)); + return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFSTATUS, ifs)); +} + +int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; @@ -475,8 +537,7 @@ ifconfig_destroy_interface(ifconfig_handle_t *h, const memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, - &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { return (-1); } return (0); @@ -488,6 +549,7 @@ ifconfig_create_interface(ifconfig_handle_t *h, const struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); /* @@ -512,5 +574,57 @@ ifconfig_create_interface(ifconfig_handle_t *h, const } *ifname = strdup(ifr.ifr_name); + if (ifname == NULL) { + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); + } + + return (0); +} + +int +ifconfig_create_interface_vlan(ifconfig_handle_t *h, const char *name, + char **ifname, const char *vlandev, const unsigned short vlantag) +{ + struct ifreq ifr; + struct vlanreq params; + + if ((vlantag == NOTAG) || (vlandev[0] == '\0')) { + // TODO: Add proper error tracking here + return (-1); + } + + bzero(¶ms, sizeof(params)); + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + params.vlr_tag = vlantag; + (void)strlcpy(params.vlr_parent, vlandev, sizeof(params.vlr_parent)); + ifr.ifr_data = (caddr_t)¶ms; + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { + // TODO: Add proper error tracking here + return (-1); + } + + *ifname = strdup(ifr.ifr_name); + return (0); +} + +int +ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, + const char *vlandev, const unsigned short vlantag) +{ + struct ifreq ifr; + struct vlanreq params; + + bzero(¶ms, sizeof(params)); + params.vlr_tag = vlantag; + strlcpy(params.vlr_parent, vlandev, sizeof(params.vlr_parent)); + + ifr.ifr_data = (caddr_t)¶ms; + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSETVLAN, &ifr) == -1) { + return (-1); + } return (0); } Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Fri Feb 23 02:53:50 2018 (r329852) +++ head/lib/libifconfig/libifconfig.h Fri Feb 23 03:11:43 2018 (r329853) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Marie Helene Kvello-Aune + * Copyright (c) 2016-2017, Marie Helene Kvello-Aune * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -28,8 +28,16 @@ #pragma once +#include +#include + +#define ND6_IFF_DEFAULTIF 0x8000 + typedef enum { - OTHER, IOCTL, SOCKET + OK = 0, + OTHER, + IOCTL, + SOCKET } ifconfig_errtype; /* @@ -37,8 +45,16 @@ typedef enum { * pointer to it for library use. */ struct ifconfig_handle; -typedef struct ifconfig_handle ifconfig_handle_t; +typedef struct ifconfig_handle ifconfig_handle_t; +struct carpreq; +struct ifaddrs; +struct in6_ndireq; +struct lagg_reqall; +struct lagg_reqflags; +struct lagg_reqopts; +struct lagg_reqport; + struct ifconfig_capabilities { /** Current capabilities (ifconfig prints this as 'options')*/ int curcap; @@ -46,13 +62,44 @@ struct ifconfig_capabilities { int reqcap; }; +/** Stores extra info associated with an inet address */ +struct ifconfig_inet_addr { + const struct sockaddr_in *sin; + const struct sockaddr_in *netmask; + const struct sockaddr_in *dst; + const struct sockaddr_in *broadcast; + int prefixlen; + uint8_t vhid; +}; + +/** Stores extra info associated with an inet6 address */ +struct ifconfig_inet6_addr { + struct sockaddr_in6 *sin6; + struct sockaddr_in6 *dstin6; + struct in6_addrlifetime lifetime; + int prefixlen; + uint32_t flags; + uint8_t vhid; +}; + +/** Stores extra info associated with a lagg(4) interface */ +struct ifconfig_lagg_status { + struct lagg_reqall *ra; + struct lagg_reqopts *ro; + struct lagg_reqflags *rf; +}; + /** Retrieves a new state object for use in other API calls. * Example usage: *{@code * // Create state object - * ifconfig_handle_t *lifh = ifconfig_open(); + * ifconfig_handle_t *lifh; + * lifh = ifconfig_open(); + * if (lifh == NULL) { + * // Handle error + * } * - * // Do stuff with it + * // Do stuff with the handle * * // Dispose of the state object * ifconfig_close(lifh); @@ -73,6 +120,28 @@ ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_ /** Retrieves the errno associated with the error, if any. */ int ifconfig_err_errno(ifconfig_handle_t *h); +typedef void (*ifconfig_foreach_func_t)(ifconfig_handle_t *h, + struct ifaddrs *ifa, void *udata); + +/** Iterate over every network interface + * @param h An open ifconfig state object + * @param cb A callback function to call with a pointer to each interface + * @param udata An opaque value that will be passed to the callback. + * @return 0 on success, nonzero if the list could not be iterated + */ +int ifconfig_foreach_iface(ifconfig_handle_t *h, ifconfig_foreach_func_t cb, + void *udata); + +/** Iterate over every address on a single network interface + * @param h An open ifconfig state object + * @param ifa A pointer that was supplied by a previous call to + * ifconfig_foreach_iface + * @param udata An opaque value that will be passed to the callback. + * @param cb A callback function to call with a pointer to each ifaddr + */ +void ifconfig_foreach_ifaddr(ifconfig_handle_t *h, struct ifaddrs *ifa, + ifconfig_foreach_func_t cb, void *udata); + /** If error type was IOCTL, this identifies which request failed. */ unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); int ifconfig_get_description(ifconfig_handle_t *h, const char *name, @@ -84,8 +153,12 @@ int ifconfig_set_name(ifconfig_handle_t *h, const char const char *newname); int ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, char **orig_name); +int ifconfig_set_fib(ifconfig_handle_t *h, const char *name, int fib); +int ifconfig_get_fib(ifconfig_handle_t *h, const char *name, int *fib); int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); +int ifconfig_get_nd6(ifconfig_handle_t *h, const char *name, + struct in6_ndireq *nd); int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric); int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); @@ -94,6 +167,70 @@ int ifconfig_set_capability(ifconfig_handle_t *h, cons int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, struct ifconfig_capabilities *capability); +/** Retrieve the list of groups to which this interface belongs + * @param h An open ifconfig state object + * @param name The interface name + * @param ifgr return argument. The caller is responsible for freeing + * ifgr->ifgr_groups + * @return 0 on success, nonzero on failure + */ +int ifconfig_get_groups(ifconfig_handle_t *h, const char *name, + struct ifgroupreq *ifgr); +int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, + struct ifstat *stat); + +/** Retrieve the interface media information + * @param h An open ifconfig state object + * @param name The interface name + * @param ifmr Return argument. The caller is responsible for freeing it + * @return 0 on success, nonzero on failure + */ +int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, + struct ifmediareq **ifmr); +const char *ifconfig_media_get_type(int ifmw); +const char *ifconfig_media_get_subtype(int ifmw); +const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); +void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); + +int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, + struct carpreq *carpr, int ncarpr); + +/** Retrieve additional information about an inet address + * @param h An open ifconfig state object + * @param name The interface name + * @param ifa Pointer to the the address structure of interest + * @param addr Return argument. It will be filled with additional information + * about the address. + * @return 0 on success, nonzero on failure. + */ +int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h, + const char *name, struct ifaddrs *ifa, struct ifconfig_inet_addr *addr); + +/** Retrieve additional information about an inet6 address + * @param h An open ifconfig state object + * @param name The interface name + * @param ifa Pointer to the the address structure of interest + * @param addr Return argument. It will be filled with additional information + * about the address. + * @return 0 on success, nonzero on failure. + */ +int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, + const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr); + +/** Retrieve additional information about a lagg(4) interface */ +int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h, + const char *name, struct ifconfig_lagg_status **lagg_status); + +/** Retrieve additional information about a member of a lagg(4) interface */ +int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h, + const char *name, struct lagg_reqport *rp); + +/** Frees the structure returned by ifconfig_lagg_get_status. Does nothing if + * the argument is NULL + * @param laggstat Pointer to the structure to free + */ +void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat); + /** Destroy a virtual interface * @param name Interface to destroy */ @@ -105,3 +242,15 @@ int ifconfig_destroy_interface(ifconfig_handle_t *h, c */ int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname); + +/** Creates a (virtual) interface + * @param name Name of interface to create. Example: vlan0 or ix0.50 + * @param name ifname Is set to actual name of created interface + * @param vlandev Name of interface to attach to + * @param vlanid VLAN ID/Tag. Must not be 0. + */ +int ifconfig_create_interface_vlan(ifconfig_handle_t *h, const char *name, + char **ifname, const char *vlandev, const unsigned short vlantag); + +int ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, + const char *vlandev, const unsigned short vlantag); Added: head/lib/libifconfig/libifconfig_carp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_carp.c Fri Feb 23 03:11:43 2018 (r329853) @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#include +#include + +#include +#include + +#include +#include + +#include "libifconfig.h" +#include "libifconfig_internal.h" + + +int +ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, + struct carpreq *carpr, int ncarpr) +{ + struct ifreq ifr; + + bzero(carpr, sizeof(struct carpreq) * ncarpr); + carpr[0].carpr_count = ncarpr; + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_data = (caddr_t)carpr; + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGVH, &ifr) != 0) { + return (-1); + } + + return (0); +} Added: head/lib/libifconfig/libifconfig_inet.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_inet.c Fri Feb 23 03:11:43 2018 (r329853) @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "libifconfig.h" +#include "libifconfig_internal.h" + +static const struct sockaddr_in NULL_SIN; + +static int +inet_prefixlen(const struct in_addr *addr) +{ + int x; + + x = ffs(ntohl(addr->s_addr)); + return (x == 0 ? 0 : 33 - x); +} + +int +ifconfig_inet_get_addrinfo(ifconfig_handle_t *h __unused, + const char *name __unused, struct ifaddrs *ifa, + struct ifconfig_inet_addr *addr) +{ + bzero(addr, sizeof(*addr)); + + /* Set the address */ + if (ifa->ifa_addr == NULL) { + return (-1); + } else { + addr->sin = (struct sockaddr_in *)ifa->ifa_addr; + } + + /* Set the destination address */ + if (ifa->ifa_flags & IFF_POINTOPOINT) { + if (ifa->ifa_dstaddr) { + addr->dst = (struct sockaddr_in *)ifa->ifa_dstaddr; + } else { + addr->dst = &NULL_SIN; + } + } + + /* Set the netmask and prefixlen */ + if (ifa->ifa_netmask) { + addr->netmask = (struct sockaddr_in *)ifa->ifa_netmask; + } else { + addr->netmask = &NULL_SIN; + } + addr->prefixlen = inet_prefixlen(&addr->netmask->sin_addr); + + /* Set the broadcast */ + if (ifa->ifa_flags & IFF_BROADCAST) { + addr->broadcast = (struct sockaddr_in *)ifa->ifa_broadaddr; + } + + /* Set the vhid */ + if (ifa->ifa_data) { + addr->vhid = ((struct if_data *)ifa->ifa_data)->ifi_vhid; + } + + return (0); +} Added: head/lib/libifconfig/libifconfig_inet6.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_inet6.c Fri Feb 23 03:11:43 2018 (r329853) @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 23 03:18:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FBBAF217E8; Fri, 23 Feb 2018 03:18:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C36E568862; Fri, 23 Feb 2018 03:18:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE62B10ED8; Fri, 23 Feb 2018 03:18:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N3IOlF028963; Fri, 23 Feb 2018 03:18:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N3IOmX028961; Fri, 23 Feb 2018 03:18:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230318.w1N3IOmX028961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 03:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329854 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 03:18:25 -0000 Author: kevans Date: Fri Feb 23 03:18:24 2018 New Revision: 329854 URL: https://svnweb.freebsd.org/changeset/base/329854 Log: lualoader: shallowCopyTable => deepCopyTable I called it a shallow copy, but it wasn't really a shallow copy at all. Modified: head/stand/lua/core.lua head/stand/lua/menu.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Fri Feb 23 03:11:43 2018 (r329853) +++ head/stand/lua/core.lua Fri Feb 23 03:18:24 2018 (r329854) @@ -286,11 +286,11 @@ function core.isSystem386() end -- This may be a better candidate for a 'utility' module. -function core.shallowCopyTable(tbl) +function core.deepCopyTable(tbl) local new_tbl = {} for k, v in pairs(tbl) do if type(v) == "table" then - new_tbl[k] = core.shallowCopyTable(v) + new_tbl[k] = core.deepCopyTable(v) else new_tbl[k] = v end Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Fri Feb 23 03:11:43 2018 (r329853) +++ head/stand/lua/menu.lua Fri Feb 23 03:18:24 2018 (r329854) @@ -222,7 +222,7 @@ menu.welcome = { return menu.welcome.swapped_menu end -- Shallow copy the table - menu_entries = core.shallowCopyTable(menu_entries) + menu_entries = core.deepCopyTable(menu_entries) -- Swap the first two menu entries menu_entries[1], menu_entries[2] = From owner-svn-src-all@freebsd.org Fri Feb 23 03:36:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD279F22E39; Fri, 23 Feb 2018 03:36:25 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 721CD694E8; Fri, 23 Feb 2018 03:36:25 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6E111260; Fri, 23 Feb 2018 03:36:25 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N3aPIp038794; Fri, 23 Feb 2018 03:36:25 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N3aOT2038786; Fri, 23 Feb 2018 03:36:24 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201802230336.w1N3aOT2038786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Fri, 23 Feb 2018 03:36:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329855 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 329855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 03:36:26 -0000 Author: davidcs Date: Fri Feb 23 03:36:24 2018 New Revision: 329855 URL: https://svnweb.freebsd.org/changeset/base/329855 Log: 1. Added support to offline a port if is error recovery on successful. 2. Sysctls to enable/disable driver_state_dump and error_recovery. 3. Sysctl to control the delay between hw/fw reinitialization and restarting the fastpath. 4. Stop periodic stats retrieval if interface has IFF_DRV_RUNNING flag off. 5. Print contents of PEG_HALT_STATUS1 and PEG_HALT_STATUS2 on heartbeat failure. 6. Speed up slowpath shutdown during error recovery. 7. link_state update using atomic_store. 8. Added timestamp information on driver state and minidump captures. 9. Added support for Slowpath event logging 10.Added additional failure injection types to simulate failures. Modified: head/sys/dev/qlxgbe/ql_dbg.h head/sys/dev/qlxgbe/ql_def.h head/sys/dev/qlxgbe/ql_glbl.h head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_hw.h head/sys/dev/qlxgbe/ql_inline.h head/sys/dev/qlxgbe/ql_ioctl.c head/sys/dev/qlxgbe/ql_ioctl.h head/sys/dev/qlxgbe/ql_isr.c head/sys/dev/qlxgbe/ql_misc.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/qlxgbe/ql_os.h head/sys/dev/qlxgbe/ql_ver.h Modified: head/sys/dev/qlxgbe/ql_dbg.h ============================================================================== --- head/sys/dev/qlxgbe/ql_dbg.h Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_dbg.h Fri Feb 23 03:36:24 2018 (r329855) @@ -44,17 +44,21 @@ extern void ql_dump_buf16(qla_host_t *ha, const char * extern void ql_dump_buf32(qla_host_t *ha, const char *str, void *dbuf, uint32_t len32); -#define INJCT_RX_RXB_INVAL 0x00001 -#define INJCT_RX_MP_NULL 0x00002 -#define INJCT_LRO_RXB_INVAL 0x00003 -#define INJCT_LRO_MP_NULL 0x00004 -#define INJCT_NUM_HNDLE_INVALID 0x00005 -#define INJCT_RDWR_INDREG_FAILURE 0x00006 -#define INJCT_RDWR_OFFCHIPMEM_FAILURE 0x00007 -#define INJCT_MBX_CMD_FAILURE 0x00008 -#define INJCT_HEARTBEAT_FAILURE 0x00009 -#define INJCT_TEMPERATURE_FAILURE 0x0000A -#define INJCT_M_GETCL_M_GETJCL_FAILURE 0x0000B +#define INJCT_RX_RXB_INVAL 0x00001 +#define INJCT_RX_MP_NULL 0x00002 +#define INJCT_LRO_RXB_INVAL 0x00003 +#define INJCT_LRO_MP_NULL 0x00004 +#define INJCT_NUM_HNDLE_INVALID 0x00005 +#define INJCT_RDWR_INDREG_FAILURE 0x00006 +#define INJCT_RDWR_OFFCHIPMEM_FAILURE 0x00007 +#define INJCT_MBX_CMD_FAILURE 0x00008 +#define INJCT_HEARTBEAT_FAILURE 0x00009 +#define INJCT_TEMPERATURE_FAILURE 0x0000A +#define INJCT_M_GETCL_M_GETJCL_FAILURE 0x0000B +#define INJCT_INV_CONT_OPCODE 0x0000C +#define INJCT_SGL_RCV_INV_DESC_COUNT 0x0000D +#define INJCT_SGL_LRO_INV_DESC_COUNT 0x0000E +#define INJCT_PEER_PORT_FAILURE_ERR_RECOVERY 0x0000F #ifdef QL_DBG Modified: head/sys/dev/qlxgbe/ql_def.h ============================================================================== --- head/sys/dev/qlxgbe/ql_def.h Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_def.h Fri Feb 23 03:36:24 2018 (r329855) @@ -146,12 +146,12 @@ struct qla_host { volatile uint32_t qla_watchdog_paused; volatile uint32_t qla_initiate_recovery; volatile uint32_t qla_detach_active; + volatile uint32_t offline; device_t pci_dev; - uint16_t watchdog_ticks; + volatile uint16_t watchdog_ticks; uint8_t pci_func; - uint8_t resvd; /* ioctl related */ struct cdev *ioctl_dev; @@ -184,6 +184,7 @@ struct qla_host { /* hardware access lock */ + struct mtx sp_log_lock; struct mtx hw_lock; volatile uint32_t hw_lock_held; uint64_t hw_lock_failed; @@ -241,6 +242,9 @@ struct qla_host { volatile const char *qla_unlock; uint32_t dbg_level; uint32_t enable_minidump; + uint32_t enable_driverstate_dump; + uint32_t enable_error_recovery; + uint32_t ms_delay_after_init; uint8_t fw_ver_str[32]; @@ -274,5 +278,7 @@ typedef struct qla_host qla_host_t; #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) + +#define QL_INITIATE_RECOVERY(ha) qla_set_error_recovery(ha) #endif /* #ifndef _QL_DEF_H_ */ Modified: head/sys/dev/qlxgbe/ql_glbl.h ============================================================================== --- head/sys/dev/qlxgbe/ql_glbl.h Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_glbl.h Fri Feb 23 03:36:24 2018 (r329855) @@ -49,6 +49,7 @@ extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sd extern int ql_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf); extern void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf); extern int ql_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp); +extern void qla_set_error_recovery(qla_host_t *ha); /* * from ql_hw.c @@ -117,5 +118,11 @@ extern unsigned int ql83xx_minidump_len; extern void ql_alloc_drvr_state_buffer(qla_host_t *ha); extern void ql_free_drvr_state_buffer(qla_host_t *ha); extern void ql_capture_drvr_state(qla_host_t *ha); +extern void ql_sp_log(qla_host_t *ha, uint16_t fmtstr_idx, uint16_t num_params, + uint32_t param0, uint32_t param1, uint32_t param2, + uint32_t param3, uint32_t param4); +extern void ql_alloc_sp_log_buffer(qla_host_t *ha); +extern void ql_free_sp_log_buffer(qla_host_t *ha); + #endif /* #ifndef_QL_GLBL_H_ */ Modified: head/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.c Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_hw.c Fri Feb 23 03:36:24 2018 (r329855) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); static void qla_del_rcv_cntxt(qla_host_t *ha); static int qla_init_rcv_cntxt(qla_host_t *ha); -static void qla_del_xmt_cntxt(qla_host_t *ha); +static int qla_del_xmt_cntxt(qla_host_t *ha); static int qla_init_xmt_cntxt(qla_host_t *ha); static int qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t n_hmbox, uint32_t *fw_mbox, uint32_t n_fwmbox, uint32_t no_pause); @@ -649,11 +649,118 @@ qlnx_add_hw_xmt_stats_sysctls(qla_host_t *ha) } static void +qlnx_add_hw_mbx_cmpl_stats_sysctls(qla_host_t *ha) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *node_children; + + ctx = device_get_sysctl_ctx(ha->pci_dev); + node_children = SYSCTL_CHILDREN(device_get_sysctl_tree(ha->pci_dev)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_lt_200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[0], + "mbx_completion_time_lt_200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_200ms_400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[1], + "mbx_completion_time_200ms_400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_400ms_600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[2], + "mbx_completion_time_400ms_600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_600ms_800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[3], + "mbx_completion_time_600ms_800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_800ms_1000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[4], + "mbx_completion_time_800ms_1000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1000ms_1200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[5], + "mbx_completion_time_1000ms_1200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1200ms_1400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[6], + "mbx_completion_time_1200ms_1400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1400ms_1600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[7], + "mbx_completion_time_1400ms_1600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1600ms_1800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[8], + "mbx_completion_time_1600ms_1800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1800ms_2000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[9], + "mbx_completion_time_1800ms_2000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2000ms_2200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[10], + "mbx_completion_time_2000ms_2200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2200ms_2400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[11], + "mbx_completion_time_2200ms_2400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2400ms_2600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[12], + "mbx_completion_time_2400ms_2600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2600ms_2800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[13], + "mbx_completion_time_2600ms_2800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2800ms_3000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[14], + "mbx_completion_time_2800ms_3000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_3000ms_4000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[15], + "mbx_completion_time_3000ms_4000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_4000ms_5000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[16], + "mbx_completion_time_4000ms_5000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_host_mbx_cntrl_timeout", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[17], + "mbx_completion_host_mbx_cntrl_timeout"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_fw_mbx_cntrl_timeout", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[18], + "mbx_completion_fw_mbx_cntrl_timeout"); + return; +} + +static void qlnx_add_hw_stats_sysctls(qla_host_t *ha) { qlnx_add_hw_mac_stats_sysctls(ha); qlnx_add_hw_rcv_stats_sysctls(ha); qlnx_add_hw_xmt_stats_sysctls(ha); + qlnx_add_hw_mbx_cmpl_stats_sysctls(ha); return; } @@ -920,6 +1027,30 @@ ql_hw_add_sysctls(qla_host_t *ha) "\t Any change requires ifconfig down/up to take effect\n" "\t Note that LRO may be turned off/on via ifconfig\n"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_index", CTLFLAG_RW, &ha->hw.sp_log_index, + ha->hw.sp_log_index, "sp_log_index"); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_stop", CTLFLAG_RW, &ha->hw.sp_log_stop, + ha->hw.sp_log_stop, "sp_log_stop"); + + ha->hw.sp_log_stop_events = 0; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_stop_events", CTLFLAG_RW, + &ha->hw.sp_log_stop_events, + ha->hw.sp_log_stop_events, "Slow path event log is stopped" + " when OR of the following events occur \n" + "\t 0x01 : Heart beat Failure\n" + "\t 0x02 : Temperature Failure\n" + "\t 0x04 : HW Initialization Failure\n" + "\t 0x08 : Interface Initialization Failure\n" + "\t 0x10 : Error Recovery Failure\n"); + ha->hw.mdump_active = 0; SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -1000,13 +1131,13 @@ ql_hw_link_status(qla_host_t *ha) device_printf(ha->pci_dev, "link Down\n"); } - if (ha->hw.flags.fduplex) { + if (ha->hw.fduplex) { device_printf(ha->pci_dev, "Full Duplex\n"); } else { device_printf(ha->pci_dev, "Half Duplex\n"); } - if (ha->hw.flags.autoneg) { + if (ha->hw.autoneg) { device_printf(ha->pci_dev, "Auto Negotiation Enabled\n"); } else { device_printf(ha->pci_dev, "Auto Negotiation Disabled\n"); @@ -1257,19 +1388,39 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t uint32_t i; uint32_t data; int ret = 0; + uint64_t start_usecs; + uint64_t end_usecs; + uint64_t msecs_200; - if (QL_ERR_INJECT(ha, INJCT_MBX_CMD_FAILURE)) { + ql_sp_log(ha, 0, 5, no_pause, h_mbox[0], h_mbox[1], h_mbox[2], h_mbox[3]); + + if (ha->offline || ha->qla_initiate_recovery) { + ql_sp_log(ha, 1, 2, ha->offline, ha->qla_initiate_recovery, 0, 0, 0); + goto exit_qla_mbx_cmd; + } + + if (((ha->err_inject & 0xFFFF) == INJCT_MBX_CMD_FAILURE) && + (((ha->err_inject & ~0xFFFF) == ((h_mbox[0] & 0xFFFF) << 16))|| + !(ha->err_inject & ~0xFFFF))) { ret = -3; - ha->qla_initiate_recovery = 1; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } + start_usecs = qla_get_usec_timestamp(); + if (no_pause) i = 1000; else i = Q8_MBX_MSEC_DELAY; while (i) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 2, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + data = READ_REG32(ha, Q8_HOST_MBOX_CNTRL); if (data == 0) break; @@ -1284,8 +1435,10 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t if (i == 0) { device_printf(ha->pci_dev, "%s: host_mbx_cntrl 0x%08x\n", __func__, data); + ql_sp_log(ha, 3, 1, data, 0, 0, 0, 0); ret = -1; - ha->qla_initiate_recovery = 1; + ha->hw.mbx_comp_msecs[(Q8_MBX_COMP_MSECS - 2)]++; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } @@ -1299,6 +1452,12 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t i = Q8_MBX_MSEC_DELAY; while (i) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 4, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + data = READ_REG32(ha, Q8_FW_MBOX_CNTRL); if ((data & 0x3) == 1) { @@ -1316,18 +1475,44 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t if (i == 0) { device_printf(ha->pci_dev, "%s: fw_mbx_cntrl 0x%08x\n", __func__, data); + ql_sp_log(ha, 5, 1, data, 0, 0, 0, 0); ret = -2; - ha->qla_initiate_recovery = 1; + ha->hw.mbx_comp_msecs[(Q8_MBX_COMP_MSECS - 1)]++; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } for (i = 0; i < n_fwmbox; i++) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 6, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + *fw_mbox++ = READ_REG32(ha, (Q8_FW_MBOX0 + (i << 2))); } WRITE_REG32(ha, Q8_FW_MBOX_CNTRL, 0x0); WRITE_REG32(ha, ha->hw.mbx_intr_mask_offset, 0x0); + end_usecs = qla_get_usec_timestamp(); + + if (end_usecs > start_usecs) { + msecs_200 = (end_usecs - start_usecs)/(1000 * 200); + + if (msecs_200 < 15) + ha->hw.mbx_comp_msecs[msecs_200]++; + else if (msecs_200 < 20) + ha->hw.mbx_comp_msecs[15]++; + else { + device_printf(ha->pci_dev, "%s: [%ld, %ld] %ld\n", __func__, + start_usecs, end_usecs, msecs_200); + ha->hw.mbx_comp_msecs[16]++; + } + } + ql_sp_log(ha, 7, 5, fw_mbox[0], fw_mbox[1], fw_mbox[2], fw_mbox[3], fw_mbox[4]); + + exit_qla_mbx_cmd: return (ret); } @@ -1403,7 +1588,8 @@ qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_i if (qla_mbx_cmd(ha, (uint32_t *)c_intr, (sizeof (q80_config_intr_t) >> 2), ha->hw.mbox, (sizeof (q80_config_intr_rsp_t) >> 2), 0)) { - device_printf(dev, "%s: failed0\n", __func__); + device_printf(dev, "%s: %s failed0\n", __func__, + (create ? "create" : "delete")); return (-1); } @@ -1412,8 +1598,8 @@ qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_i err = Q8_MBX_RSP_STATUS(c_intr_rsp->regcnt_status); if (err) { - device_printf(dev, "%s: failed1 [0x%08x, %d]\n", __func__, err, - c_intr_rsp->nentries); + device_printf(dev, "%s: %s failed1 [0x%08x, %d]\n", __func__, + (create ? "create" : "delete"), err, c_intr_rsp->nentries); for (i = 0; i < c_intr_rsp->nentries; i++) { device_printf(dev, "%s: [%d]:[0x%x 0x%x 0x%x]\n", @@ -2017,7 +2203,8 @@ ql_get_stats(qla_host_t *ha) cmd |= ((ha->pci_func & 0x1) << 16); - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; if (qla_get_hw_stats(ha, cmd, sizeof (q80_get_stats_rsp_t)) == 0) { @@ -2034,7 +2221,8 @@ ql_get_stats(qla_host_t *ha) // cmd |= Q8_GET_STATS_CMD_CLEAR; cmd |= (ha->hw.rcv_cntxt_id << 16); - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; if (qla_get_hw_stats(ha, cmd, sizeof (q80_get_stats_rsp_t)) == 0) { @@ -2045,13 +2233,18 @@ ql_get_stats(qla_host_t *ha) __func__, ha->hw.mbox[0]); } - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; /* * Get XMT Statistics */ - for (i = 0 ; ((i < ha->hw.num_tx_rings) && (!ha->qla_watchdog_pause)); - i++) { + for (i = 0 ; (i < ha->hw.num_tx_rings); i++) { + if (ha->qla_watchdog_pause || + (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) + goto ql_get_stats_exit; + cmd = Q8_GET_STATS_CMD_XMT | Q8_GET_STATS_CMD_TYPE_CNTXT; // cmd |= Q8_GET_STATS_CMD_CLEAR; cmd |= (ha->hw.tx_cntxt[i].tx_cntxt_id << 16); @@ -2681,7 +2874,8 @@ ql_del_hw_if(qla_host_t *ha) qla_del_rcv_cntxt(ha); - qla_del_xmt_cntxt(ha); + if(qla_del_xmt_cntxt(ha)) + goto ql_del_hw_if_exit; if (ha->hw.flags.init_intr_cnxt) { for (i = 0; i < ha->hw.num_sds_rings; ) { @@ -2690,14 +2884,17 @@ ql_del_hw_if(qla_host_t *ha) num_msix = Q8_MAX_INTR_VECTORS; else num_msix = ha->hw.num_sds_rings - i; - qla_config_intr_cntxt(ha, i, num_msix, 0); + if (qla_config_intr_cntxt(ha, i, num_msix, 0)) + break; + i += num_msix; } ha->hw.flags.init_intr_cnxt = 0; } +ql_del_hw_if_exit: if (ha->hw.enable_soft_lro) { qla_drain_soft_lro(ha); qla_free_soft_lro(ha); @@ -3330,19 +3527,22 @@ qla_del_xmt_cntxt_i(qla_host_t *ha, uint32_t txr_idx) return (0); } -static void +static int qla_del_xmt_cntxt(qla_host_t *ha) { uint32_t i; + int ret = 0; if (!ha->hw.flags.init_tx_cnxt) - return; + return (ret); for (i = 0; i < ha->hw.num_tx_rings; i++) { - if (qla_del_xmt_cntxt_i(ha, i)) + if ((ret = qla_del_xmt_cntxt_i(ha, i)) != 0) break; } ha->hw.flags.init_tx_cnxt = 0; + + return (ret); } static int @@ -3352,8 +3552,10 @@ qla_init_xmt_cntxt(qla_host_t *ha) for (i = 0; i < ha->hw.num_tx_rings; i++) { if (qla_init_xmt_cntxt_i(ha, i) != 0) { - for (j = 0; j < i; j++) - qla_del_xmt_cntxt_i(ha, j); + for (j = 0; j < i; j++) { + if (qla_del_xmt_cntxt_i(ha, j)) + break; + } return (-1); } } @@ -3629,22 +3831,23 @@ ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) void ql_update_link_state(qla_host_t *ha) { - uint32_t link_state; + uint32_t link_state = 0; uint32_t prev_link_state; - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ha->hw.link_up = 0; - return; - } - link_state = READ_REG32(ha, Q8_LINK_STATE); - prev_link_state = ha->hw.link_up; - if (ha->pci_func == 0) - ha->hw.link_up = (((link_state & 0xF) == 1)? 1 : 0); - else - ha->hw.link_up = ((((link_state >> 4)& 0xF) == 1)? 1 : 0); + if (ha->ifp->if_drv_flags & IFF_DRV_RUNNING) { + link_state = READ_REG32(ha, Q8_LINK_STATE); + if (ha->pci_func == 0) { + link_state = (((link_state & 0xF) == 1)? 1 : 0); + } else { + link_state = ((((link_state >> 4)& 0xF) == 1)? 1 : 0); + } + } + + atomic_store_rel_8(&ha->hw.link_up, (uint8_t)link_state); + if (prev_link_state != ha->hw.link_up) { if (ha->hw.link_up) { if_link_state_change(ha->ifp, LINK_STATE_UP); @@ -3671,8 +3874,14 @@ ql_hw_check_health(qla_host_t *ha) if (((val & 0xFFFF) == 2) || ((val & 0xFFFF) == 3) || (QL_ERR_INJECT(ha, INJCT_TEMPERATURE_FAILURE))) { - device_printf(ha->pci_dev, "%s: Temperature Alert [0x%08x]\n", - __func__, val); + device_printf(ha->pci_dev, "%s: Temperature Alert" + " at ts_usecs %ld ts_reg = 0x%08x\n", + __func__, qla_get_usec_timestamp(), val); + + if (ha->hw.sp_log_stop_events & Q8_SP_LOG_STOP_TEMP_FAILURE) + ha->hw.sp_log_stop = -1; + + QL_INITIATE_RECOVERY(ha); return -1; } @@ -3693,10 +3902,26 @@ ql_hw_check_health(qla_host_t *ha) __func__, val); if (ha->hw.hbeat_failure < 2) /* we ignore the first failure */ return 0; - else - device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", - __func__, val); + else { + uint32_t peg_halt_status1; + uint32_t peg_halt_status2; + peg_halt_status1 = READ_REG32(ha, Q8_PEG_HALT_STATUS1); + peg_halt_status2 = READ_REG32(ha, Q8_PEG_HALT_STATUS2); + + device_printf(ha->pci_dev, + "%s: Heartbeat Failue at ts_usecs = %ld " + "fw_heart_beat = 0x%08x " + "peg_halt_status1 = 0x%08x " + "peg_halt_status2 = 0x%08x\n", + __func__, qla_get_usec_timestamp(), val, + peg_halt_status1, peg_halt_status2); + + if (ha->hw.sp_log_stop_events & Q8_SP_LOG_STOP_HBEAT_FAILURE) + ha->hw.sp_log_stop = -1; + } + QL_INITIATE_RECOVERY(ha); + return -1; } @@ -4431,8 +4656,8 @@ ql_minidump(qla_host_t *ha) if (ha->hw.mdump_done) return; - - ha->hw.mdump_start_seq_index = ql_stop_sequence(ha); + ha->hw.mdump_usec_ts = qla_get_usec_timestamp(); + ha->hw.mdump_start_seq_index = ql_stop_sequence(ha); bzero(ha->hw.mdump_buffer, ha->hw.mdump_buffer_size); bzero(ha->hw.mdump_template, ha->hw.mdump_template_size); Modified: head/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.h Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_hw.h Fri Feb 23 03:36:24 2018 (r329855) @@ -1602,26 +1602,26 @@ typedef struct _qla_hw { uint32_t unicast_mac :1, bcast_mac :1, - loopback_mode :2, init_tx_cnxt :1, init_rx_cnxt :1, init_intr_cnxt :1, - fduplex :1, - autoneg :1, fdt_valid :1; } flags; - uint16_t link_speed; - uint16_t cable_length; - uint32_t cable_oui; - uint8_t link_up; - uint8_t module_type; - uint8_t link_faults; + volatile uint16_t link_speed; + volatile uint16_t cable_length; + volatile uint32_t cable_oui; + volatile uint8_t link_up; + volatile uint8_t module_type; + volatile uint8_t link_faults; + volatile uint8_t loopback_mode; + volatile uint8_t fduplex; + volatile uint8_t autoneg; - uint8_t mac_rcv_mode; + volatile uint8_t mac_rcv_mode; - uint32_t max_mtu; + volatile uint32_t max_mtu; uint8_t mac_addr[ETHER_ADDR_LEN]; @@ -1705,9 +1705,25 @@ typedef struct _qla_hw { uint32_t mdump_buffer_size; void *mdump_template; uint32_t mdump_template_size; + uint64_t mdump_usec_ts; +#define Q8_MBX_COMP_MSECS (19) + uint64_t mbx_comp_msecs[Q8_MBX_COMP_MSECS]; /* driver state related */ void *drvr_state; + + /* slow path trace */ + uint32_t sp_log_stop_events; +#define Q8_SP_LOG_STOP_HBEAT_FAILURE 0x001 +#define Q8_SP_LOG_STOP_TEMP_FAILURE 0x002 +#define Q8_SP_LOG_STOP_HW_INIT_FAILURE 0x004 +#define Q8_SP_LOG_STOP_IF_START_FAILURE 0x008 +#define Q8_SP_LOG_STOP_ERR_RECOVERY_FAILURE 0x010 + + uint32_t sp_log_stop; + uint32_t sp_log_index; + uint32_t sp_log_num_entries; + void *sp_log; } qla_hw_t; #define QL_UPDATE_RDS_PRODUCER_INDEX(ha, prod_reg, val) \ Modified: head/sys/dev/qlxgbe/ql_inline.h ============================================================================== --- head/sys/dev/qlxgbe/ql_inline.h Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_inline.h Fri Feb 23 03:36:24 2018 (r329855) @@ -168,7 +168,7 @@ qla_lock(qla_host_t *ha, const char *str, uint32_t tim while (1) { mtx_lock(&ha->hw_lock); - if (ha->qla_detach_active) { + if (ha->qla_detach_active || ha->offline) { mtx_unlock(&ha->hw_lock); break; } @@ -193,7 +193,10 @@ qla_lock(qla_host_t *ha, const char *str, uint32_t tim } } - //device_printf(ha->pci_dev, "%s: %s ret = %d\n", __func__, str,ret); +// if (!ha->enable_error_recovery) +// device_printf(ha->pci_dev, "%s: %s ret = %d\n", __func__, +// str,ret); + return (ret); } @@ -204,7 +207,9 @@ qla_unlock(qla_host_t *ha, const char *str) ha->hw_lock_held = 0; ha->qla_unlock = str; mtx_unlock(&ha->hw_lock); - //device_printf(ha->pci_dev, "%s: %s\n", __func__, str); + +// if (!ha->enable_error_recovery) +// device_printf(ha->pci_dev, "%s: %s\n", __func__, str); return; } Modified: head/sys/dev/qlxgbe/ql_ioctl.c ============================================================================== --- head/sys/dev/qlxgbe/ql_ioctl.c Fri Feb 23 03:18:24 2018 (r329854) +++ head/sys/dev/qlxgbe/ql_ioctl.c Fri Feb 23 03:36:24 2018 (r329855) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "ql_ver.h" #include "ql_dbg.h" +static int ql_slowpath_log(qla_host_t *ha, qla_sp_log_t *log); static int ql_drvr_state(qla_host_t *ha, qla_driver_state_t *drvr_state); static uint32_t ql_drvr_state_size(qla_host_t *ha); static int ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, @@ -226,6 +227,7 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, case QLA_RD_FW_DUMP: if (ha->hw.mdump_init == 0) { + device_printf(pci_dev, "%s: minidump not initialized\n", __func__); rval = EINVAL; break; } @@ -235,45 +237,85 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, if ((fw_dump->minidump == NULL) || (fw_dump->minidump_size != (ha->hw.mdump_buffer_size + ha->hw.mdump_template_size))) { + device_printf(pci_dev, + "%s: minidump buffer [%p] size = [%d, %d] invalid\n", __func__, + fw_dump->minidump, fw_dump->minidump_size, + (ha->hw.mdump_buffer_size + ha->hw.mdump_template_size)); rval = EINVAL; break; } - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { - if (!ha->hw.mdump_done) - ha->qla_initiate_recovery = 1; - QLA_UNLOCK(ha, __func__); - } else { + if ((ha->pci_func & 0x1)) { + device_printf(pci_dev, "%s: mindump allowed only on Port0\n", __func__); rval = ENXIO; break; } + + fw_dump->saved = 1; + + if (ha->offline) { + + if (ha->enable_minidump) + ql_minidump(ha); + + fw_dump->saved = 0; + fw_dump->usec_ts = ha->hw.mdump_usec_ts; + + if (!ha->hw.mdump_done) { + device_printf(pci_dev, + "%s: port offline minidump failed\n", __func__); + rval = ENXIO; + break; + } + } else { + + if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + if (!ha->hw.mdump_done) { + fw_dump->saved = 0; + QL_INITIATE_RECOVERY(ha); + device_printf(pci_dev, "%s: recovery initiated " + " to trigger minidump\n", + __func__); + } + QLA_UNLOCK(ha, __func__); + } else { + device_printf(pci_dev, "%s: QLA_LOCK() failed0\n", __func__); + rval = ENXIO; + break; + } #define QLNX_DUMP_WAIT_SECS 30 - count = QLNX_DUMP_WAIT_SECS * 1000; + count = QLNX_DUMP_WAIT_SECS * 1000; - while (count) { - if (ha->hw.mdump_done) - break; - qla_mdelay(__func__, 100); - count -= 100; - } + while (count) { + if (ha->hw.mdump_done) + break; + qla_mdelay(__func__, 100); + count -= 100; + } - if (!ha->hw.mdump_done) { - rval = ENXIO; - break; - } + if (!ha->hw.mdump_done) { + device_printf(pci_dev, + "%s: port not offline minidump failed\n", __func__); + rval = ENXIO; + break; + } + fw_dump->usec_ts = ha->hw.mdump_usec_ts; - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { - ha->hw.mdump_done = 0; - QLA_UNLOCK(ha, __func__); - } else { - rval = ENXIO; - break; + if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + ha->hw.mdump_done = 0; + QLA_UNLOCK(ha, __func__); + } else { + device_printf(pci_dev, "%s: QLA_LOCK() failed1\n", __func__); + rval = ENXIO; + break; + } } if ((rval = copyout(ha->hw.mdump_template, fw_dump->minidump, ha->hw.mdump_template_size))) { + device_printf(pci_dev, "%s: template copyout failed\n", __func__); rval = ENXIO; break; } @@ -281,14 +323,20 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, if ((rval = copyout(ha->hw.mdump_buffer, ((uint8_t *)fw_dump->minidump + ha->hw.mdump_template_size), - ha->hw.mdump_buffer_size))) + ha->hw.mdump_buffer_size))) { + device_printf(pci_dev, "%s: minidump copyout failed\n", __func__); rval = ENXIO; + } break; case QLA_RD_DRVR_STATE: rval = ql_drvr_state(ha, (qla_driver_state_t *)data); break; + case QLA_RD_SLOWPATH_LOG: + rval = ql_slowpath_log(ha, (qla_sp_log_t *)data); + break; + case QLA_RD_PCI_IDS: pci_ids = (qla_rd_pci_ids_t *)data; pci_ids->ven_id = pci_get_vendor(pci_dev); @@ -306,12 +354,12 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, } + static int ql_drvr_state(qla_host_t *ha, qla_driver_state_t *state) { int rval = 0; uint32_t drvr_state_size; - qla_drvr_state_hdr_t *hdr; drvr_state_size = ql_drvr_state_size(ha); @@ -326,11 +374,8 @@ ql_drvr_state(qla_host_t *ha, qla_driver_state_t *stat if (ha->hw.drvr_state == NULL) return (ENOMEM); - hdr = ha->hw.drvr_state; + ql_capture_drvr_state(ha); - if (!hdr->drvr_version_major) - ql_capture_drvr_state(ha); - rval = copyout(ha->hw.drvr_state, state->buffer, drvr_state_size); bzero(ha->hw.drvr_state, drvr_state_size); @@ -418,22 +463,26 @@ ql_capture_drvr_state(qla_host_t *ha) { uint8_t *state_buffer; uint8_t *ptr; - uint32_t drvr_state_size; qla_drvr_state_hdr_t *hdr; uint32_t size; int i; - drvr_state_size = ql_drvr_state_size(ha); - state_buffer = ha->hw.drvr_state; if (state_buffer == NULL) return; - - bzero(state_buffer, drvr_state_size); hdr = (qla_drvr_state_hdr_t *)state_buffer; + + hdr->saved = 0; + if (hdr->drvr_version_major) { + hdr->saved = 1; + return; + } + + hdr->usec_ts = qla_get_usec_timestamp(); + hdr->drvr_version_major = QLA_VERSION_MAJOR; hdr->drvr_version_minor = QLA_VERSION_MINOR; hdr->drvr_version_build = QLA_VERSION_BUILD; @@ -514,6 +563,9 @@ ql_alloc_drvr_state_buffer(qla_host_t *ha) ha->hw.drvr_state = malloc(drvr_state_size, M_QLA83XXBUF, M_NOWAIT); + if (ha->hw.drvr_state != NULL) + bzero(ha->hw.drvr_state, drvr_state_size); + return; } @@ -523,5 +575,95 @@ ql_free_drvr_state_buffer(qla_host_t *ha) if (ha->hw.drvr_state != NULL) free(ha->hw.drvr_state, M_QLA83XXBUF); return; +} + +void +ql_sp_log(qla_host_t *ha, uint16_t fmtstr_idx, uint16_t num_params, + uint32_t param0, uint32_t param1, uint32_t param2, uint32_t param3, + uint32_t param4) +{ + qla_sp_log_entry_t *sp_e, *sp_log; + + if (((sp_log = ha->hw.sp_log) == NULL) || ha->hw.sp_log_stop) + return; + + mtx_lock(&ha->sp_log_lock); + + sp_e = &sp_log[ha->hw.sp_log_index]; + + bzero(sp_e, sizeof (qla_sp_log_entry_t)); + + sp_e->fmtstr_idx = fmtstr_idx; + sp_e->num_params = num_params; + + sp_e->usec_ts = qla_get_usec_timestamp(); + + sp_e->params[0] = param0; + sp_e->params[1] = param1; + sp_e->params[2] = param2; + sp_e->params[3] = param3; + sp_e->params[4] = param4; + + ha->hw.sp_log_index = (ha->hw.sp_log_index + 1) & (NUM_LOG_ENTRIES - 1); + + if (ha->hw.sp_log_num_entries < NUM_LOG_ENTRIES) + ha->hw.sp_log_num_entries++; + + mtx_unlock(&ha->sp_log_lock); + + return; +} + +void +ql_alloc_sp_log_buffer(qla_host_t *ha) +{ + uint32_t size; + + size = (sizeof(qla_sp_log_entry_t)) * NUM_LOG_ENTRIES; + + ha->hw.sp_log = malloc(size, M_QLA83XXBUF, M_NOWAIT); + + if (ha->hw.sp_log != NULL) + bzero(ha->hw.sp_log, size); + + ha->hw.sp_log_index = 0; + ha->hw.sp_log_num_entries = 0; + + return; +} + +void +ql_free_sp_log_buffer(qla_host_t *ha) +{ + if (ha->hw.sp_log != NULL) + free(ha->hw.sp_log, M_QLA83XXBUF); + return; +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 23 04:03:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6652EF24844; Fri, 23 Feb 2018 04:03:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B0AC6A451; Fri, 23 Feb 2018 04:03:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1601B11755; Fri, 23 Feb 2018 04:03:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N4379T053643; Fri, 23 Feb 2018 04:03:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N437lu053638; Fri, 23 Feb 2018 04:03:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230403.w1N437lu053638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 04:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329856 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:03:08 -0000 Author: kevans Date: Fri Feb 23 04:03:07 2018 New Revision: 329856 URL: https://svnweb.freebsd.org/changeset/base/329856 Log: lualoader: Use "local function x()" instead of "local x = function()" The latter is good, but the former is more elegant and clear about what 'x' is. Adopt it, preferably only using the latter kind of notation where needed as values for tables. Modified: head/stand/lua/cli.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Fri Feb 23 03:36:24 2018 (r329855) +++ head/stand/lua/cli.lua Fri Feb 23 04:03:07 2018 (r329856) @@ -38,7 +38,7 @@ local cli = {} -- Defaults to nil and "" respectively. -- This will also parse arguments to autoboot, but the with_kernel argument -- will need to be explicitly overwritten to false -local parse_boot_args = function(argv, with_kernel) +local function parse_boot_args(argv, with_kernel) if with_kernel == nil then with_kernel = true end Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Fri Feb 23 03:36:24 2018 (r329855) +++ head/stand/lua/config.lua Fri Feb 23 04:03:07 2018 (r329856) @@ -336,7 +336,7 @@ function config.loadkernel(other_kernel) local flags = loader.getenv("kernel_options") or "" local kernel = other_kernel or loader.getenv("kernel") - local try_load = function (names) + local function try_load(names) for name in names:gmatch("([^;]+)%s*;?") do local r = loader.perform("load " .. flags .. " " .. name) @@ -347,7 +347,7 @@ function config.loadkernel(other_kernel) return nil end - local load_bootfile = function() + local function load_bootfile() local bootfile = loader.getenv("bootfile") -- append default kernel name Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Fri Feb 23 03:36:24 2018 (r329855) +++ head/stand/lua/core.lua Fri Feb 23 04:03:07 2018 (r329856) @@ -33,7 +33,7 @@ local config = require("config") local core = {} -local compose_loader_cmd = function(cmd_name, argstr) +local function compose_loader_cmd(cmd_name, argstr) if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr end Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Fri Feb 23 03:36:24 2018 (r329855) +++ head/stand/lua/drawer.lua Fri Feb 23 04:03:07 2018 (r329856) @@ -45,7 +45,7 @@ local orb local none local none_shifted = false -local menu_entry_name = function(drawing_menu, entry) +local function menu_entry_name(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type] if name_handler ~= nil then @@ -57,7 +57,7 @@ local menu_entry_name = function(drawing_menu, entry) return entry.name end -local shift_brand_text = function(shift) +local function shift_brand_text(shift) drawer.brand_position.x = drawer.brand_position.x + shift.x drawer.brand_position.y = drawer.brand_position.y + shift.y drawer.menu_position.x = drawer.menu_position.x + shift.x Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Fri Feb 23 03:36:24 2018 (r329855) +++ head/stand/lua/menu.lua Fri Feb 23 04:03:07 2018 (r329856) @@ -38,7 +38,7 @@ local drawer = require("drawer") local menu = {} -local OnOff = function(str, b) +local function OnOff(str, b) if b then return str .. color.escapef(color.GREEN) .. "On" .. color.escapef(color.WHITE) @@ -48,7 +48,7 @@ local OnOff = function(str, b) end end -local bootenvSet = function(env) +local function bootenvSet(env) loader.setenv("vfs.root.mountfrom", env) loader.setenv("currdev", env .. ":") config.reload() From owner-svn-src-all@freebsd.org Fri Feb 23 04:04:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B1E8F249AB; Fri, 23 Feb 2018 04:04:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA4036A602; Fri, 23 Feb 2018 04:04:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B49E011759; Fri, 23 Feb 2018 04:04:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N4430f053719; Fri, 23 Feb 2018 04:04:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N443dd053717; Fri, 23 Feb 2018 04:04:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802230404.w1N443dd053717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 04:04:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329857 - in head/stand: . liblua X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . liblua X-SVN-Commit-Revision: 329857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:04:04 -0000 Author: imp Date: Fri Feb 23 04:04:03 2018 New Revision: 329857 URL: https://svnweb.freebsd.org/changeset/base/329857 Log: Centralize lua defines We need to ensure that we defined Numbers as int64_t everywhere we build for lua. Previously, we were compiling part of the code with Numbers as int64_t and part as double. Move lua number definition to a more-central location Modified: head/stand/liblua/Makefile head/stand/lua.mk Modified: head/stand/liblua/Makefile ============================================================================== --- head/stand/liblua/Makefile Fri Feb 23 04:03:07 2018 (r329856) +++ head/stand/liblua/Makefile Fri Feb 23 04:04:03 2018 (r329857) @@ -5,6 +5,8 @@ .PATH: ${LUASRC} .PATH: ${LIBLUASRC} +.include "${BOOTSRC}/lua.mk" + LIB= lua INTERNALLIB= @@ -25,9 +27,8 @@ SRCS+= lerrno.c lfs.c lstd.c lutils.c WARNS= 3 -CFLAGS+= -DLUA_FLOAT_TYPE=LUA_FLOAT_INT64 CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" -CFLAGS+= -ffreestanding -nostdlib -DBOOT_LUA -DLUA_USE_POSIX +CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: head/stand/lua.mk ============================================================================== --- head/stand/lua.mk Fri Feb 23 04:03:07 2018 (r329856) +++ head/stand/lua.mk Fri Feb 23 04:04:03 2018 (r329857) @@ -2,11 +2,6 @@ # Common flags to build lua related files -.include "defs.mk" - -.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 -CFLAGS+= -fPIC -.endif - CFLAGS+= -I${LUASRC} -I${LDRSRC} -I${LIBLUASRC} -CFLAGS+= -DBOOT_LUA +# CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=poison-shake -D__OMIT_FLOAT +CFLAGS+= -DLUA_FLOAT_TYPE=LUA_FLOAT_INT64 From owner-svn-src-all@freebsd.org Fri Feb 23 04:04:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87EB2F24A28; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B92E6A703; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3663E1175A; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N44JYt053781; Fri, 23 Feb 2018 04:04:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N44IO7053779; Fri, 23 Feb 2018 04:04:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802230404.w1N44IO7053779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 04:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329858 - head/contrib/lua/src X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/lua/src X-SVN-Commit-Revision: 329858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:04:19 -0000 Author: imp Date: Fri Feb 23 04:04:18 2018 New Revision: 329858 URL: https://svnweb.freebsd.org/changeset/base/329858 Log: When the LUA_FLOAT_TYPE != LUA_FLOAT_INT64, we can't reference float or double so ifdef that code out when the numbers aren't float at all. There's still references in the lmathlib.c, but we don't compile that for the loader yet. Differential Revision: https://reviews.freebsd.org/D14472 Modified: head/contrib/lua/src/llimits.h head/contrib/lua/src/lstrlib.c Modified: head/contrib/lua/src/llimits.h ============================================================================== --- head/contrib/lua/src/llimits.h Fri Feb 23 04:04:03 2018 (r329857) +++ head/contrib/lua/src/llimits.h Fri Feb 23 04:04:18 2018 (r329858) @@ -66,7 +66,9 @@ typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; #else typedef union { lua_Number n; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 double u; +#endif void *s; lua_Integer i; long l; Modified: head/contrib/lua/src/lstrlib.c ============================================================================== --- head/contrib/lua/src/lstrlib.c Fri Feb 23 04:04:03 2018 (r329857) +++ head/contrib/lua/src/lstrlib.c Fri Feb 23 04:04:18 2018 (r329858) @@ -1134,7 +1134,11 @@ static const union { /* dummy structure to get native alignment requirements */ struct cD { char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; + union { +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 + double d; +#endif + void *p; lua_Integer i; lua_Number n; } u; }; #define MAXALIGN (offsetof(struct cD, u)) @@ -1144,8 +1148,10 @@ struct cD { ** Union for serializing floats */ typedef union Ftypes { +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 float f; double d; +#endif lua_Number n; char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ } Ftypes; @@ -1235,8 +1241,10 @@ static KOption getoption (Header *h, const char **fmt, case 'j': *size = sizeof(lua_Integer); return Kint; case 'J': *size = sizeof(lua_Integer); return Kuint; case 'T': *size = sizeof(size_t); return Kuint; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 case 'f': *size = sizeof(float); return Kfloat; case 'd': *size = sizeof(double); return Kfloat; +#endif case 'n': *size = sizeof(lua_Number); return Kfloat; case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; @@ -1369,9 +1377,13 @@ static int str_pack (lua_State *L) { volatile Ftypes u; char *buff = luaL_prepbuffsize(&b, size); lua_Number n = luaL_checknumber(L, arg); /* get argument */ +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ else if (size == sizeof(u.d)) u.d = (double)n; else u.n = n; +#else + u.n = n; +#endif /* move 'u' to final result, correcting endianness if needed */ copywithendian(buff, u.buff, size, h.islittle); luaL_addsize(&b, size); @@ -1507,9 +1519,13 @@ static int str_unpack (lua_State *L) { volatile Ftypes u; lua_Number num; copywithendian(u.buff, data + pos, size, h.islittle); +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 if (size == sizeof(u.f)) num = (lua_Number)u.f; else if (size == sizeof(u.d)) num = (lua_Number)u.d; else num = u.n; +#else + num = u.n; +#endif lua_pushnumber(L, num); break; } From owner-svn-src-all@freebsd.org Fri Feb 23 04:04:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F433F24A7C; Fri, 23 Feb 2018 04:04:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 265FA6A7F7; Fri, 23 Feb 2018 04:04:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 215701175B; Fri, 23 Feb 2018 04:04:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N44RLc053847; Fri, 23 Feb 2018 04:04:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N44PiD053834; Fri, 23 Feb 2018 04:04:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802230404.w1N44PiD053834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 04:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sys/x86/include X-SVN-Commit-Revision: 329859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:04:27 -0000 Author: imp Date: Fri Feb 23 04:04:25 2018 New Revision: 329859 URL: https://svnweb.freebsd.org/changeset/base/329859 Log: Do not include float interfaces when using libsa. We don't support float in the boot loaders, so don't include interfaces for float or double in systems headers. In addition, take the unusual step of spiking double and float to prevent any more accidental seepage. Modified: head/contrib/compiler-rt/lib/builtins/int_types.h head/include/time.h head/stand/defs.mk head/stand/lua.mk head/sys/arm/include/_types.h head/sys/arm64/include/_types.h head/sys/mips/include/_types.h head/sys/powerpc/include/_types.h head/sys/powerpc/include/pcb.h head/sys/riscv/include/_types.h head/sys/sparc64/include/_types.h head/sys/sys/_types.h head/sys/x86/include/_types.h Modified: head/contrib/compiler-rt/lib/builtins/int_types.h ============================================================================== --- head/contrib/compiler-rt/lib/builtins/int_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/contrib/compiler-rt/lib/builtins/int_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -114,6 +114,7 @@ static __inline tu_int make_tu(du_int h, du_int l) { #endif /* CRT_HAS_128BIT */ +#ifndef _STANDALONE typedef union { su_int u; @@ -125,6 +126,7 @@ typedef union udwords u; double f; } double_bits; +#endif typedef struct { @@ -137,6 +139,7 @@ typedef struct #endif /* _YUGA_LITTLE_ENDIAN */ } uqwords; +#ifndef _STANDALONE typedef union { uqwords u; @@ -159,6 +162,7 @@ typedef struct { long double real, imaginary; } Lcompl #define COMPLEX_REAL(x) (x).real #define COMPLEX_IMAGINARY(x) (x).imaginary +#endif #endif #endif /* INT_TYPES_H */ Modified: head/include/time.h ============================================================================== --- head/include/time.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/include/time.h Fri Feb 23 04:04:25 2018 (r329859) @@ -146,7 +146,9 @@ __BEGIN_DECLS char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); +#ifndef _STANDALONE double difftime(time_t, time_t); +#endif /* XXX missing: getdate() */ struct tm *gmtime(const time_t *); struct tm *localtime(const time_t *); Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Fri Feb 23 04:04:18 2018 (r329858) +++ head/stand/defs.mk Fri Feb 23 04:04:25 2018 (r329859) @@ -51,6 +51,9 @@ CFLAGS+= -I${BOOTOBJ}/libsa .endif CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} +# Spike the floating point interfaces +CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=boaty-mcboatface + # GELI Support, with backward compat hooks (mostly) .if defined(HAVE_GELI) Modified: head/stand/lua.mk ============================================================================== --- head/stand/lua.mk Fri Feb 23 04:04:18 2018 (r329858) +++ head/stand/lua.mk Fri Feb 23 04:04:25 2018 (r329859) @@ -3,5 +3,4 @@ # Common flags to build lua related files CFLAGS+= -I${LUASRC} -I${LDRSRC} -I${LIBLUASRC} -# CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=poison-shake -D__OMIT_FLOAT CFLAGS+= -DLUA_FLOAT_TYPE=LUA_FLOAT_INT64 Modified: head/sys/arm/include/_types.h ============================================================================== --- head/sys/arm/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/arm/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; */ typedef __uint32_t __clock_t; /* clock()... */ typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; Modified: head/sys/arm64/include/_types.h ============================================================================== --- head/sys/arm64/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/arm64/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: head/sys/mips/include/_types.h ============================================================================== --- head/sys/mips/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/mips/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -75,8 +75,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __mips_n64 typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; Modified: head/sys/powerpc/include/_types.h ============================================================================== --- head/sys/powerpc/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/powerpc/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -74,8 +74,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __LP64__ typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; Modified: head/sys/powerpc/include/pcb.h ============================================================================== --- head/sys/powerpc/include/pcb.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/powerpc/include/pcb.h Fri Feb 23 04:04:25 2018 (r329859) @@ -39,6 +39,7 @@ #include +#ifndef _STANDALONE struct pcb { register_t pcb_context[20]; /* non-volatile r14-r31 */ register_t pcb_cr; /* Condition register */ @@ -81,6 +82,7 @@ struct pcb { } booke; } pcb_cpu; }; +#endif #ifdef _KERNEL Modified: head/sys/riscv/include/_types.h ============================================================================== --- head/sys/riscv/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/riscv/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: head/sys/sparc64/include/_types.h ============================================================================== --- head/sys/sparc64/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/sparc64/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -58,8 +58,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: head/sys/sys/_types.h ============================================================================== --- head/sys/sys/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/sys/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -104,7 +104,9 @@ typedef __uint_least32_t __char32_t; typedef struct { long long __max_align1 __aligned(_Alignof(long long)); +#ifndef _STANDALONE long double __max_align2 __aligned(_Alignof(long double)); +#endif } __max_align_t; typedef __uint64_t __dev_t; /* device number */ Modified: head/sys/x86/include/_types.h ============================================================================== --- head/sys/x86/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) +++ head/sys/x86/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) @@ -74,15 +74,19 @@ typedef unsigned long long __uint64_t; #ifdef __LP64__ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else typedef unsigned long __clock_t; typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef long double __double_t; typedef long double __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif From owner-svn-src-all@freebsd.org Fri Feb 23 04:06:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F22FF24C9E; Fri, 23 Feb 2018 04:06:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE076AB0D; Fri, 23 Feb 2018 04:06:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AE411175F; Fri, 23 Feb 2018 04:06:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N46Fo4054078; Fri, 23 Feb 2018 04:06:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N46FTn054077; Fri, 23 Feb 2018 04:06:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802230406.w1N46FTn054077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 04:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329860 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 329860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:06:16 -0000 Author: imp Date: Fri Feb 23 04:06:15 2018 New Revision: 329860 URL: https://svnweb.freebsd.org/changeset/base/329860 Log: Floaty McFloatface is funnier... Submitted by: emaste@ Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Fri Feb 23 04:04:25 2018 (r329859) +++ head/stand/defs.mk Fri Feb 23 04:06:15 2018 (r329860) @@ -52,7 +52,7 @@ CFLAGS+= -I${BOOTOBJ}/libsa CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} # Spike the floating point interfaces -CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=boaty-mcboatface +CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface # GELI Support, with backward compat hooks (mostly) From owner-svn-src-all@freebsd.org Fri Feb 23 04:12:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A93EF25515; Fri, 23 Feb 2018 04:12:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AF566B0B4; Fri, 23 Feb 2018 04:12:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25CC4118DE; Fri, 23 Feb 2018 04:12:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N4CK7W058708; Fri, 23 Feb 2018 04:12:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N4CKTi058707; Fri, 23 Feb 2018 04:12:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802230412.w1N4CKTi058707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 23 Feb 2018 04:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329861 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:12:20 -0000 Author: kevans Date: Fri Feb 23 04:12:19 2018 New Revision: 329861 URL: https://svnweb.freebsd.org/changeset/base/329861 Log: lualoader: Track effective line number, use it for drawing Takes into account hidden entries, so that we don't draw blank lines in place of a hidden item. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Fri Feb 23 04:06:15 2018 (r329860) +++ head/stand/lua/drawer.lua Fri Feb 23 04:12:19 2018 (r329861) @@ -273,6 +273,7 @@ function drawer.drawmenu(m) local alias_table = {} local entry_num = 0 local menu_entries = m.entries + local effective_line_num = 0 if type(menu_entries) == "function" then menu_entries = menu_entries() end @@ -282,9 +283,10 @@ function drawer.drawmenu(m) if e.visible ~= nil and not e.visible() then goto continue end + effective_line_num = effective_line_num + 1 if e.entry_type ~= core.MENU_SEPARATOR then entry_num = entry_num + 1 - screen.setcursor(x, y + line_num) + screen.setcursor(x, y + effective_line_num) print(entry_num .. ". " .. menu_entry_name(m, e)) @@ -296,7 +298,7 @@ function drawer.drawmenu(m) end end else - screen.setcursor(x, y + line_num) + screen.setcursor(x, y + effective_line_num) print(menu_entry_name(m, e)) end ::continue:: From owner-svn-src-all@freebsd.org Fri Feb 23 06:13:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F053EF2B606; Fri, 23 Feb 2018 06:12:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 69F326E999; Fri, 23 Feb 2018 06:12:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id A0180104662D; Fri, 23 Feb 2018 17:12:43 +1100 (AEDT) Date: Fri, 23 Feb 2018 17:12:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy... In-Reply-To: <201802230404.w1N44PiD053834@repo.freebsd.org> Message-ID: <20180223170403.I1331@besplex.bde.org> References: <201802230404.w1N44PiD053834@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=h-r1RgMtWi5J3qg0wtcA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 06:13:00 -0000 On Fri, 23 Feb 2018, Warner Losh wrote: > Log: > Do not include float interfaces when using libsa. > > We don't support float in the boot loaders, so don't include > interfaces for float or double in systems headers. In addition, take > the unusual step of spiking double and float to prevent any more > accidental seepage. This unimproves all the _types.h headers, probably for no benefits for lua. > Modified: head/sys/arm/include/_types.h > ============================================================================== > --- head/sys/arm/include/_types.h Fri Feb 23 04:04:18 2018 (r329858) > +++ head/sys/arm/include/_types.h Fri Feb 23 04:04:25 2018 (r329859) > @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; > */ > typedef __uint32_t __clock_t; /* clock()... */ > typedef __int32_t __critical_t; > +#ifndef _STANDALONE > typedef double __double_t; > typedef float __float_t; > +#endif > typedef __int32_t __intfptr_t; > typedef __int64_t __intmax_t; > typedef __int32_t __intptr_t; __types.h headers exist to avoid ifdefs like this. They only define types in the implementation namespace. Nothing except should use __double_t or __float_t directly. There is only a problem if some option like -fno-float turns off floating point completely, so that 'float' is a syntax error. Bruce From owner-svn-src-all@freebsd.org Fri Feb 23 07:43:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9299F0380E; Fri, 23 Feb 2018 07:43:52 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B0DB715EA; Fri, 23 Feb 2018 07:43:52 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75FC213AD3; Fri, 23 Feb 2018 07:43:52 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N7hq13063532; Fri, 23 Feb 2018 07:43:52 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N7hqNI063531; Fri, 23 Feb 2018 07:43:52 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201802230743.w1N7hqNI063531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 23 Feb 2018 07:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329862 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 329862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 07:43:53 -0000 Author: wma Date: Fri Feb 23 07:43:52 2018 New Revision: 329862 URL: https://svnweb.freebsd.org/changeset/base/329862 Log: powerpc64: add NVMe to GENERIC64 NVMe support is ready and should be compiled-in to the ppc64 kernel. Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Fri Feb 23 04:12:19 2018 (r329861) +++ head/sys/powerpc/conf/GENERIC64 Fri Feb 23 07:43:52 2018 (r329862) @@ -112,6 +112,10 @@ device ata # Legacy ATA/SATA controllers device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA +# NVM Express (NVMe) support +device nvme # base NVMe driver +device nvd # expose NVMe namespaces as disks, depends on nvme + # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O From owner-svn-src-all@freebsd.org Fri Feb 23 09:03:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6BC1F0A6FD; Fri, 23 Feb 2018 09:03:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 49520743ED; Fri, 23 Feb 2018 09:02:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id ED7173CC235; Fri, 23 Feb 2018 20:02:53 +1100 (AEDT) Date: Fri, 23 Feb 2018 20:02:53 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy... In-Reply-To: <20180223170403.I1331@besplex.bde.org> Message-ID: <20180223195615.A1841@besplex.bde.org> References: <201802230404.w1N44PiD053834@repo.freebsd.org> <20180223170403.I1331@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=3EwBRef536-gmVKkDUMA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 09:03:00 -0000 On Fri, 23 Feb 2018, Bruce Evans wrote: > On Fri, 23 Feb 2018, Warner Losh wrote: > >> Log: >> Do not include float interfaces when using libsa. >> >> We don't support float in the boot loaders, so don't include >> interfaces for float or double in systems headers. In addition, take >> the unusual step of spiking double and float to prevent any more >> accidental seepage. > > This unimproves all the _types.h headers, probably for no benefits for lua. > >> Modified: head/sys/arm/include/_types.h >> ============================================================================== >> --- head/sys/arm/include/_types.h Fri Feb 23 04:04:18 2018 >> (r329858) >> +++ head/sys/arm/include/_types.h Fri Feb 23 04:04:25 2018 >> (r329859) >> @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; >> */ >> typedef __uint32_t __clock_t; /* clock()... */ >> typedef __int32_t __critical_t; >> +#ifndef _STANDALONE >> typedef double __double_t; >> typedef float __float_t; >> +#endif >> typedef __int32_t __intfptr_t; >> typedef __int64_t __intmax_t; >> typedef __int32_t __intptr_t; > > __types.h headers exist to avoid ifdefs like this. They only define types > in the implementation namespace. Nothing except should use > __double_t or __float_t directly. There is only a problem if some option > like -fno-float turns off floating point completely, so that 'float' is > a syntax error. Actually you created the syntax errors by defining float and double in makefiles. This gives undefined behaviour. Bruce From owner-svn-src-all@freebsd.org Fri Feb 23 11:17:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26924F15F26; Fri, 23 Feb 2018 11:17:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE87F79647; Fri, 23 Feb 2018 11:17:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4BB715CA8; Fri, 23 Feb 2018 11:17:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NBHGcP068567; Fri, 23 Feb 2018 11:17:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NBHGtE068566; Fri, 23 Feb 2018 11:17:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802231117.w1NBHGtE068566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Feb 2018 11:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329863 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 329863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 11:17:17 -0000 Author: kib Date: Fri Feb 23 11:17:16 2018 New Revision: 329863 URL: https://svnweb.freebsd.org/changeset/base/329863 Log: MFC r329416: Remove unused symbols. Modified: stable/11/sys/x86/x86/mp_x86.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Fri Feb 23 07:43:52 2018 (r329862) +++ stable/11/sys/x86/x86/mp_x86.c Fri Feb 23 11:17:16 2018 (r329863) @@ -74,15 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define WARMBOOT_TARGET 0 -#define WARMBOOT_OFF (KERNBASE + 0x0467) -#define WARMBOOT_SEG (KERNBASE + 0x0469) - -#define CMOS_REG (0x70) -#define CMOS_DATA (0x71) -#define BIOS_RESET (0x0f) -#define BIOS_WARM (0x0a) - /* lock region used by kernel profiling */ int mcount_lock; From owner-svn-src-all@freebsd.org Fri Feb 23 11:20:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B527DF164A4; Fri, 23 Feb 2018 11:20:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60170799CD; Fri, 23 Feb 2018 11:20:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AE4615CD4; Fri, 23 Feb 2018 11:20:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NBKx0K068757; Fri, 23 Feb 2018 11:20:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NBKxCs068756; Fri, 23 Feb 2018 11:20:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802231120.w1NBKxCs068756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Feb 2018 11:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329864 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 329864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 11:20:59 -0000 Author: kib Date: Fri Feb 23 11:20:59 2018 New Revision: 329864 URL: https://svnweb.freebsd.org/changeset/base/329864 Log: Do not return out of bound pointers from intr_lookup_source(). This hardens the code against driver and upper level bugs causing invalid indexes used, e.g. on msi release. Reported by: gallatin Reviewed by: gallatin, hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D14470 Modified: head/sys/x86/x86/intr_machdep.c Modified: head/sys/x86/x86/intr_machdep.c ============================================================================== --- head/sys/x86/x86/intr_machdep.c Fri Feb 23 11:17:16 2018 (r329863) +++ head/sys/x86/x86/intr_machdep.c Fri Feb 23 11:20:59 2018 (r329864) @@ -178,6 +178,8 @@ struct intsrc * intr_lookup_source(int vector) { + if (vector < 0 || vector >= nitems(interrupt_sources)) + return (NULL); return (interrupt_sources[vector]); } From owner-svn-src-all@freebsd.org Fri Feb 23 14:30:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33598F26AB1 for ; Fri, 23 Feb 2018 14:30:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEB6982B5A for ; Fri, 23 Feb 2018 14:30:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id v6so8855580iog.7 for ; Fri, 23 Feb 2018 06:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=xTQWHqx6T3AapJLwZwAue9rQ0s6FBb4MtAj2jnl8NAY=; b=wnNPCCzXjwVpNjfNlcumBbZvK0wp1dJV7YyMb4LIClQGBw2J1dyF3lx9HaYqK2OWqQ WyyRwiz6okv4dE/X5AI6swr5kNTcZOlqmwkYFi0Ir559kk0Hltjr885keNaBfoanT5uN cH8CRYJYlzTU5XGclE3hNIV0xPLmQvHdVAXQfGzberIJrsEZ05uj5g4D5+kctCOvCBfS SzkTva1GUjZl6bKmSzZTGZdr2nraM6lZVsdoKn7V7w3+KDRGOR4QlJfXcwTPmmhfe5ll tvjMc09ys/5GsxjvJZNfgkK6C3toU35UTjNAKtRC6wxD+4/pfDtXqdLF2XL1hQGTcI6A kPrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=xTQWHqx6T3AapJLwZwAue9rQ0s6FBb4MtAj2jnl8NAY=; b=Y6YCUra0PKoUFG/GQwderRnKw4zQ/gsObqO2PVmzEL4h8t6Q0SJ1ehEeo/GeuV6EV+ +01zlJwnrZUd8jK2O3oFHy8QPHA/YR4NiMxsEcZbGM3BTKiMSNm6n9a4rpH/S2KOPdRT SbPgI6cqombpCmp5xJL+YYv0Da21G41XU621yjti60nnOT5nHLlC87gFih3wtT0JPPre B5YXJ08CoLdf8tZawqAyL6732bMCoxNmL4ydUT2QWd8D5hJxOpjKZzwNk8tzRirz3nQw 86kh0ALYNNWVldZlg+WO2HF8wXztkrT7rtGBGQcu3Vkm8Bw6hDkrxUxVuFiMEYiIj74E YCcQ== X-Gm-Message-State: APf1xPC2bJuNGcG1eQm3Buq441Y3idZ7XfJvD9rFVkbSXN0moxJUEv8L qr7U0G5FxxJElugoc7mp68CE2+roimKknN8KxVDVtEuz X-Google-Smtp-Source: AG47ELtTasWK81cxlpRuFlTZU/mfjlcYC8YLwlNq6li3sUbuSawUnB9Z17NuzPBnyLhJq+rY4ec0poa/c6CMOmHbxkg= X-Received: by 10.107.180.83 with SMTP id d80mr1902590iof.168.1519396216589; Fri, 23 Feb 2018 06:30:16 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Fri, 23 Feb 2018 06:30:15 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180223170403.I1331@besplex.bde.org> References: <201802230404.w1N44PiD053834@repo.freebsd.org> <20180223170403.I1331@besplex.bde.org> From: Warner Losh Date: Fri, 23 Feb 2018 07:30:15 -0700 X-Google-Sender-Auth: 6ZBIMAgZYbwnKFcUMZINc7RVfCA Message-ID: Subject: Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy... To: Bruce Evans Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 14:30:18 -0000 On Thu, Feb 22, 2018 at 11:12 PM, Bruce Evans wrote: > On Fri, 23 Feb 2018, Warner Losh wrote: > > Log: >> Do not include float interfaces when using libsa. >> >> We don't support float in the boot loaders, so don't include >> interfaces for float or double in systems headers. In addition, take >> the unusual step of spiking double and float to prevent any more >> accidental seepage. >> > > This unimproves all the _types.h headers, probably for no benefits for lua. > > Modified: head/sys/arm/include/_types.h >> ============================================================ >> ================== >> --- head/sys/arm/include/_types.h Fri Feb 23 04:04:18 2018 >> (r329858) >> +++ head/sys/arm/include/_types.h Fri Feb 23 04:04:25 2018 >> (r329859) >> @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; >> */ >> typedef __uint32_t __clock_t; /* clock()... */ >> typedef __int32_t __critical_t; >> +#ifndef _STANDALONE >> typedef double __double_t; >> typedef float __float_t; >> +#endif >> typedef __int32_t __intfptr_t; >> typedef __int64_t __intmax_t; >> typedef __int32_t __intptr_t; >> > > __types.h headers exist to avoid ifdefs like this. They only define types > in the implementation namespace. Nothing except should use > __double_t or __float_t directly. There is only a problem if some option > like -fno-float turns off floating point completely, so that 'float' is > a syntax error. Right. Except, there's no longer a -fno-float option. Then again, these should almost certainly be in sys/_types instead because they are identical on every platform and will almost certainly never ever be anything other than what they are. For the boot loader, I spiked double and float definitions so that we don't touch floating point types at all. We do this in the Makefile by intentionally creating syntax errors. I don't think this is undefined behavior, I think it is well defined behavior: A syntax error is a syntax error. We're using a restricted set of C for the loader anyway. It's mostly to prevent accidental use of floating point. If we ever support floats and such in the boot loader, I'll revert. This helps us catch accidents like one of the lua files being compiled incorrectly, leading to stray references to float/double on arm which caused float stuff to be referenced and pulled in due to inlining. That's the real bug, and that's been fixed. Until we need float/double in the loader, I'll keep this in place to prevent a recurrence. Warner From owner-svn-src-all@freebsd.org Fri Feb 23 14:47:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CF8DF27C94; Fri, 23 Feb 2018 14:47:17 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 784CF837C2; Fri, 23 Feb 2018 14:47:14 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1NEl5WQ096145; Fri, 23 Feb 2018 06:47:05 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1NEl58N096144; Fri, 23 Feb 2018 06:47:05 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802231447.w1NEl58N096144@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug In-Reply-To: <201802230311.w1N3BhiJ023939@repo.freebsd.org> To: Alan Somers Date: Fri, 23 Feb 2018 06:47:05 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 14:47:17 -0000 > Author: asomers > Date: Fri Feb 23 03:11:43 2018 > New Revision: 329853 > URL: https://svnweb.freebsd.org/changeset/base/329853 > > Log: > libifconfig: multiple feature additions > > Added the ability to: > > * Create virtual interfaces > * Create vlan interfaces > * Get interface fib > * Get interface groups > * Get interface status > * Get nd6 info > * Get media status > * Get additional ifaddr info in a convenient struct > * Get vhids > * Get carp info > * Get lagg and laggport status > * Iterate over all interfaces and ifaddrs Love that list!!! > > And add more examples, too. Remove MIT 1996 Copyright? Under what conditions is it that this is being done? > Note that this is a backwards-incompatible change. But that's ok, because it's > a private library. > > MFC after: 3 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D14463 With 0 feed back? And a ~30 hour life time? It is not a diffential if no one looks at, comments on, or accepts the revision. > Added: > head/lib/libifconfig/libifconfig_carp.c (contents, props changed) > head/lib/libifconfig/libifconfig_inet.c (contents, props changed) > head/lib/libifconfig/libifconfig_inet6.c (contents, props changed) > head/lib/libifconfig/libifconfig_lagg.c (contents, props changed) > head/lib/libifconfig/libifconfig_media.c (contents, props changed) > head/share/examples/libifconfig/ifchangevlan.c (contents, props changed) > head/share/examples/libifconfig/ifcreatevlan.c (contents, props changed) > head/share/examples/libifconfig/status.c (contents, props changed) > Modified: > head/lib/libifconfig/Makefile > head/lib/libifconfig/libifconfig.c > head/lib/libifconfig/libifconfig.h > head/lib/libifconfig/libifconfig_internal.c > head/lib/libifconfig/libifconfig_internal.h > head/share/examples/libifconfig/Makefile > head/share/examples/libifconfig/ifcreate.c > head/share/examples/libifconfig/ifdestroy.c > head/share/examples/libifconfig/setdescription.c > head/share/examples/libifconfig/setmtu.c > head/usr.sbin/wlandebug/wlandebug.c > > Modified: head/lib/libifconfig/Makefile > ============================================================================== > --- head/lib/libifconfig/Makefile Fri Feb 23 02:53:50 2018 (r329852) > +++ head/lib/libifconfig/Makefile Fri Feb 23 03:11:43 2018 (r329853) > @@ -8,7 +8,9 @@ NO_PIC= > > SHLIBDIR?= /lib > SHLIB_MAJOR= 1 > -SRCS= libifconfig.c libifconfig_internal.c > +SRCS= libifconfig.c libifconfig_carp.c libifconfig_inet.c > +SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c > +SRCS+= libifconfig_media.c > > INCSDIR= ${INCLUDEDIR} > INCS= libifconfig.h > @@ -16,6 +18,6 @@ INCS= libifconfig.h > #MAN= libifconfig.3 > > CFLAGS+= -I${.CURDIR} > -WARNS?=6 > +NO_WCAST_ALIGN= yes > > .include > > Modified: head/lib/libifconfig/libifconfig.c > ============================================================================== > --- head/lib/libifconfig/libifconfig.c Fri Feb 23 02:53:50 2018 (r329852) > +++ head/lib/libifconfig/libifconfig.c Fri Feb 23 03:11:43 2018 (r329853) > @@ -1,38 +1,7 @@ > /* > - * Copyright (c) 2016, Marie Helene Kvello-Aune > - * All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without modification, > - * are permitted provided that the following conditions are met: > - * > - * 1. Redistributions of source code must retain the above copyright notice, > - * thislist of conditions and the following disclaimer. > - * > - * 2. Redistributions in binary form must reproduce the above copyright notice, > - * this list of conditions and the following disclaimer in the documentation and/or > - * other materials provided with the distribution. > - * > - * 3. Neither the name of the copyright holder nor the names of its contributors > - * may be used to endorse or promote products derived from this software without > - * specific prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" > - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE > - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER > - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, > - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > - * > - * $FreeBSD$ > - */ > - > -/* > * Copyright (c) 1983, 1993 > * The Regents of the University of California. All rights reserved. > + * Copyright (c) 2016-2017, Marie Helene Kvello-Aune. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -61,65 +30,63 @@ > * $FreeBSD$ > */ > > - /* > - * Copyright 1996 Massachusetts Institute of Technology > - * > - * Permission to use, copy, modify, and distribute this software and > - * its documentation for any purpose and without fee is hereby > - * granted, provided that both the above copyright notice and this > - * permission notice appear in all copies, that both the above > - * copyright notice and this permission notice appear in all > - * supporting documentation, and that the name of M.I.T. not be used > - * in advertising or publicity pertaining to distribution of the > - * software without specific, written prior permission. M.I.T. makes > - * no representations about the suitability of this software for any > - * purpose. It is provided "as is" without express or implied > - * warranty. > - * > - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS > - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, > - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT > - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, > - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT > - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - * > - * $FreeBSD$ > - */ > - > #include > #include > #include > > #include > #include > +#include > +#include > +#include > > #include > #include > #include > +#include > +#include > #include > #include > #include > #include > > +#include > + > #include "libifconfig.h" > #include "libifconfig_internal.h" > > +#define NOTAG ((u_short) -1) > > +static bool > +isnd6defif(ifconfig_handle_t *h, const char *name) > +{ > + struct in6_ndifreq ndifreq; > + unsigned int ifindex; > + > + memset(&ndifreq, 0, sizeof(ndifreq)); > + strlcpy(ndifreq.ifname, name, sizeof(ndifreq.ifname)); > + ifindex = if_nametoindex(ndifreq.ifname); > + if (ifconfig_ioctlwrap(h, AF_INET6, SIOCGDEFIFACE_IN6, &ndifreq) < 0) { > + return (false); > + } > + h->error.errtype = OK; > + return (ndifreq.ifindex == ifindex); > +} > + > ifconfig_handle_t * > ifconfig_open(void) > { > - struct ifconfig_handle *h; > + ifconfig_handle_t *h; > > h = calloc(1, sizeof(*h)); > + > + if (h == NULL) { > + return (NULL); > + } > for (int i = 0; i <= AF_MAX; i++) { > h->sockets[i] = -1; > } > + > return (h); > } > > @@ -132,6 +99,7 @@ ifconfig_close(ifconfig_handle_t *h) > (void)close(h->sockets[i]); > } > } > + freeifaddrs(h->ifap); > free(h); > } > > @@ -157,6 +125,46 @@ ifconfig_err_ioctlreq(ifconfig_handle_t *h) > } > > int > +ifconfig_foreach_iface(ifconfig_handle_t *h, > + ifconfig_foreach_func_t cb, void *udata) > +{ > + int ret; > + > + ret = ifconfig_getifaddrs(h); > + if (ret == 0) { > + struct ifaddrs *ifa; > + char *ifname = NULL; > + > + for (ifa = h->ifap; ifa; ifa = ifa->ifa_next) { > + if (ifname != ifa->ifa_name) { > + ifname = ifa->ifa_name; > + cb(h, ifa, udata); > + } > + } > + } > + /* Free ifaddrs so we don't accidentally cache stale data */ > + freeifaddrs(h->ifap); > + h->ifap = NULL; > + > + return (ret); > +} > + > +void > +ifconfig_foreach_ifaddr(ifconfig_handle_t *h, struct ifaddrs *ifa, > + ifconfig_foreach_func_t cb, void *udata) > +{ > + struct ifaddrs *ift; > + > + for (ift = ifa; > + ift != NULL && > + ift->ifa_addr != NULL && > + strcmp(ift->ifa_name, ifa->ifa_name) == 0; > + ift = ift->ifa_next) { > + cb(h, ift, udata); > + } > +} > + > +int > ifconfig_get_description(ifconfig_handle_t *h, const char *name, > char **description) > { > @@ -179,6 +187,7 @@ ifconfig_get_description(ifconfig_handle_t *h, const c > ifr.ifr_buffer.buffer = descr; > ifr.ifr_buffer.length = descrlen; > if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { > + free(descr); > return (-1); > } > > @@ -186,6 +195,13 @@ ifconfig_get_description(ifconfig_handle_t *h, const c > if (strlen(descr) > 0) { > *description = strdup(descr); > free(descr); > + > + if (description == NULL) { > + h->error.errtype = OTHER; > + h->error.errcode = ENOMEM; > + return (-1); > + } > + > return (0); > } > } else if (ifr.ifr_buffer.length > descrlen) { > @@ -228,8 +244,7 @@ ifconfig_set_description(ifconfig_handle_t *h, const c > return (-1); > } > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, > - &ifr) != 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { > free(ifr.ifr_buffer.buffer); > return (-1); > } > @@ -248,8 +263,7 @@ ifconfig_unset_description(ifconfig_handle_t *h, const > ifr.ifr_buffer.length = 0; > ifr.ifr_buffer.buffer = NULL; > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { > return (-1); > } > return (0); > @@ -271,8 +285,7 @@ ifconfig_set_name(ifconfig_handle_t *h, const char *na > > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > ifr.ifr_data = tmpname; > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, > - &ifr) != 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { > free(tmpname); > return (-1); > } > @@ -285,61 +298,60 @@ int > ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, > char **orig_name) > { > - struct ifmibdata ifmd; > size_t len; > + unsigned int ifindex; > int name[6]; > - int i, maxifno; > > + ifindex = if_nametoindex(ifname); > + if (ifindex == 0) { > + goto fail; > + } > + > name[0] = CTL_NET; > name[1] = PF_LINK; > name[2] = NETLINK_GENERIC; > - name[3] = IFMIB_SYSTEM; > - name[4] = IFMIB_IFCOUNT; > + name[3] = IFMIB_IFDATA; > + name[4] = ifindex; > + name[5] = IFDATA_DRIVERNAME; > > - len = sizeof maxifno; > - if (sysctl(name, 5, &maxifno, &len, 0, 0) < 0) { > - h->error.errtype = OTHER; > - h->error.errcode = errno; > - return (-1); > + len = 0; > + if (sysctl(name, 6, NULL, &len, 0, 0) < 0) { > + goto fail; > } > > - name[3] = IFMIB_IFDATA; > - name[5] = IFDATA_GENERAL; > - for (i = 1; i <= maxifno; i++) { > - len = sizeof ifmd; > - name[4] = i; > - if (sysctl(name, 6, &ifmd, &len, 0, 0) < 0) { > - if (errno == ENOENT) > - continue; > + *orig_name = malloc(len); > + if (*orig_name == NULL) { > + goto fail; > + } > > - goto fail; > - } > + if (sysctl(name, 6, *orig_name, &len, 0, 0) < 0) { > + free(*orig_name); > + *orig_name = NULL; > + goto fail; > + } > > - if (strncmp(ifmd.ifmd_name, ifname, IFNAMSIZ) != 0) > - continue; > + return (0); > > - len = 0; > - name[5] = IFDATA_DRIVERNAME; > - if (sysctl(name, 6, NULL, &len, 0, 0) < 0) > - goto fail; > +fail: > + h->error.errtype = OTHER; > + h->error.errcode = (errno != 0) ? errno : ENOENT; > + return (-1); > +} > > - *orig_name = malloc(len); > - if (*orig_name == NULL) > - goto fail; > +int > +ifconfig_get_fib(ifconfig_handle_t *h, const char *name, int *fib) > +{ > + struct ifreq ifr; > > - if (sysctl(name, 6, *orig_name, &len, 0, 0) < 0) { > - free(*orig_name); > - *orig_name = NULL; > - goto fail; > - } > + memset(&ifr, 0, sizeof(ifr)); > + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > - return (0); > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFFIB, &ifr) == -1) { > + return (-1); > } > > -fail: > - h->error.errtype = OTHER; > - h->error.errcode = (i <= maxifno) ? errno : ENOENT; > - return (-1); > + *fib = ifr.ifr_fib; > + return (0); > } > > int > @@ -351,8 +363,7 @@ ifconfig_set_mtu(ifconfig_handle_t *h, const char *nam > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > ifr.ifr_mtu = mtu; > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { > return (-1); > } > > @@ -367,8 +378,7 @@ ifconfig_get_mtu(ifconfig_handle_t *h, const char *nam > memset(&ifr, 0, sizeof(ifr)); > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, > - &ifr) == -1) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { > return (-1); > } > > @@ -377,6 +387,24 @@ ifconfig_get_mtu(ifconfig_handle_t *h, const char *nam > } > > int > +ifconfig_get_nd6(ifconfig_handle_t *h, const char *name, > + struct in6_ndireq *nd) > +{ > + memset(nd, 0, sizeof(*nd)); > + strlcpy(nd->ifname, name, sizeof(nd->ifname)); > + if (ifconfig_ioctlwrap(h, AF_INET6, SIOCGIFINFO_IN6, nd) == -1) { > + return (-1); > + } > + if (isnd6defif(h, name)) { > + nd->ndi.flags |= ND6_IFF_DEFAULTIF; > + } else if (h->error.errtype != OK) { > + return (-1); > + } > + > + return (0); > +} > + > +int > ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric) > { > struct ifreq ifr; > @@ -385,8 +413,7 @@ ifconfig_set_metric(ifconfig_handle_t *h, const char * > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > ifr.ifr_metric = metric; > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { > return (-1); > } > > @@ -401,8 +428,7 @@ ifconfig_get_metric(ifconfig_handle_t *h, const char * > memset(&ifr, 0, sizeof(ifr)); > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, > - &ifr) == -1) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { > return (-1); > } > > @@ -420,8 +446,7 @@ ifconfig_set_capability(ifconfig_handle_t *h, const ch > > memset(&ifr, 0, sizeof(ifr)); > > - if (ifconfig_get_capability(h, name, > - &ifcap) != 0) { > + if (ifconfig_get_capability(h, name, &ifcap) != 0) { > return (-1); > } > > @@ -442,8 +467,7 @@ ifconfig_set_capability(ifconfig_handle_t *h, const ch > * set for this request. > */ > ifr.ifr_reqcap = flags; > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { > return (-1); > } > return (0); > @@ -458,8 +482,7 @@ ifconfig_get_capability(ifconfig_handle_t *h, const ch > memset(&ifr, 0, sizeof(ifr)); > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { > return (-1); > } > capability->curcap = ifr.ifr_curcap; > @@ -468,6 +491,45 @@ ifconfig_get_capability(ifconfig_handle_t *h, const ch > } > > int > +ifconfig_get_groups(ifconfig_handle_t *h, const char *name, > + struct ifgroupreq *ifgr) > +{ > + int len; > + > + memset(ifgr, 0, sizeof(*ifgr)); > + strlcpy(ifgr->ifgr_name, name, IFNAMSIZ); > + > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { > + if ((h->error.errcode == EINVAL) || > + (h->error.errcode == ENOTTY)) { > + return (0); > + } else { > + return (-1); > + } > + } > + > + len = ifgr->ifgr_len; > + ifgr->ifgr_groups = (struct ifg_req *)malloc(len); > + if (ifgr->ifgr_groups == NULL) { > + return (1); > + } > + bzero(ifgr->ifgr_groups, len); > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { > + return (-1); > + } > + > + return (0); > +} > + > +int > +ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, > + struct ifstat *ifs) > +{ > + strlcpy(ifs->ifs_name, name, sizeof(ifs->ifs_name)); > + return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFSTATUS, ifs)); > +} > + > +int > ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) > { > struct ifreq ifr; > @@ -475,8 +537,7 @@ ifconfig_destroy_interface(ifconfig_handle_t *h, const > memset(&ifr, 0, sizeof(ifr)); > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, > - &ifr) < 0) { > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { > return (-1); > } > return (0); > @@ -488,6 +549,7 @@ ifconfig_create_interface(ifconfig_handle_t *h, const > struct ifreq ifr; > > memset(&ifr, 0, sizeof(ifr)); > + > (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > > /* > @@ -512,5 +574,57 @@ ifconfig_create_interface(ifconfig_handle_t *h, const > } > > *ifname = strdup(ifr.ifr_name); > + if (ifname == NULL) { > + h->error.errtype = OTHER; > + h->error.errcode = ENOMEM; > + return (-1); > + } > + > + return (0); > +} > + > +int > +ifconfig_create_interface_vlan(ifconfig_handle_t *h, const char *name, > + char **ifname, const char *vlandev, const unsigned short vlantag) > +{ > + struct ifreq ifr; > + struct vlanreq params; > + > + if ((vlantag == NOTAG) || (vlandev[0] == '\0')) { > + // TODO: Add proper error tracking here > + return (-1); > + } > + > + bzero(¶ms, sizeof(params)); > + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > + params.vlr_tag = vlantag; > + (void)strlcpy(params.vlr_parent, vlandev, sizeof(params.vlr_parent)); > + ifr.ifr_data = (caddr_t)¶ms; > + > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { > + // TODO: Add proper error tracking here > + return (-1); > + } > + > + *ifname = strdup(ifr.ifr_name); > + return (0); > +} > + > +int > +ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, > + const char *vlandev, const unsigned short vlantag) > +{ > + struct ifreq ifr; > + struct vlanreq params; > + > + bzero(¶ms, sizeof(params)); > + params.vlr_tag = vlantag; > + strlcpy(params.vlr_parent, vlandev, sizeof(params.vlr_parent)); > + > + ifr.ifr_data = (caddr_t)¶ms; > + (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSETVLAN, &ifr) == -1) { > + return (-1); > + } > return (0); > } > > Modified: head/lib/libifconfig/libifconfig.h > ============================================================================== > --- head/lib/libifconfig/libifconfig.h Fri Feb 23 02:53:50 2018 (r329852) > +++ head/lib/libifconfig/libifconfig.h Fri Feb 23 03:11:43 2018 (r329853) > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2016, Marie Helene Kvello-Aune > + * Copyright (c) 2016-2017, Marie Helene Kvello-Aune > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without modification, > @@ -28,8 +28,16 @@ > > #pragma once > > +#include > +#include > + > +#define ND6_IFF_DEFAULTIF 0x8000 > + > typedef enum { > - OTHER, IOCTL, SOCKET > + OK = 0, > + OTHER, > + IOCTL, > + SOCKET > } ifconfig_errtype; > > /* > @@ -37,8 +45,16 @@ typedef enum { > * pointer to it for library use. > */ > struct ifconfig_handle; > -typedef struct ifconfig_handle ifconfig_handle_t; > +typedef struct ifconfig_handle ifconfig_handle_t; > > +struct carpreq; > +struct ifaddrs; > +struct in6_ndireq; > +struct lagg_reqall; > +struct lagg_reqflags; > +struct lagg_reqopts; > +struct lagg_reqport; > + > struct ifconfig_capabilities { > /** Current capabilities (ifconfig prints this as 'options')*/ > int curcap; > @@ -46,13 +62,44 @@ struct ifconfig_capabilities { > int reqcap; > }; > > +/** Stores extra info associated with an inet address */ > +struct ifconfig_inet_addr { > + const struct sockaddr_in *sin; > + const struct sockaddr_in *netmask; > + const struct sockaddr_in *dst; > + const struct sockaddr_in *broadcast; > + int prefixlen; > + uint8_t vhid; > +}; > + > +/** Stores extra info associated with an inet6 address */ > +struct ifconfig_inet6_addr { > + struct sockaddr_in6 *sin6; > + struct sockaddr_in6 *dstin6; > + struct in6_addrlifetime lifetime; > + int prefixlen; > + uint32_t flags; > + uint8_t vhid; > +}; > + > +/** Stores extra info associated with a lagg(4) interface */ > +struct ifconfig_lagg_status { > + struct lagg_reqall *ra; > + struct lagg_reqopts *ro; > + struct lagg_reqflags *rf; > +}; > + > /** Retrieves a new state object for use in other API calls. > * Example usage: > *{@code > * // Create state object > - * ifconfig_handle_t *lifh = ifconfig_open(); > + * ifconfig_handle_t *lifh; > + * lifh = ifconfig_open(); > + * if (lifh == NULL) { > + * // Handle error > + * } > * > - * // Do stuff with it > + * // Do stuff with the handle > * > * // Dispose of the state object > * ifconfig_close(lifh); > @@ -73,6 +120,28 @@ ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_ > /** Retrieves the errno associated with the error, if any. */ > int ifconfig_err_errno(ifconfig_handle_t *h); > > +typedef void (*ifconfig_foreach_func_t)(ifconfig_handle_t *h, > + struct ifaddrs *ifa, void *udata); > + > +/** Iterate over every network interface > + * @param h An open ifconfig state object > + * @param cb A callback function to call with a pointer to each interface > + * @param udata An opaque value that will be passed to the callback. > + * @return 0 on success, nonzero if the list could not be iterated > + */ > +int ifconfig_foreach_iface(ifconfig_handle_t *h, ifconfig_foreach_func_t cb, > + void *udata); > + > +/** Iterate over every address on a single network interface > + * @param h An open ifconfig state object > + * @param ifa A pointer that was supplied by a previous call to > + * ifconfig_foreach_iface > + * @param udata An opaque value that will be passed to the callback. > + * @param cb A callback function to call with a pointer to each ifaddr > + */ > +void ifconfig_foreach_ifaddr(ifconfig_handle_t *h, struct ifaddrs *ifa, > + ifconfig_foreach_func_t cb, void *udata); > + > /** If error type was IOCTL, this identifies which request failed. */ > unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); > int ifconfig_get_description(ifconfig_handle_t *h, const char *name, > @@ -84,8 +153,12 @@ int ifconfig_set_name(ifconfig_handle_t *h, const char > const char *newname); > int ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, > char **orig_name); > +int ifconfig_set_fib(ifconfig_handle_t *h, const char *name, int fib); > +int ifconfig_get_fib(ifconfig_handle_t *h, const char *name, int *fib); > int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); > int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); > +int ifconfig_get_nd6(ifconfig_handle_t *h, const char *name, > + struct in6_ndireq *nd); > int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, > const int metric); > int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); > @@ -94,6 +167,70 @@ int ifconfig_set_capability(ifconfig_handle_t *h, cons > int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, > struct ifconfig_capabilities *capability); > > +/** Retrieve the list of groups to which this interface belongs > + * @param h An open ifconfig state object > + * @param name The interface name > + * @param ifgr return argument. The caller is responsible for freeing > + * ifgr->ifgr_groups > + * @return 0 on success, nonzero on failure > + */ > +int ifconfig_get_groups(ifconfig_handle_t *h, const char *name, > + struct ifgroupreq *ifgr); > +int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, > + struct ifstat *stat); > + > +/** Retrieve the interface media information > + * @param h An open ifconfig state object > + * @param name The interface name > + * @param ifmr Return argument. The caller is responsible for freeing it > + * @return 0 on success, nonzero on failure > + */ > +int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, > + struct ifmediareq **ifmr); > +const char *ifconfig_media_get_type(int ifmw); > +const char *ifconfig_media_get_subtype(int ifmw); > +const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); > +void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); > + > +int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, > + struct carpreq *carpr, int ncarpr); > + > +/** Retrieve additional information about an inet address > + * @param h An open ifconfig state object > + * @param name The interface name > + * @param ifa Pointer to the the address structure of interest > + * @param addr Return argument. It will be filled with additional information > + * about the address. > + * @return 0 on success, nonzero on failure. > + */ > +int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h, > + const char *name, struct ifaddrs *ifa, struct ifconfig_inet_addr *addr); > + > +/** Retrieve additional information about an inet6 address > + * @param h An open ifconfig state object > + * @param name The interface name > + * @param ifa Pointer to the the address structure of interest > + * @param addr Return argument. It will be filled with additional information > + * about the address. > + * @return 0 on success, nonzero on failure. > + */ > +int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, > + const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr); > + > +/** Retrieve additional information about a lagg(4) interface */ > +int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h, > + const char *name, struct ifconfig_lagg_status **lagg_status); > + > +/** Retrieve additional information about a member of a lagg(4) interface */ > +int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h, > + const char *name, struct lagg_reqport *rp); > + > +/** Frees the structure returned by ifconfig_lagg_get_status. Does nothing if > + * the argument is NULL > + * @param laggstat Pointer to the structure to free > + */ > +void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat); > + > /** Destroy a virtual interface > * @param name Interface to destroy > */ > @@ -105,3 +242,15 @@ int ifconfig_destroy_interface(ifconfig_handle_t *h, c > */ > int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, > char **ifname); > + > +/** Creates a (virtual) interface > + * @param name Name of interface to create. Example: vlan0 or ix0.50 > + * @param name ifname Is set to actual name of created interface > + * @param vlandev Name of interface to attach to > + * @param vlanid VLAN ID/Tag. Must not be 0. > + */ > +int ifconfig_create_interface_vlan(ifconfig_handle_t *h, const char *name, > + char **ifname, const char *vlandev, const unsigned short vlantag); > + > +int ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, > + const char *vlandev, const unsigned short vlantag); > > Added: head/lib/libifconfig/libifconfig_carp.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libifconfig/libifconfig_carp.c Fri Feb 23 03:11:43 2018 (r329853) > @@ -0,0 +1,60 @@ > +/* > + * Copyright (c) 1983, 1993 > + * The Regents of the University of California. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. Neither the name of the University nor the names of its contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > +#include > +#include > + > +#include > +#include > + > +#include > +#include > + > +#include "libifconfig.h" > +#include "libifconfig_internal.h" > + > + > +int > +ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, > + struct carpreq *carpr, int ncarpr) > +{ > + struct ifreq ifr; > + > + bzero(carpr, sizeof(struct carpreq) * ncarpr); > + carpr[0].carpr_count = ncarpr; > + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); > + ifr.ifr_data = (caddr_t)carpr; > + > + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGVH, &ifr) != 0) { > + return (-1); > + } > + > + return (0); > +} > > Added: head/lib/libifconfig/libifconfig_inet.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libifconfig/libifconfig_inet.c Fri Feb 23 03:11:43 2018 (r329853) > @@ -0,0 +1,98 @@ > +/* > + * Copyright (c) 1983, 1993 > + * The Regents of the University of California. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. Neither the name of the University nor the names of its contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include "libifconfig.h" > +#include "libifconfig_internal.h" > + > +static const struct sockaddr_in NULL_SIN; > + > +static int > +inet_prefixlen(const struct in_addr *addr) > +{ > + int x; > + > + x = ffs(ntohl(addr->s_addr)); > + return (x == 0 ? 0 : 33 - x); > +} > + > +int > +ifconfig_inet_get_addrinfo(ifconfig_handle_t *h __unused, > + const char *name __unused, struct ifaddrs *ifa, > + struct ifconfig_inet_addr *addr) > +{ > + bzero(addr, sizeof(*addr)); > + > + /* Set the address */ > + if (ifa->ifa_addr == NULL) { > + return (-1); > + } else { > + addr->sin = (struct sockaddr_in *)ifa->ifa_addr; > + } > + > + /* Set the destination address */ > + if (ifa->ifa_flags & IFF_POINTOPOINT) { > + if (ifa->ifa_dstaddr) { > + addr->dst = (struct sockaddr_in *)ifa->ifa_dstaddr; > + } else { > + addr->dst = &NULL_SIN; > + } > + } > + > + /* Set the netmask and prefixlen */ > + if (ifa->ifa_netmask) { > + addr->netmask = (struct sockaddr_in *)ifa->ifa_netmask; > + } else { > + addr->netmask = &NULL_SIN; > + } > + addr->prefixlen = inet_prefixlen(&addr->netmask->sin_addr); > + > + /* Set the broadcast */ > + if (ifa->ifa_flags & IFF_BROADCAST) { > + addr->broadcast = (struct sockaddr_in *)ifa->ifa_broadaddr; > + } > + > + /* Set the vhid */ > + if (ifa->ifa_data) { > + addr->vhid = ((struct if_data *)ifa->ifa_data)->ifi_vhid; > + } > + > + return (0); > +} > > Added: head/lib/libifconfig/libifconfig_inet6.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libifconfig/libifconfig_inet6.c Fri Feb 23 03:11:43 2018 (r329853) > @@ -0,0 +1,105 @@ > +/* > + * Copyright (c) 1983, 1993 > + * The Regents of the University of California. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * 3. Neither the name of the University nor the names of its contributors > + * may be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Feb 23 14:49:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20709F27E6F; Fri, 23 Feb 2018 14:49:17 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D02E8397D; Fri, 23 Feb 2018 14:49:16 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1NEnEc1096158; Fri, 23 Feb 2018 06:49:14 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1NEnEf0096157; Fri, 23 Feb 2018 06:49:14 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802231449.w1NEnEf0096157@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329854 - head/stand/lua In-Reply-To: <201802230318.w1N3IOmX028961@repo.freebsd.org> To: Kyle Evans Date: Fri, 23 Feb 2018 06:49:14 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 14:49:17 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: kevans > Date: Fri Feb 23 03:18:24 2018 > New Revision: 329854 > URL: https://svnweb.freebsd.org/changeset/base/329854 > > Log: > lualoader: shallowCopyTable => deepCopyTable > > I called it a shallow copy, but it wasn't really a shallow copy at all. Isnt it really neither shallow nor deep, but just CopyTable? > Modified: > head/stand/lua/core.lua > head/stand/lua/menu.lua > > Modified: head/stand/lua/core.lua > ============================================================================== > --- head/stand/lua/core.lua Fri Feb 23 03:11:43 2018 (r329853) > +++ head/stand/lua/core.lua Fri Feb 23 03:18:24 2018 (r329854) > @@ -286,11 +286,11 @@ function core.isSystem386() > end > > -- This may be a better candidate for a 'utility' module. > -function core.shallowCopyTable(tbl) > +function core.deepCopyTable(tbl) > local new_tbl = {} > for k, v in pairs(tbl) do > if type(v) == "table" then > - new_tbl[k] = core.shallowCopyTable(v) > + new_tbl[k] = core.deepCopyTable(v) > else > new_tbl[k] = v > end > > Modified: head/stand/lua/menu.lua > ============================================================================== > --- head/stand/lua/menu.lua Fri Feb 23 03:11:43 2018 (r329853) > +++ head/stand/lua/menu.lua Fri Feb 23 03:18:24 2018 (r329854) > @@ -222,7 +222,7 @@ menu.welcome = { > return menu.welcome.swapped_menu > end > -- Shallow copy the table > - menu_entries = core.shallowCopyTable(menu_entries) > + menu_entries = core.deepCopyTable(menu_entries) > > -- Swap the first two menu entries > menu_entries[1], menu_entries[2] = > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Feb 23 15:37:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21DD6F006DB; Fri, 23 Feb 2018 15:37:32 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7898B86ABC; Fri, 23 Feb 2018 15:37:31 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x236.google.com with SMTP id t79so12936227lfe.3; Fri, 23 Feb 2018 07:37:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4iZb77Gae7fjjbsU3RgBIpmefCLNMMUqgrJNWyZCcFo=; b=eOVCuW4BMlLgel64uyWrE380oxmNrncdna954c5ruZqWNAfFC3rX75Y9au8foOhw0f vTMoiTGZqxGKyd9Ndr+DwEmkWcBEcwpVE1DsJejj1cmREovSjVj2NKmO36MlYiVzOG8i +n7M2okkVn2CKpHYLl4Vc8185seZolot91NhS+Umae2l+181osZgG6nK9KyOBNHuNNM9 okCEaZk7CbZFHsTiThWan8WjfPNOZIg6Iz2wdKMZIYAu44p8vrKXQOKDkUrhImLnoZo4 DAI6ucNyHpccaOwQyomuY8ds8e2F433big2q2xfOo+tdDpJPDhxNkRpcNQfTWByKI58C y6MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=4iZb77Gae7fjjbsU3RgBIpmefCLNMMUqgrJNWyZCcFo=; b=keTYKGuiEmzDFi2bwW+HQR4S12f7dSX7QibEluXRebT0v348IsB0nNelJxly4Fz31p gK8SRxb6XEh56pPrIqSqyBI9yL9GEnfHSTQSgMdZfQJapCoqqyET4KZwp1XWXs82g++i xC1oyP/3q65P1xwr2Zc5YJyT7DyUpRlbLxZQmpZkUgVS/Lib1TQYgdChY4GorMkk23uJ 2SOlEWOH6s8OId+bWXrSKIFlE1m9VR9UHQou4DD6VvVadYHlHOisxiQ096lsrJv6Kj47 oS1LGZHXqO/pHceFmfYeK6VEhqz3lEIRCtPME6N16GsvTXNDlkXB3VgNElDpqu1BI9wj ihNQ== X-Gm-Message-State: APf1xPCl/QeiDZgrPNx1Yzn4Hc9P+h3c8u37IDZYZbNJg//dfu14wviE b50N9XY94cBSUhYgGHbrvaJOdyp3t/B4p5wv2VxvWnHp X-Google-Smtp-Source: AG47ELv7pj1j9hLdqUSQ42a29t5cYPgMyq+D5dXQ/I6ZP7KVX0890DLruietPGOW+w0OO6ccb2L3iS/oS+FpgVEf0AI= X-Received: by 10.25.147.219 with SMTP id w88mr1700150lfk.58.1519400249764; Fri, 23 Feb 2018 07:37:29 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Fri, 23 Feb 2018 07:37:29 -0800 (PST) In-Reply-To: <201802231447.w1NEl58N096144@pdx.rh.CN85.dnsmgr.net> References: <201802230311.w1N3BhiJ023939@repo.freebsd.org> <201802231447.w1NEl58N096144@pdx.rh.CN85.dnsmgr.net> From: Alan Somers Date: Fri, 23 Feb 2018 08:37:29 -0700 X-Google-Sender-Auth: CQpQd3CB38MuHTi47He6J4w9-wY Message-ID: Subject: Re: svn commit: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug To: rgrimes@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 15:37:32 -0000 On Fri, Feb 23, 2018 at 7:47 AM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > Author: asomers > > Date: Fri Feb 23 03:11:43 2018 > > New Revision: 329853 > > URL: https://svnweb.freebsd.org/changeset/base/329853 > > > > Log: > > libifconfig: multiple feature additions > > > > Added the ability to: > > > > * Create virtual interfaces > > * Create vlan interfaces > > * Get interface fib > > * Get interface groups > > * Get interface status > > * Get nd6 info > > * Get media status > > * Get additional ifaddr info in a convenient struct > > * Get vhids > > * Get carp info > > * Get lagg and laggport status > > * Iterate over all interfaces and ifaddrs > > Love that list!!! > > > > And add more examples, too. > > Remove MIT 1996 Copyright? > Under what conditions is it that this is being done? > The file's original author removed the extra license block. It probably shouldn't have been there to begin with. https://github.com/Savagedlight/libifconfig/commit/92fa671bd2451c11c9f1abf68b56295a05af2c85#diff-d2b1298dd60d9c72a5776c8d57a7fe78 > > Note that this is a backwards-incompatible change. But that's ok, > because it's > > a private library. > > > > MFC after: 3 weeks > > Sponsored by: Spectra Logic Corp > > Differential Revision: https://reviews.freebsd.org/D14463 > > With 0 feed back? And a ~30 hour life time? It is not a diffential if > no one looks at, comments on, or accepts the revision. > > Actually, it's been under review for nearly nine months, but on Github, not Phabricator. You see, the original author lacks a commit bit, and has developed this library out-of-tree. It's time we brought it back in, though. I know the Phabricator review didn't last very long, but I have a time limitation on my end. Feel free to tear it apart in post-commit review, if you like. https://github.com/Savagedlight/libifconfig/pull/46 -Alan From owner-svn-src-all@freebsd.org Fri Feb 23 15:49:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40E71F0150F; Fri, 23 Feb 2018 15:49:38 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1F4D871B7; Fri, 23 Feb 2018 15:49:37 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f54.google.com with SMTP id y19so12996710lfd.4; Fri, 23 Feb 2018 07:49:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KOI4SIKrj3TszGurybjK79UuaBF+RhlYLdc5GkA9dKs=; b=D6TTiomBguziG/CXUmm3oYCH5eXg1TEKN+5bpED4CpRqvR/kfxBm+Be3Fq4aQEwepi Ff/xroM19wfrInVpv+ZEhy7zbGsgvSeg11Iq1uX9530SV50cduheMmvO5jHiGhu79sFW aTq05MoKNc4YT6im1we6myuLPG6cyq5m70zvIs2eHeh/6niJcDSNACyguewqPAZm6Fmj 5QLrtO/HVLK2K5Lml1pQtWu/8DhRuUqzb2arRUMq8cHI1GocGR5P8fU3tvppuZ/KWhCq 5meHuIN7e56wfg+3oUS3Y916ILSSSEqOPhXG6T2tKLzG1QxywNG8dPzE/MPqtRZYonsJ wDsA== X-Gm-Message-State: APf1xPA+Dj+ezjFrFpqUCk5pXLp1xJ06FaCgYmpaKHCKkCt+OFK0MpV0 CVHfhIsU1k5JhfUJgM+7DXPiMGFE X-Google-Smtp-Source: AG47ELvgYHv6YOzX10K4y8Kpp+IIknyifu2qsE7VuOvIi0dFvWJ6WcR9STvFVgYGn6QaLaoBpcd8+w== X-Received: by 10.25.35.132 with SMTP id j126mr1644000lfj.130.1519400970093; Fri, 23 Feb 2018 07:49:30 -0800 (PST) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com. [209.85.215.54]) by smtp.gmail.com with ESMTPSA id p190sm531276lfp.3.2018.02.23.07.49.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 07:49:30 -0800 (PST) Received: by mail-lf0-f54.google.com with SMTP id 37so12973731lfs.7; Fri, 23 Feb 2018 07:49:29 -0800 (PST) X-Received: by 10.25.201.76 with SMTP id z73mr1693002lff.74.1519400969792; Fri, 23 Feb 2018 07:49:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.54.1 with HTTP; Fri, 23 Feb 2018 07:49:09 -0800 (PST) In-Reply-To: <201802231449.w1NEnEf0096157@pdx.rh.CN85.dnsmgr.net> References: <201802230318.w1N3IOmX028961@repo.freebsd.org> <201802231449.w1NEnEf0096157@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Fri, 23 Feb 2018 09:49:09 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329854 - head/stand/lua To: "Rodney W. Grimes" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 15:49:38 -0000 On Fri, Feb 23, 2018 at 8:49 AM, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> Author: kevans >> Date: Fri Feb 23 03:18:24 2018 >> New Revision: 329854 >> URL: https://svnweb.freebsd.org/changeset/base/329854 >> >> Log: >> lualoader: shallowCopyTable => deepCopyTable >> >> I called it a shallow copy, but it wasn't really a shallow copy at all. > > Isnt it really neither shallow nor deep, but just CopyTable? > I would think (and expect) that CopyTable wouldn't recursively copy any table values in the table as this version does, opting to eliminate that entirely and just copying all values as-is. >> Modified: >> head/stand/lua/core.lua >> head/stand/lua/menu.lua >> >> Modified: head/stand/lua/core.lua >> ============================================================================== >> --- head/stand/lua/core.lua Fri Feb 23 03:11:43 2018 (r329853) >> +++ head/stand/lua/core.lua Fri Feb 23 03:18:24 2018 (r329854) >> @@ -286,11 +286,11 @@ function core.isSystem386() >> end >> >> -- This may be a better candidate for a 'utility' module. >> -function core.shallowCopyTable(tbl) >> +function core.deepCopyTable(tbl) >> local new_tbl = {} >> for k, v in pairs(tbl) do >> if type(v) == "table" then >> - new_tbl[k] = core.shallowCopyTable(v) >> + new_tbl[k] = core.deepCopyTable(v) >> else >> new_tbl[k] = v >> end >> >> Modified: head/stand/lua/menu.lua >> ============================================================================== >> --- head/stand/lua/menu.lua Fri Feb 23 03:11:43 2018 (r329853) >> +++ head/stand/lua/menu.lua Fri Feb 23 03:18:24 2018 (r329854) >> @@ -222,7 +222,7 @@ menu.welcome = { >> return menu.welcome.swapped_menu >> end >> -- Shallow copy the table >> - menu_entries = core.shallowCopyTable(menu_entries) >> + menu_entries = core.deepCopyTable(menu_entries) >> >> -- Swap the first two menu entries >> menu_entries[1], menu_entries[2] = >> >> > > -- > Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Feb 23 16:04:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCCA2F02600; Fri, 23 Feb 2018 16:04:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BF9C87DE9; Fri, 23 Feb 2018 16:04:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71C2418B19; Fri, 23 Feb 2018 16:04:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NG4iR1013788; Fri, 23 Feb 2018 16:04:44 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NG4iHL013787; Fri, 23 Feb 2018 16:04:44 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802231604.w1NG4iHL013787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 16:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r329865 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 329865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:04:45 -0000 Author: asomers Date: Fri Feb 23 16:04:44 2018 New Revision: 329865 URL: https://svnweb.freebsd.org/changeset/base/329865 Log: Add myself to sizelimits, for the ZFS test suite import Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Fri Feb 23 11:20:59 2018 (r329864) +++ svnadmin/conf/sizelimit.conf Fri Feb 23 16:04:44 2018 (r329865) @@ -15,6 +15,7 @@ # First field is username, second field is the raised limit required. achim +asomers bapt davidcs dim From owner-svn-src-all@freebsd.org Fri Feb 23 16:06:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A21BBF0288A; Fri, 23 Feb 2018 16:06:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5722187F87; Fri, 23 Feb 2018 16:06:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BEE718B1A; Fri, 23 Feb 2018 16:06:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NG6t3d013920; Fri, 23 Feb 2018 16:06:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NG6t45013919; Fri, 23 Feb 2018 16:06:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802231606.w1NG6t45013919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 16:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329866 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 329866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:06:55 -0000 Author: imp Date: Fri Feb 23 16:06:54 2018 New Revision: 329866 URL: https://svnweb.freebsd.org/changeset/base/329866 Log: Use bool instead of int for predicate functions relating to work available. Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Fri Feb 23 16:04:44 2018 (r329865) +++ head/sys/cam/cam_iosched.c Fri Feb 23 16:06:54 2018 (r329866) @@ -718,22 +718,22 @@ cam_iosched_io_metric_update(struct cam_iosched_softc sbintime_t sim_latency, int cmd, size_t size); #endif -static inline int +static inline bool cam_iosched_has_flagged_work(struct cam_iosched_softc *isc) { return !!(isc->flags & CAM_IOSCHED_FLAG_WORK_FLAGS); } -static inline int +static inline bool cam_iosched_has_io(struct cam_iosched_softc *isc) { #ifdef CAM_IOSCHED_DYNAMIC if (do_dynamic_iosched) { struct bio *rbp = bioq_first(&isc->bio_queue); struct bio *wbp = bioq_first(&isc->write_queue); - int can_write = wbp != NULL && + bool can_write = wbp != NULL && cam_iosched_limiter_caniop(&isc->write_stats, wbp) == 0; - int can_read = rbp != NULL && + bool can_read = rbp != NULL && cam_iosched_limiter_caniop(&isc->read_stats, rbp) == 0; if (iosched_debug > 2) { printf("can write %d: pending_writes %d max_writes %d\n", can_write, isc->write_stats.pending, isc->write_stats.max); @@ -746,7 +746,7 @@ cam_iosched_has_io(struct cam_iosched_softc *isc) return bioq_first(&isc->bio_queue) != NULL; } -static inline int +static inline bool cam_iosched_has_more_trim(struct cam_iosched_softc *isc) { return !(isc->flags & CAM_IOSCHED_FLAG_TRIM_ACTIVE) && @@ -757,7 +757,7 @@ cam_iosched_has_more_trim(struct cam_iosched_softc *is (isc)->sort_io_queue : cam_sort_io_queues) -static inline int +static inline bool cam_iosched_has_work(struct cam_iosched_softc *isc) { #ifdef CAM_IOSCHED_DYNAMIC From owner-svn-src-all@freebsd.org Fri Feb 23 16:24:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3B44F03FC0; Fri, 23 Feb 2018 16:24:21 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 582F468DBB; Fri, 23 Feb 2018 16:24:20 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1NGOHnH096529; Fri, 23 Feb 2018 08:24:17 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1NGOHEd096528; Fri, 23 Feb 2018 08:24:17 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802231624.w1NGOHEd096528@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329853 - in head: lib/libifconfig share/examples/libifconfig usr.sbin/wlandebug In-Reply-To: To: Alan Somers Date: Fri, 23 Feb 2018 08:24:17 -0800 (PST) CC: rgrimes@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:24:22 -0000 > On Fri, Feb 23, 2018 at 7:47 AM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > > Author: asomers > > > Date: Fri Feb 23 03:11:43 2018 > > > New Revision: 329853 > > > URL: https://svnweb.freebsd.org/changeset/base/329853 > > > > > > Log: > > > libifconfig: multiple feature additions > > > > > > Added the ability to: > > > > > > * Create virtual interfaces > > > * Create vlan interfaces > > > * Get interface fib > > > * Get interface groups > > > * Get interface status > > > * Get nd6 info > > > * Get media status > > > * Get additional ifaddr info in a convenient struct > > > * Get vhids > > > * Get carp info > > > * Get lagg and laggport status > > > * Iterate over all interfaces and ifaddrs > > > > Love that list!!! > > > > > > And add more examples, too. > > > > Remove MIT 1996 Copyright? > > Under what conditions is it that this is being done? > > > > The file's original author removed the extra license block. It probably > shouldn't have been there to begin with. > https://github.com/Savagedlight/libifconfig/commit/92fa671bd2451c11c9f1abf68b56295a05af2c85#diff-d2b1298dd60d9c72a5776c8d57a7fe78 A good commit message summarize ALL changes, sighting the fact that the MIT copyright was being removed, and with the pointer to this external source (probalby should of been listed in an obtained from: line both here in the commit log and in the differential.) > > > Note that this is a backwards-incompatible change. But that's ok, > > because it's > > > a private library. > > > > > > MFC after: 3 weeks > > > Sponsored by: Spectra Logic Corp > > > Differential Revision: https://reviews.freebsd.org/D14463 > > > > With 0 feed back? And a ~30 hour life time? It is not a diffential if > > no one looks at, comments on, or accepts the revision. > > > > > Actually, it's been under review for nearly nine months, but on Github, not > Phabricator. You see, the original author lacks a commit bit, and has > developed this library out-of-tree. It's time we brought it back in, > though. I know the Phabricator review didn't last very long, but I have a > time limitation on my end. Feel free to tear it apart in post-commit > review, if you like. > > https://github.com/Savagedlight/libifconfig/pull/46 You failed to sight this external developer as well, that should always be done in a commit message! A quick easy fix would be simply add some comments to the differential that sight both the 2 external links above, and please appologize to Savageedlight for failing to attribe them in this commit message. The commit references the differential, so that would lead someone down the right road in the future. Thanks, -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Feb 23 16:31:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 212C2F04723; Fri, 23 Feb 2018 16:31:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C564C69154; Fri, 23 Feb 2018 16:31:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFAC318F6A; Fri, 23 Feb 2018 16:31:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NGV2hn026872; Fri, 23 Feb 2018 16:31:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NGV17b026852; Fri, 23 Feb 2018 16:31:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802231631.w1NGV17b026852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 16:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329867 - in head: etc/mtree share/mk tests/sys tests/sys/cddl tests/sys/cddl/zfs tests/sys/cddl/zfs/bin tests/sys/cddl/zfs/include tests/sys/cddl/zfs/tests tests/sys/cddl/zfs/tests/acl... X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree share/mk tests/sys tests/sys/cddl tests/sys/cddl/zfs tests/sys/cddl/zfs/bin tests/sys/cddl/zfs/include tests/sys/cddl/zfs/tests tests/sys/cddl/zfs/tests/acl tests/sys/cddl/zfs/tests... X-SVN-Commit-Revision: 329867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:31:04 -0000 Author: asomers Date: Fri Feb 23 16:31:00 2018 New Revision: 329867 URL: https://svnweb.freebsd.org/changeset/base/329867 Log: Add the ZFS test suite It was originally written by Sun as part of the STF (Solaris test framework). They open sourced it in OpenSolaris, then HighCloud partially ported it to FreeBSD, and Spectra Logic finished the port. We also added many testcases, fixed many broken ones, and converted them all to the ATF framework. We've had help along the way from avg, araujo, smh, and brd. By default most of the tests are disabled. Set the disks Kyua variable to enable them. Submitted by: asomers, will, justing, ken, brd, avg, araujo, smh Sponsored by: Spectra Logic Corp, HighCloud Added: head/tests/sys/cddl/ head/tests/sys/cddl/Makefile (contents, props changed) head/tests/sys/cddl/zfs/ head/tests/sys/cddl/zfs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/bin/ head/tests/sys/cddl/zfs/bin/Makefile (contents, props changed) head/tests/sys/cddl/zfs/bin/bsddisks.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/chg_usr_exec.c (contents, props changed) head/tests/sys/cddl/zfs/bin/devname2devid.c (contents, props changed) head/tests/sys/cddl/zfs/bin/dir_rd_update.c (contents, props changed) head/tests/sys/cddl/zfs/bin/dircmp.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/dumpadm.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/ff.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/file_check.c (contents, props changed) head/tests/sys/cddl/zfs/bin/file_common.h (contents, props changed) head/tests/sys/cddl/zfs/bin/file_trunc.c (contents, props changed) head/tests/sys/cddl/zfs/bin/file_write.c (contents, props changed) head/tests/sys/cddl/zfs/bin/fmadm.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/fmdump.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/format.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/groupadd.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/groupdel.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/groupmod.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/groupshow.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/largest_file.c (contents, props changed) head/tests/sys/cddl/zfs/bin/mkfile.c (contents, props changed) head/tests/sys/cddl/zfs/bin/mktree.c (contents, props changed) head/tests/sys/cddl/zfs/bin/mmapwrite.c (contents, props changed) head/tests/sys/cddl/zfs/bin/randfree_file.c (contents, props changed) head/tests/sys/cddl/zfs/bin/readmmap.c (contents, props changed) head/tests/sys/cddl/zfs/bin/rename_dir.c (contents, props changed) head/tests/sys/cddl/zfs/bin/rm_lnkcnt_zero_file.c (contents, props changed) head/tests/sys/cddl/zfs/bin/svcs.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/swap.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/testenv.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/useradd.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/userdel.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/usermod.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zfs.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zfs_crypto.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zfs_version.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zlogin.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zoneadm.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zonecfg.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zpool.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zpool_bsd.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zpool_smi.ksh (contents, props changed) head/tests/sys/cddl/zfs/bin/zpool_version.ksh (contents, props changed) head/tests/sys/cddl/zfs/include/ head/tests/sys/cddl/zfs/include/Makefile (contents, props changed) head/tests/sys/cddl/zfs/include/commands.txt (contents, props changed) head/tests/sys/cddl/zfs/include/constants.cfg (contents, props changed) head/tests/sys/cddl/zfs/include/default.cfg.in (contents, props changed) head/tests/sys/cddl/zfs/include/libgnop.kshlib (contents, props changed) head/tests/sys/cddl/zfs/include/libremote.kshlib (contents, props changed) head/tests/sys/cddl/zfs/include/libtest.kshlib (contents, props changed) head/tests/sys/cddl/zfs/include/libtest_test.sh (contents, props changed) head/tests/sys/cddl/zfs/include/logapi.kshlib (contents, props changed) head/tests/sys/cddl/zfs/include/stf.shlib (contents, props changed) head/tests/sys/cddl/zfs/include/testenv.ksh (contents, props changed) head/tests/sys/cddl/zfs/include/testenv.kshlib (contents, props changed) head/tests/sys/cddl/zfs/include/translatecommands.awk (contents, props changed) head/tests/sys/cddl/zfs/tests/ head/tests/sys/cddl/zfs/tests/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/ head/tests/sys/cddl/zfs/tests/acl/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/acl.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/acl_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/ head/tests/sys/cddl/zfs/tests/acl/cifs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/cifs.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/cifs_attr_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/cifs_attr_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/cifs_attr_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/ head/tests/sys/cddl/zfs/tests/acl/nontrivial/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_aclmode_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_compact_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_delete_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_inherit_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_inherit_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_inherit_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_inherit_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_owner_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_rwacl_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_rwx_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_rwx_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_rwx_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_rwx_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_xattr_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_chmod_xattr_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_cp_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_cp_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_cpio_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_cpio_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_find_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_ls_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_mv_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_tar_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/nontrivial/zfs_acl_tar_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/ head/tests/sys/cddl/zfs/tests/acl/trivial/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_chmod_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_compress_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_cp_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_cp_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_cp_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_find_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_find_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_ls_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_ls_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_mv_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pack_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_pax_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_tar_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/acl/trivial/zfs_acl_tar_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/ head/tests/sys/cddl/zfs/tests/atime/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/atime.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/atime_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/atime_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/atime_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/atime_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/atime/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/ head/tests/sys/cddl/zfs/tests/bootfs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/ head/tests/sys/cddl/zfs/tests/cache/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cache_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cache/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/ head/tests/sys/cddl/zfs/tests/cachefile/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/ head/tests/sys/cddl/zfs/tests/clean_mirror/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/clean_mirror_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/default.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/clean_mirror/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/ head/tests/sys/cddl/zfs/tests/cli_root/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/cli.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/cli_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/ head/tests/sys/cddl/zfs/tests/cli_root/zdb/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/ head/tests/sys/cddl/zfs/tests/cli_root/zfs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_malformed.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/properties.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_destroy/zfs_destroy_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.golden (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_list_d.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_get/zfs_get_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_inherit/zfs_inherit_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_011_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_all_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_mount/zfs_mount_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_promote/zfs_promote_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_property.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_property_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_property/zfs_set_property_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_receive/zfs_receive_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_012_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rename/zfs_rename_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_reservation/zfs_reservation_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_rollback/zfs_rollback_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_send/zfs_send_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/cache_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/cache_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/canmount_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/canmount_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/canmount_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/canmount_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/checksum_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/compression_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/mountpoint_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/mountpoint_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/mountpoint_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/onoffs_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/property_alias_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/readonly_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/reservation_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/share_mount_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/snapdir_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/user_property_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/user_property_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/user_property_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/user_property_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/version_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_share/zfs_share_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_snapshot/zfs_snapshot_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unmount/zfs_unmount_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_unshare/zfs_unshare_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/ head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zfs_upgrade/zfs_upgrade_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/ head/tests/sys/cddl/zfs/tests/cli_root/zpool/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool/zpool_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_add/zpool_add_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_attach/zpool_attach_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_017_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_018_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_019_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_020_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_021_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_022_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_023_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_destroy/zpool_destroy_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_detach/zpool_detach_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_expand/zpool_expand_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_export/zpool_export_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_history/zpool_history_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/README (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/blockfiles/unclean_export.dat.bz2 (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_011_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_013_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_014_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_all_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_corrupt_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_destroyed_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_destroyed_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_rename_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_offline/zpool_offline_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_online/zpool_online_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_remove/zpool_remove_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_replace/zpool_replace_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_scrub/zpool_scrub_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/zpool_set_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/zpool_set_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/zpool_set_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_set/zpool_set_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_status/zpool_status_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/ head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/README (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-broken-mirror1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-broken-mirror2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v10.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v11.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v12.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v13.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v14.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v15.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v28.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz21.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz22.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz23.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe1.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe2.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe3.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v4.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v5.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v5000.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v6.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v7.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v8.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v9.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-v999.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/blockfiles/zfs-pool-vBROKEN.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/create_upgrade_pool_dat.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_root/zpool_upgrade/zpool_upgrade_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/ head/tests/sys/cddl/zfs/tests/cli_user/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/cli.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/cli_user.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/ head/tests/sys/cddl/zfs/tests/cli_user/misc/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/misc.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/misc_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/setup_basic.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zdb_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_allow_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_clone_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_create_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_destroy_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_get_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_inherit_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_mount_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_promote_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_receive_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_rename_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_rollback_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_send_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_set_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_share_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_snapshot_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_unallow_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_unmount_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_unshare_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zfs_upgrade_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_add_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_add_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_attach_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_clear_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_create_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_create_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_destroy_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_detach_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_export_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_get_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_history_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_import_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_import_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_offline_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_online_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_remove_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_replace_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_scrub_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_set_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_status_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/misc/zpool_upgrade_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/ head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zfs_list/zfs_list_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/ head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_iostat/zpool_iostat_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/ head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/cli_user/zpool_list/zpool_list_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/ head/tests/sys/cddl/zfs/tests/compression/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/compress.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/compress_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/compress_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/compress_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/compression_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/compression/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/ head/tests/sys/cddl/zfs/tests/ctime/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/ctime.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/ctime_001_pos.c (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/ctime_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/ctime/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/ head/tests/sys/cddl/zfs/tests/delegate/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/delegate.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/delegate_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_011_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_012_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_allow_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/delegate/zfs_unallow_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/ head/tests/sys/cddl/zfs/tests/devices/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/devices_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/devices/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/ head/tests/sys/cddl/zfs/tests/exec/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/exec_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/exec_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/exec_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/mmap_exec.c (contents, props changed) head/tests/sys/cddl/zfs/tests/exec/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/ head/tests/sys/cddl/zfs/tests/grow_pool/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/grow_pool_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_pool/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/ head/tests/sys/cddl/zfs/tests/grow_replicas/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/grow_replicas_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/grow_replicas/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/ head/tests/sys/cddl/zfs/tests/history/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/history/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/history/history_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/i386.migratedpool.DAT.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/history/i386.orig_history.txt (contents, props changed) head/tests/sys/cddl/zfs/tests/history/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/history/sparc.migratedpool.DAT.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/history/sparc.orig_history.txt (contents, props changed) head/tests/sys/cddl/zfs/tests/history/zfs-pool-v4.dat.Z (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/ head/tests/sys/cddl/zfs/tests/hotplug/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotplug/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/ head/tests/sys/cddl/zfs/tests/hotspare/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_add_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_add_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_add_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_add_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_clone_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_clone_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_create_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_detach_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_detach_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_detach_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_detach_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_detach_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_export_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_import_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_onoffline_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_onoffline_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_remove_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_remove_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_remove_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_remove_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_replace_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_replace_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_scrub_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_scrub_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_shared_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_snapshot_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_snapshot_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/hotspare/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/ head/tests/sys/cddl/zfs/tests/inheritance/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/README.config (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/README.state (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config001.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config002.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config003.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config004.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config005.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config006.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config007.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config008.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config009.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config010.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config011.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config012.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config013.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config014.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config015.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config016.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config017.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config018.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config019.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config020.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config021.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config022.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config023.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/config024.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/inherit.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/inherit.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/inherit_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/inheritance_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state001.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state002.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state003.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state004.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state005.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state006.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state007.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state008.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state009.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state010.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state011.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state012.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state013.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state014.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state015.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state016.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state017.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state018.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state019.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state020.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state021.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state022.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state023.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inheritance/state024.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/ head/tests/sys/cddl/zfs/tests/interop/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/interop.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/interop_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/interop_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/interop/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/ head/tests/sys/cddl/zfs/tests/inuse/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/inuse.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/inuse_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/inuse_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/inuse_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/inuse/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/ head/tests/sys/cddl/zfs/tests/iscsi/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/iscsi_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/iscsi/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/ head/tests/sys/cddl/zfs/tests/large_files/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/large_files.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/large_files_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/large_files_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/large_files/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/largest_pool/ head/tests/sys/cddl/zfs/tests/largest_pool/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/largest_pool/largest_pool_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/ head/tests/sys/cddl/zfs/tests/link_count/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/link_count.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/link_count_001.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/link_count_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/link_count/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/ head/tests/sys/cddl/zfs/tests/migration/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/migration_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/migration/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/ head/tests/sys/cddl/zfs/tests/mmap/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/mmap.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/mmap_read_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/mmap_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/mmap_write_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mmap/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/ head/tests/sys/cddl/zfs/tests/mount/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/mount_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/mounttest.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mount/vars.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/ head/tests/sys/cddl/zfs/tests/mv_files/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/mv_files.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/mv_files_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/mv_files_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/mv_files_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/mv_files_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/mv_files/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/ head/tests/sys/cddl/zfs/tests/nestedfs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/nestedfs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/nestedfs/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/ head/tests/sys/cddl/zfs/tests/no_space/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/enospc.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/enospc_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/no_space_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/no_space/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/ head/tests/sys/cddl/zfs/tests/online_offline/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/online_offline.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/online_offline_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/online_offline_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/online_offline/online_offline_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/pool_names/ head/tests/sys/cddl/zfs/tests/pool_names/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/pool_names/pool_names.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/pool_names/pool_names_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/pool_names/pool_names_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/pool_names/pool_names_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/ head/tests/sys/cddl/zfs/tests/poolversion/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/poolversion_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/poolversion_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/poolversion_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/poolversion/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/ head/tests/sys/cddl/zfs/tests/quota/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/quota_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/quota/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/ head/tests/sys/cddl/zfs/tests/redundancy/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy_004_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/redundancy_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/redundancy/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/ head/tests/sys/cddl/zfs/tests/refquota/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_006_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/refquota_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/refquota/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/ head/tests/sys/cddl/zfs/tests/refreserv/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/refreserv_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/refreserv/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/ head/tests/sys/cddl/zfs/tests/rename_dirs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/rename_dirs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/rename_dirs/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/ head/tests/sys/cddl/zfs/tests/replacement/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/replacement.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/replacement_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/replacement_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/replacement_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/replacement/replacement_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/ head/tests/sys/cddl/zfs/tests/reservation/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_014_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_015_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_016_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_017_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_018_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/reservation_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/reservation/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/ head/tests/sys/cddl/zfs/tests/rootpool/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/rootpool_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/rootpool_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/rootpool_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/rootpool_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/rootpool/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/ head/tests/sys/cddl/zfs/tests/rsend/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/rsend_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/rsend/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/ head/tests/sys/cddl/zfs/tests/scrub_mirror/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/default.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/scrub_mirror_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/scrub_mirror/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/ head/tests/sys/cddl/zfs/tests/slog/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_011_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_012_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_014_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/slog/slog_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/ head/tests/sys/cddl/zfs/tests/snapshot/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/clone_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/ctldir_acl.txt (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/rollback_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/rollback_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/rollback_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_014_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_015_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_016_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_017_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_018_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_020_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/ head/tests/sys/cddl/zfs/tests/snapused/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/snapused/snapused_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/ head/tests/sys/cddl/zfs/tests/sparse/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/sparse.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/sparse_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/sparse/sparse_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/ head/tests/sys/cddl/zfs/tests/threadsappend/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend.c (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/threadsappend/threadsappend_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/ head/tests/sys/cddl/zfs/tests/truncate/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/truncate.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/truncate_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/truncate_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/truncate/truncate_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/ head/tests/sys/cddl/zfs/tests/txg_integrity/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/fsync_integrity.c (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/fsync_integrity_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/make_patterns.py (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.c (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity.d (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/txg_integrity/txg_integrity_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/ head/tests/sys/cddl/zfs/tests/userquota/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/groupspace_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/groupspace_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_010_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_012_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userquota_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userspace_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/userquota/userspace_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/ head/tests/sys/cddl/zfs/tests/utils_test/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/utils_test/utils_test_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/ head/tests/sys/cddl/zfs/tests/write_dirs/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/write_dirs/write_dirs_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/ head/tests/sys/cddl/zfs/tests/xattr/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_002_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_007_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_009_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_010_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_011_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_012_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_013_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/xattr/xattr_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/ head/tests/sys/cddl/zfs/tests/zfsd/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/hotspare_cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/hotspare_setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_degrade_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_degrade_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_008_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_import_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/ head/tests/sys/cddl/zfs/tests/zil/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/zil.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/zil.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/zil_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/zil_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zil/zil_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/ head/tests/sys/cddl/zfs/tests/zinject/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zinject/zinject_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/ head/tests/sys/cddl/zfs/tests/zones/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/zones/zones_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/ head/tests/sys/cddl/zfs/tests/zvol/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/ head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_ENOSPC/zvol_ENOSPC_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/ head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_cli/zvol_cli_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_common.kshlib (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/ head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_001_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_003_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_005_neg.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_007_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_008_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_009_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_misc/zvol_misc_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/ head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_002_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_003_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_004_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_005_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_006_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol/zvol_swap/zvol_swap_test.sh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/ head/tests/sys/cddl/zfs/tests/zvol_thrash/Makefile (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh (contents, props changed) head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/share/mk/atf.test.mk head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Fri Feb 23 16:06:54 2018 (r329866) +++ head/etc/mtree/BSD.tests.dist Fri Feb 23 16:31:00 2018 (r329867) @@ -428,6 +428,252 @@ .. aio .. + cddl + zfs + bin + .. + include + .. + tests + acl + cifs + .. + nontrivial + .. + trivial + .. + .. + atime + .. + bootfs + .. + cache + .. + cachefile + .. + clean_mirror + .. + cli_root + zfs_upgrade + .. + zfs_promote + .. + zfs_clone + .. + zfs_property + .. + zfs_destroy + .. + zpool_create + .. + zpool_history + .. + zpool_expand + .. + zpool_remove + .. + zfs_mount + .. + zfs_unshare + .. + zdb + .. + zpool_online + .. + zpool_get + .. + zpool_export + .. + zfs_copies + .. + zfs_get + .. + zfs + .. + zpool_clear + .. + zpool_import + blockfiles + .. + .. + zpool + .. + zpool_offline + .. + zpool_replace + .. + zfs_rollback + .. + zpool_set + .. + zfs_send + .. + zfs_set + .. + zpool_detach + .. + zfs_diff + .. + zpool_scrub + .. + zfs_inherit + .. + zfs_snapshot + .. + zfs_share + .. + zpool_destroy + .. + zpool_status + .. + zfs_unmount + .. + zfs_receive + .. + zfs_create + .. + zpool_upgrade + blockfiles + .. + .. + zpool_add + .. + zfs_rename + .. + zpool_attach + .. + zfs_reservation + .. + .. + cli_user + misc + .. + zfs_list + .. + zpool_iostat + .. + zpool_list + .. + .. + compression + .. + ctime + .. + delegate + .. + devices + .. + exec + .. + grow_pool + .. + grow_replicas + .. + history + .. + hotplug + .. + hotspare + .. + inheritance + .. + interop + .. + inuse + .. + iscsi + .. + large_files + .. + largest_pool + .. + link_count + .. + migration + .. + mmap + .. + mount + .. + mv_files + .. + nestedfs + .. + no_space + .. + online_offline + .. + pool_names + .. + poolversion + .. + quota + .. + redundancy + .. + refquota + .. + refreserv + .. + rename_dirs + .. + replacement + .. + reservation + .. + rootpool + .. + rsend + .. + scrub_mirror + .. + slog + .. + snapshot + .. + snapused + .. + sparse + .. + threadsappend + .. + truncate + .. + txg_integrity + .. + userquota + .. + utils_test + .. + write_dirs + .. + xattr + .. + zfsd + .. + zil + .. + zinject + .. + zones + .. + zvol + zvol_ENOSPC + .. + zvol_cli + .. + zvol_misc + .. + zvol_swap + .. + .. + zvol_thrash + .. + .. + .. + .. + dtrace + .. fifo .. file Modified: head/share/mk/atf.test.mk ============================================================================== --- head/share/mk/atf.test.mk Fri Feb 23 16:06:54 2018 (r329866) +++ head/share/mk/atf.test.mk Fri Feb 23 16:31:00 2018 (r329867) @@ -21,6 +21,7 @@ ATF_TESTS_C?= ATF_TESTS_CXX?= ATF_TESTS_SH?= +ATF_TESTS_KSH93?= .if !empty(ATF_TESTS_C) PROGS+= ${ATF_TESTS_C} @@ -75,6 +76,31 @@ ${_T}: ${ATF_TESTS_SH_SRC_${_T}} .else cat ${.ALLSRC:N*Makefile*} \ | sed ${ATF_TESTS_SH_SED_${_T}} >>${.TARGET}.tmp +.endif + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +.endfor +.endif + +.if !empty(ATF_TESTS_KSH93) +SCRIPTS+= ${ATF_TESTS_KSH93} +_TESTS+= ${ATF_TESTS_KSH93} +.for _T in ${ATF_TESTS_KSH93} +SCRIPTSDIR_${_T}= ${TESTSDIR} +TEST_INTERFACE.${_T}= atf +CLEANFILES+= ${_T} ${_T}.tmp +# TODO(jmmv): It seems to me that this SED and SRC functionality should +# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if +# this proves to be useful within the tests. +ATF_TESTS_KSH93_SED_${_T}?= # empty +ATF_TESTS_KSH93_SRC_${_T}?= ${_T}.sh +${_T}: ${ATF_TESTS_KSH93_SRC_${_T}} + echo '#! /usr/libexec/atf-sh -s/usr/local/bin/ksh93' > ${.TARGET}.tmp +.if empty(ATF_TESTS_KSH93_SED_${_T}) + cat ${.ALLSRC:N*Makefile*} >>${.TARGET}.tmp +.else + cat ${.ALLSRC:N*Makefile*} \ + | sed ${ATF_TESTS_KSH93_SED_${_T}} >>${.TARGET}.tmp .endif chmod +x ${.TARGET}.tmp mv ${.TARGET}.tmp ${.TARGET} Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Fri Feb 23 16:06:54 2018 (r329866) +++ head/tests/sys/Makefile Fri Feb 23 16:31:00 2018 (r329867) @@ -1,9 +1,12 @@ # $FreeBSD$ +.include + TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio +TESTS_SUBDIRS+= ${_cddl} TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file TESTS_SUBDIRS+= fs @@ -20,6 +23,10 @@ TESTS_SUBDIRS+= posixshm TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm + +.if ${MK_CDDL} != "no" +_cddl= cddl +.endif # Items not integrated into kyua runs by default SUBDIR+= pjdfstest Added: head/tests/sys/cddl/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/Makefile Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/sys/cddl + +TESTS_SUBDIRS+= ${_zfs} + +.if ${MK_ZFS} != "no" +_zfs= zfs +.endif + +.include Added: head/tests/sys/cddl/zfs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/Makefile Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/sys/cddl/zfs + +TESTS_SUBDIRS+= tests include + +SUBDIR+= bin + +.include Added: head/tests/sys/cddl/zfs/bin/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/Makefile Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,61 @@ +# $FreeBSD$ + +.include + +PACKAGE= tests +MAN= +BINDIR= ${TESTSBASE}/sys/cddl/zfs/bin +SCRIPTSDIR= ${TESTSBASE}/sys/cddl/zfs/bin + +SCRIPTS+= bsddisks.ksh +SCRIPTS+= dircmp.ksh +SCRIPTS+= dumpadm.ksh +SCRIPTS+= ff.ksh +SCRIPTS+= fmadm.ksh +SCRIPTS+= fmdump.ksh +SCRIPTS+= format.ksh +SCRIPTS+= groupadd.ksh +SCRIPTS+= groupdel.ksh +SCRIPTS+= groupmod.ksh +SCRIPTS+= groupshow.ksh +SCRIPTS+= svcs.ksh +SCRIPTS+= swap.ksh +SCRIPTS+= testenv.ksh +SCRIPTS+= useradd.ksh +SCRIPTS+= userdel.ksh +SCRIPTS+= usermod.ksh +SCRIPTS+= zfs.ksh +SCRIPTS+= zfs_crypto.ksh +SCRIPTS+= zfs_version.ksh +SCRIPTS+= zlogin.ksh +SCRIPTS+= zoneadm.ksh +SCRIPTS+= zonecfg.ksh +SCRIPTS+= zpool.ksh +SCRIPTS+= zpool_bsd.ksh +SCRIPTS+= zpool_smi.ksh +SCRIPTS+= zpool_version.ksh + +PROGS+= chg_usr_exec +# Not ported to FreeBSD +# PROGRS+= devname2devid +PROGS+= dir_rd_update +PROGS+= file_check +PROGS+= file_trunc +PROGS+= file_write +PROGS+= largest_file +PROGS+= mkfile +PROGS+= mktree +PROGS+= mmapwrite +PROGS+= randfree_file +PROGS+= readmmap +PROGS+= rename_dir +PROGS+= rm_lnkcnt_zero_file + +.for p in ${PROGS} +SRCS.$p= $p.c +.endfor + +LIBADD.mmapwrite+= pthread +LIBADD.rm_lnkcnt_zero_file+= pthread + +.include Added: head/tests/sys/cddl/zfs/bin/bsddisks.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/bsddisks.ksh Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,6 @@ +#!/usr/local/bin/ksh93 + +# $FreeBSD$ + +BSDDEVS="ad|da|mlxd|myld|aacd|ided|twed" +ls /dev|egrep "^($BSDDEVS)[0-9]+\$" |sed 's/^/\/dev\//' Added: head/tests/sys/cddl/zfs/bin/chg_usr_exec.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/chg_usr_exec.c Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "@(#)chg_usr_exec.c 1.3 07/05/25 SMI" + +#include +#include +#include +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + char *plogin = NULL; + char cmds[BUFSIZ] = { 0 }; + char sep[] = " "; + struct passwd *ppw = NULL; + int i, len; + + if (argc < 3 || strlen(argv[1]) == 0) { + (void) printf("\tUsage: %s ...\n", argv[0]); + return (1); + } + + plogin = argv[1]; + len = 0; + for (i = 2; i < argc; i++) { + (void) snprintf(cmds+len, sizeof (cmds)-len, + "%s%s", argv[i], sep); + len += strlen(argv[i]) + strlen(sep); + } + + if ((ppw = getpwnam(plogin)) == NULL) { + perror("getpwnam"); + return (errno); + } + if (setgid(ppw->pw_gid) != 0) { + perror("setgid"); + return (errno); + } + if (setuid(ppw->pw_uid) != 0) { + perror("setuid"); + return (errno); + } + + if (execl("/bin/sh", "sh", "-c", cmds, (char *)0) != 0) { + perror("execl"); + return (errno); + } + + return (0); +} Added: head/tests/sys/cddl/zfs/bin/devname2devid.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/devname2devid.c Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,123 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "@(#)devname2devid.c 1.3 07/05/25 SMI" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Usage: devname2devid + * + * Examples: + * # ./devname2devid /dev/dsk/c1t4d0s0 + * devid id1,sd@SSEAGATE_ST318404LSUN18G_3BT2G0Z300002146G4CR/a + * # ./devname2devid /dev/dsk/c1t4d0 + * devid id1,sd@SSEAGATE_ST318404LSUN18G_3BT2G0Z300002146G4CR/wd + * # ./devname2devid /dev/dsk/c1t4d0s1 + * devid id1,sd@SSEAGATE_ST318404LSUN18G_3BT2G0Z300002146G4CR/b + * # + * + * This program accepts a disk or disk slice path and prints a + * device id. + * + * Exit values: + * 0 - means success + * 1 - means failure + * + */ +int +main(int argc, char *argv[]) +{ + int fd; + ddi_devid_t devid; + char *minor_name, *devidstr, *device; +#ifdef DEBUG + devid_nmlist_t *list = NULL; + char *search_path; + int i; +#endif + + if (argc == 1) { + (void) printf("%s [search path]\n", + argv[0]); + exit(1); + } + device = argv[1]; + + if ((fd = open(device, O_RDONLY|O_NDELAY)) < 0) { + perror(device); + exit(1); + } + if (devid_get(fd, &devid) != 0) { + perror("devid_get"); + exit(1); + } + if (devid_get_minor_name(fd, &minor_name) != 0) { + perror("devid_get_minor_name"); + exit(1); + } + if ((devidstr = devid_str_encode(devid, minor_name)) == 0) { + perror("devid_str_encode"); + exit(1); + } + + (void) printf("devid %s\n", devidstr); + + devid_str_free(devidstr); + +#ifdef DEBUG + if (argc == 3) { + search_path = argv[2]; + } else { + search_path = "/dev/rdsk"; + } + + if (devid_deviceid_to_nmlist(search_path, devid, DEVID_MINOR_NAME_ALL, + &list)) { + perror("devid_deviceid_to_nmlist"); + exit(1); + } + + /* loop through list and process device names and numbers */ + for (i = 0; list[i].devname != NULL; i++) { + (void) printf("devname: %s %p\n", list[i].devname, list[i].dev); + } + devid_free_nmlist(list); + +#endif /* DEBUG */ + + devid_str_free(minor_name); + devid_free(devid); + + return (0); +} Added: head/tests/sys/cddl/zfs/bin/dir_rd_update.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/dir_rd_update.c Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,122 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "@(#)dir_rd_update.c 1.2 07/01/09 SMI" + +/* + * Assertion: + * + * A read operation and directory update operation performed + * concurrently on the same directory can lead to deadlock + * on a UFS logging file system, but not on a ZFS file system. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#define TMP_DIR /tmp + +static char dirpath[256]; + +int +main(int argc, char **argv) +{ + char *cp1 = ""; + int i = 0; + int ret = 0; + int testdd = 0; + pid_t pid; + static const int op_num = 5; + + if (argc == 1) { + (void) printf("Usage: %s \n", argv[0]); + exit(-1); + } + for (i = 0; i < 256; i++) { + dirpath[i] = 0; + } + + cp1 = argv[1]; + (void) strcpy(&dirpath[0], (const char *)cp1); + (void) strcat(&dirpath[strlen(dirpath)], "TMP_DIR"); + + ret = mkdir(dirpath, 0777); + if (ret != 0) { + if (errno != EEXIST) { + (void) printf( + "%s: mkdir(<%s>, 0777) failed: errno (decimal)=%d\n", + argv[0], dirpath, errno); + exit(-1); + } + } + testdd = open(dirpath, O_RDONLY|O_SYNC); + if (testdd < 0) { + (void) printf( +"%s: open(<%s>, O_RDONLY|O_SYNC) failed: errno (decimal)=%d\n", + argv[0], dirpath, errno); + exit(-1); + } else { + (void) close(testdd); + } + pid = fork(); + if (pid > 0) { + int fd = open(dirpath, O_RDONLY|O_SYNC); + char buf[16]; + int rdret; + int j = 0; + + while (j < op_num) { + (void) sleep(1); + rdret = read(fd, buf, 16); + if (rdret == -1) { + (void) printf("readdir failed"); + } + j++; + } + } else if (pid == 0) { + int fd = open(dirpath, O_RDONLY); + int chownret; + int k = 0; + + while (k < op_num) { + (void) sleep(1); + chownret = fchown(fd, 0, 0); + if (chownret == -1) { + (void) printf("chown failed"); + } + + k++; + } + } + + return (0); +} Added: head/tests/sys/cddl/zfs/bin/dircmp.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/dircmp.ksh Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,5 @@ +#!/usr/local/bin/ksh93 + +# $FreeBSD$ + +diff -qr $* Added: head/tests/sys/cddl/zfs/bin/dumpadm.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/dumpadm.ksh Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,10 @@ +#! /usr/local/bin/ksh93 -p + +# $FreeBSD$ + +if [ $# != 0 ] +then + echo "ERROR option not supported" + return 1 +fi +grep dumpdev /etc/rc.conf Added: head/tests/sys/cddl/zfs/bin/ff.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/ff.ksh Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,6 @@ +#!/usr/local/bin/ksh93 + +# $FreeBSD$ + +echo dummy +exit 0 Added: head/tests/sys/cddl/zfs/bin/file_check.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/file_check.c Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,89 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "@(#)file_check.c 1.3 07/05/25 SMI" + +#include "file_common.h" + +static unsigned char bigbuffer[BIGBUFFERSIZE]; + +/* + * Given a filename, check that the file consists entirely + * of a particular pattern. If the pattern is not specified a + * default will be used. For default values see file_common.h + */ +int +main(int argc, char **argv) +{ + int bigfd; + long i, n; + uint8_t fillchar = DATA; + int bigbuffersize = BIGBUFFERSIZE; + int64_t read_count = 0; + + /* + * Validate arguments + */ + if (argc < 2) { + (void) printf("Usage: %s filename [pattern]\n", + argv[0]); + exit(1); + } + + if (argv[2]) { + fillchar = atoi(argv[2]); + } + + /* + * Read the file contents and check every character + * against the supplied pattern. Abort if the + * pattern check fails. + */ + if ((bigfd = open(argv[1], O_RDONLY)) == -1) { + (void) printf("open %s failed %d\n", argv[1], errno); + exit(1); + } + + do { + if ((n = read(bigfd, &bigbuffer, bigbuffersize)) == -1) { + (void) printf("read failed (%ld), %d\n", n, errno); + exit(errno); + } + + for (i = 0; i < n; i++) { + if (bigbuffer[i] != fillchar) { + (void) printf("error %s: 0x%x != 0x%x)\n", + argv[1], bigbuffer[i], fillchar); + exit(1); + } + } + + read_count += n; + } while (n == bigbuffersize); + + return (0); +} Added: head/tests/sys/cddl/zfs/bin/file_common.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/file_common.h Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef FILE_COMMON_H +#define FILE_COMMON_H + +#pragma ident "@(#)file_common.h 1.3 07/05/25 SMI" + +/* + * header file for file_* utilities. These utilities + * are used by the test cases to perform various file + * operations (append writes, for example). + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#define BLOCKSZ 8192 +#define DATA 0xa5 +#define DATA_RANGE 120 +#define BIGBUFFERSIZE 0x800000 +#define BIGFILESIZE 20 + +extern char *optarg; +extern int optind, opterr, optopt; + +#ifdef __cplusplus +} +#endif + +#endif /* FILE_COMMON_H */ Added: head/tests/sys/cddl/zfs/bin/file_trunc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/cddl/zfs/bin/file_trunc.c Fri Feb 23 16:31:00 2018 (r329867) @@ -0,0 +1,240 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#pragma ident "@(#)file_trunc.c 1.2 07/05/25 SMI" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FSIZE 256*1024*1024 +#define BSIZE 512 + +/* Initialize Globals */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 23 16:36:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48CA2F04D71; Fri, 23 Feb 2018 16:36:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3DFF696AC; Fri, 23 Feb 2018 16:36:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE8B318FDE; Fri, 23 Feb 2018 16:36:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NGatMY029462; Fri, 23 Feb 2018 16:36:55 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NGatuv029461; Fri, 23 Feb 2018 16:36:55 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802231636.w1NGatuv029461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 16:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r329868 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 329868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:36:56 -0000 Author: asomers Date: Fri Feb 23 16:36:55 2018 New Revision: 329868 URL: https://svnweb.freebsd.org/changeset/base/329868 Log: Drop privileges taken in r329865 Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Fri Feb 23 16:31:00 2018 (r329867) +++ svnadmin/conf/sizelimit.conf Fri Feb 23 16:36:55 2018 (r329868) @@ -15,7 +15,6 @@ # First field is username, second field is the raised limit required. achim -asomers bapt davidcs dim From owner-svn-src-all@freebsd.org Fri Feb 23 16:46:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E555F05927; Fri, 23 Feb 2018 16:46:00 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED86D69CB4; Fri, 23 Feb 2018 16:45:59 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF1AF19173; Fri, 23 Feb 2018 16:45:59 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NGjxXa034175; Fri, 23 Feb 2018 16:45:59 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NGjxJw034174; Fri, 23 Feb 2018 16:45:59 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802231645.w1NGjxJw034174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 23 Feb 2018 16:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329869 - stable/11/usr.sbin/bsdinstall/partedit X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/11/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 329869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:46:00 -0000 Author: rpokala Date: Fri Feb 23 16:45:59 2018 New Revision: 329869 URL: https://svnweb.freebsd.org/changeset/base/329869 Log: MFC r323508: When doing a non-interactive installation, don't display an interactive warning about a filesystem which doesn't have a mountpoint. Presumably, the person who wrote the install script knew what they were doing. Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Feb 23 16:36:55 2018 (r329868) +++ stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Feb 23 16:45:59 2018 (r329869) @@ -1034,14 +1034,17 @@ addpartform: /* Warn if no mountpoint set */ if (strcmp(items[0].text, "freebsd-ufs") == 0 && items[2].text[0] != '/') { - dialog_vars.defaultno = TRUE; - choice = dialog_yesno("Warning", - "This partition does not have a valid mountpoint " - "(for the partition from which you intend to boot the " - "operating system, the mountpoint should be /). Are you " - "sure you want to continue?" - , 0, 0); - dialog_vars.defaultno = FALSE; + choice = 0; + if (interactive) { + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", + "This partition does not have a valid mountpoint " + "(for the partition from which you intend to boot the " + "operating system, the mountpoint should be /). Are you " + "sure you want to continue?" + , 0, 0); + dialog_vars.defaultno = FALSE; + } if (choice == 1) /* cancel */ goto addpartform; } From owner-svn-src-all@freebsd.org Fri Feb 23 16:46:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28322F05A6E; Fri, 23 Feb 2018 16:46:50 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CED3969E75; Fri, 23 Feb 2018 16:46:49 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9C311917A; Fri, 23 Feb 2018 16:46:49 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NGkn9O034245; Fri, 23 Feb 2018 16:46:49 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NGknJq034244; Fri, 23 Feb 2018 16:46:49 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802231646.w1NGknJq034244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 23 Feb 2018 16:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329870 - stable/10/usr.sbin/bsdinstall/partedit X-SVN-Group: stable-10 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/10/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 329870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:46:50 -0000 Author: rpokala Date: Fri Feb 23 16:46:49 2018 New Revision: 329870 URL: https://svnweb.freebsd.org/changeset/base/329870 Log: MFC r323508: When doing a non-interactive installation, don't display an interactive warning about a filesystem which doesn't have a mountpoint. Presumably, the person who wrote the install script knew what they were doing. Modified: stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Feb 23 16:45:59 2018 (r329869) +++ stable/10/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Feb 23 16:46:49 2018 (r329870) @@ -1034,14 +1034,17 @@ addpartform: /* Warn if no mountpoint set */ if (strcmp(items[0].text, "freebsd-ufs") == 0 && items[2].text[0] != '/') { - dialog_vars.defaultno = TRUE; - choice = dialog_yesno("Warning", - "This partition does not have a valid mountpoint " - "(for the partition from which you intend to boot the " - "operating system, the mountpoint should be /). Are you " - "sure you want to continue?" - , 0, 0); - dialog_vars.defaultno = FALSE; + choice = 0; + if (interactive) { + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", + "This partition does not have a valid mountpoint " + "(for the partition from which you intend to boot the " + "operating system, the mountpoint should be /). Are you " + "sure you want to continue?" + , 0, 0); + dialog_vars.defaultno = FALSE; + } if (choice == 1) /* cancel */ goto addpartform; } From owner-svn-src-all@freebsd.org Fri Feb 23 16:48:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BA29F05D79; Fri, 23 Feb 2018 16:48:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 68F9C6A06E; Fri, 23 Feb 2018 16:48:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 21D343C6084; Sat, 24 Feb 2018 03:48:36 +1100 (AEDT) Date: Sat, 24 Feb 2018 03:48:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy... In-Reply-To: Message-ID: <20180224025336.Y3137@besplex.bde.org> References: <201802230404.w1N44PiD053834@repo.freebsd.org> <20180223170403.I1331@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VJytp5HX c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=HDSL7_zQFoRnIPk-U0YA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:48:40 -0000 On Fri, 23 Feb 2018, Warner Losh wrote: > On Thu, Feb 22, 2018 at 11:12 PM, Bruce Evans wrote: > >> On Fri, 23 Feb 2018, Warner Losh wrote: >* ... >> Modified: head/sys/arm/include/_types.h >>> ============================================================ >>> ================== >>> --- head/sys/arm/include/_types.h Fri Feb 23 04:04:18 2018 >>> (r329858) >>> +++ head/sys/arm/include/_types.h Fri Feb 23 04:04:25 2018 >>> (r329859) >>> @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; >>> */ >>> typedef __uint32_t __clock_t; /* clock()... */ >>> typedef __int32_t __critical_t; >>> +#ifndef _STANDALONE >>> typedef double __double_t; >>> typedef float __float_t; >>> +#endif >>> typedef __int32_t __intfptr_t; >>> typedef __int64_t __intmax_t; >>> typedef __int32_t __intptr_t; >> >> __types.h headers exist to avoid ifdefs like this. They only define types >> in the implementation namespace. Nothing except should use >> __double_t or __float_t directly. There is only a problem if some option >> like -fno-float turns off floating point completely, so that 'float' is >> a syntax error. > > Right. Except, there's no longer a -fno-float option. Then again, these > should almost certainly be in sys/_types instead because they are identical > on every platform and will almost certainly never ever be anything other > than what they are. > > For the boot loader, I spiked double and float definitions so that we don't > touch floating point types at all. We do this in the Makefile by > intentionally creating syntax errors. I don't think this is undefined > behavior, I think it is well defined behavior: A syntax error is a syntax > error. We're using a restricted set of C for the loader anyway. It's mostly > to prevent accidental use of floating point. It is more undefined than most undefined things. E.g., C99 7.1.3p2 says: If the program ... defines a reserved identifier as a macro name, the behavior is undefined. Even K&R support was much more careful. E.g., to avoid defining away const, it spelled const as __const and defined __const as nothing for K&R and as const for C99 and later. still has ifdef tangles to support this, but they are almost useless since other headers no longer use __const and even uses plain const in many places. Also, the defining away of __const is now under a very confusing condition (_CC_SUPPORTS___INLINE). The connection with __inline is that __inline is gcc's pre-C99 spelling of inline. gcc also has __const, which is a pre-C90 spelling of const. The FreeBSD semantics for __const are tangled up with the gcc semantics (FreeBSD wants to keep __const as itself and not define it away for gcc with pre-C90 support). does define away const, etc under the even more arcane option (_CC_SUPPORTS___INLINE && NO_ANSI_KEYWORDS. (Hmm, NO_ANSI_KEYWORDS is namespace pollution.) You don't want these complications for float and double. > If we ever support floats and such in the boot loader, I'll revert. This Kernel programmers have no difficulty not using floats in kernel code. I actually use doubles in tsc.c to do cperciva's statistics. This is much easier than using fixed point. Compilers don't quite support it. I have to remove -msoft-float and compile with gcc. clang refuses inline __builtin_sqrtl(). > helps us catch accidents like one of the lua files being compiled > incorrectly, leading to stray references to float/double on arm which > caused float stuff to be referenced and pulled in due to inlining. That's > the real bug, and that's been fixed. Until we need float/double in the > loader, I'll keep this in place to prevent a recurrence. Floating point is even easier to use in boot code than in the kernel. In tsc.c, I don't bother obtaining ownership of the FPU by the thread, but just use it. This works because there aren't really any threads early in the boot. Similarly in boot code. The initialization is: XX * Since we want this calculation to be as accurate as possible, and XX * we cannot use the FPU at this point in the boot cycle, we resort to XX * fixed-point arithmetic, shifting everything as far left as we can XX * rely on being safe: The mean TSC is bounded by the maximum TSC, and Above comment by cperciva. XX /* Contrary to the comment, we can use the npx especially easily. */ XX __asm __volatile("clts; fninit"); This wasn't so easy in 1992 when on x86's the FPU might have been separate or emulated. Compilers might generate FPU use even if there is no explicit use of floating point in the program, but this is normally turned off in boot code and kernels using -msoft-float [-mno-sse -m-no-sse2 -mno-sse3 ...]. That should be enough. Other errors are very easy to find since they cause linkage failures like for my __builtin_sqrtl(). (gcc compiles my FP with -msoft-float on i386, but then there are linkage errors for the nonexistent soft-float support. On amd64, -msoft-float is not supported since it uses an incompatible ABI, so the error is detected before link time.) Bruce From owner-svn-src-all@freebsd.org Fri Feb 23 16:51:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98D77F06143; Fri, 23 Feb 2018 16:51:21 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E5206A373; Fri, 23 Feb 2018 16:51:21 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F06D192B4; Fri, 23 Feb 2018 16:51:21 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NGpLln036815; Fri, 23 Feb 2018 16:51:21 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NGpLGk036814; Fri, 23 Feb 2018 16:51:21 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802231651.w1NGpLGk036814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 23 Feb 2018 16:51:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329871 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 329871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:51:21 -0000 Author: rpokala Date: Fri Feb 23 16:51:20 2018 New Revision: 329871 URL: https://svnweb.freebsd.org/changeset/base/329871 Log: Somehow r329870 disn't include the mergeinfo...? Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Fri Feb 23 16:54:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D345AF06668; Fri, 23 Feb 2018 16:54:32 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from pv33p00im-asmtp002.me.com (pv33p00im-asmtp002.me.com [17.142.194.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68B1E6A745; Fri, 23 Feb 2018 16:54:29 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.pv33p00im-asmtp002.me.com by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P4M00L00417RN00@pv33p00im-asmtp002.me.com>; Fri, 23 Feb 2018 16:54:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1519404861; bh=HkmBy8bl5v4Eec+nGkWC5efj5oetYqGTaAIGVObpcvo=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=AyzPmJSNzjY531FpXJmK00A0t4aBF82xmnNorH1H0STLr2zyZF4mUDZGLoKaw+ZJz Y18gdUiKRwU24OP+uYYEjmB23BSYLPj5haTilQAzOMq+RcJGleMrbWaHw6itwpgBSp tKu38A1q95D1q77qFc7wchrD744IclzJFy82Yi6x2irFazOlqiQI2peWQ6vxWgezwS im+R0SB5UthLga7je3LMYEgkIkR05O/uuFTlIhnfgcg0F05xsrLG5IG3GNWJ8lkFTs qnO6iYvkps7mLbxQxnH+qLmtfOZWW+7bFPDqEEXWI9/6Gy3nIshVv6drrRcWlq8bmy FbBlfgj7+96sQ== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P4M00IOT4AG9S20@pv33p00im-asmtp002.me.com>; Fri, 23 Feb 2018 16:54:18 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-23_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1802230210 User-Agent: Microsoft-MacOutlook/10.a.0.180210 Date: Fri, 23 Feb 2018 08:54:15 -0800 Subject: Re: svn commit: r329871 - stable/11 From: Ravi Pokala To: Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Message-id: <855BCF11-7D7C-4821-AD0B-320D5E64ECAE@mac.com> Thread-topic: svn commit: r329871 - stable/11 References: <201802231651.w1NGpLGk036814@repo.freebsd.org> In-reply-to: <201802231651.w1NGpLGk036814@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 16:54:33 -0000 -----Original Message----- From: on behalf of Ravi Pokala Date: 2018-02-23, Friday at 08:51 To: , , , Subject: svn commit: r329871 - stable/11 > Author: rpokala > Date: Fri Feb 23 16:51:20 2018 > New Revision: 329871 > URL: https://svnweb.freebsd.org/changeset/base/329871 > > Log: > Somehow r329870 disn't include the mergeinfo...? That should be r329869 of course. > Modified: > Directory Properties: > stable/11/ (props changed) From owner-svn-src-all@freebsd.org Fri Feb 23 17:20:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 677FBF0966D; Fri, 23 Feb 2018 17:20:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E70626BBBB; Fri, 23 Feb 2018 17:20:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1EBC19664; Fri, 23 Feb 2018 17:20:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NHKr7O049947; Fri, 23 Feb 2018 17:20:53 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NHKrCj049946; Fri, 23 Feb 2018 17:20:53 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802231720.w1NHKrCj049946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 17:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329872 - head/usr.sbin/mptutil X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.sbin/mptutil X-SVN-Commit-Revision: 329872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 17:20:54 -0000 Author: asomers Date: Fri Feb 23 17:20:53 2018 New Revision: 329872 URL: https://svnweb.freebsd.org/changeset/base/329872 Log: Delete copypasta Reported by: rpokala MFC after: 20 days X-MFC-With: 329845 Sponsored by: Spectra Logic Corp Modified: head/usr.sbin/mptutil/mpt_config.c Modified: head/usr.sbin/mptutil/mpt_config.c ============================================================================== --- head/usr.sbin/mptutil/mpt_config.c Fri Feb 23 16:51:20 2018 (r329871) +++ head/usr.sbin/mptutil/mpt_config.c Fri Feb 23 17:20:53 2018 (r329872) @@ -961,7 +961,6 @@ add_spare(int ac, char **av) if (error != 0) { warn("Failed to fetch standalone disk list"); mpt_free_pd_list(list); - mpt_free_pd_list(list); close(fd); return (error); } @@ -971,14 +970,12 @@ add_spare(int ac, char **av) error = errno; warn("Unable to lookup drive %s", av[1]); mpt_free_pd_list(list); - mpt_free_pd_list(list); close(fd); return (error); } if (mpt_lock_physdisk(&sdisks[i]) < 0) { mpt_free_pd_list(list); - mpt_free_pd_list(list); close(fd); return (errno); } @@ -986,7 +983,6 @@ add_spare(int ac, char **av) if (mpt_create_physdisk(fd, &sdisks[i], &PhysDiskNum) < 0) { error = errno; warn("Failed to create physical disk page"); - mpt_free_pd_list(list); mpt_free_pd_list(list); close(fd); return (error); From owner-svn-src-all@freebsd.org Fri Feb 23 18:15:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65E91F0EC8B; Fri, 23 Feb 2018 18:15:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 15D3D6E148; Fri, 23 Feb 2018 18:15:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1060619FDE; Fri, 23 Feb 2018 18:15:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NIFpBD080014; Fri, 23 Feb 2018 18:15:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NIFoYx079999; Fri, 23 Feb 2018 18:15:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802231815.w1NIFoYx079999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Feb 2018 18:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329873 - in head/sys: amd64/linux amd64/linux32 compat/freebsd32 dev/aic7xxx dev/drm2 dev/xen/blkback dev/xen/netback i386/ibcs2 i386/linux i386/pci kern netgraph x86/include X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 compat/freebsd32 dev/aic7xxx dev/drm2 dev/xen/blkback dev/xen/netback i386/ibcs2 i386/linux i386/pci kern netgraph x86/include X-SVN-Commit-Revision: 329873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 18:15:52 -0000 Author: emaste Date: Fri Feb 23 18:15:50 2018 New Revision: 329873 URL: https://svnweb.freebsd.org/changeset/base/329873 Log: Correct pseudo misspelling in sys/ comments contrib code and #define in intel_ata.h unchanged. Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/compat/freebsd32/syscalls.master head/sys/dev/aic7xxx/aic7xxx.seq head/sys/dev/drm2/drm_fb_helper.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/netback/netback.c head/sys/i386/ibcs2/syscalls.master head/sys/i386/linux/syscalls.master head/sys/i386/pci/pci_pir.c head/sys/kern/syscalls.master head/sys/netgraph/ng_atmllc.c head/sys/x86/include/apicvar.h Modified: head/sys/amd64/linux/syscalls.master ============================================================================== --- head/sys/amd64/linux/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/amd64/linux/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, NOPROTO, UNIMPL -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/amd64/linux32/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, NOPROTO, UNIMPL -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/compat/freebsd32/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -16,7 +16,7 @@ ; COMPAT7, COMPAT11, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/dev/aic7xxx/aic7xxx.seq ============================================================================== --- head/sys/dev/aic7xxx/aic7xxx.seq Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/dev/aic7xxx/aic7xxx.seq Fri Feb 23 18:15:50 2018 (r329873) @@ -57,7 +57,7 @@ PREFIX = "ahc_" * a later time. This problem cannot be resolved by holding a single entry * in scratch ram since a reconnecting target can request sense and this will * create yet another SCB waiting for selection. The solution used here is to - * use byte 27 of the SCB as a psuedo-next pointer and to thread a list + * use byte 27 of the SCB as a pseudo-next pointer and to thread a list * of SCBs that are awaiting selection. Since 0-0xfe are valid SCB indexes, * SCB_LIST_NULL is 0xff which is out of range. An entry is also added to * this list every time a request sense occurs or after completing a non-tagged Modified: head/sys/dev/drm2/drm_fb_helper.c ============================================================================== --- head/sys/dev/drm2/drm_fb_helper.c Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/dev/drm2/drm_fb_helper.c Fri Feb 23 18:15:50 2018 (r329873) @@ -580,7 +580,7 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u if (info->fix.visual == FB_VISUAL_TRUECOLOR) { u32 *palette; u32 value; - /* place color in psuedopalette */ + /* place color in pseudopalette */ if (regno > 16) return -EINVAL; palette = (u32 *)info->pseudo_palette; Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/dev/xen/blkback/blkback.c Fri Feb 23 18:15:50 2018 (r329873) @@ -251,7 +251,7 @@ struct xbb_xen_reqlist { uint8_t *kva; /** - * Base, psuedo-physical address, corresponding to the start + * Base, pseudo-physical address, corresponding to the start * of this request's kva region. */ uint64_t gnt_base; @@ -590,7 +590,7 @@ struct xbb_softc { */ vm_offset_t kva; - /** Psuedo-physical address corresponding to kva. */ + /** Pseudo-physical address corresponding to kva. */ uint64_t gnt_base_addr; /** The size of the global kva pool. */ @@ -936,7 +936,7 @@ xbb_reqlist_ioaddr(struct xbb_xen_reqlist *reqlist, in /** * Given a page index and 512b sector offset within that page, calculate - * an offset into the local psuedo-physical address space used to map a + * an offset into the local pseudo-physical address space used to map a * front-end's request data into a request. * * \param reqlist The request list structure whose pseudo-physical region Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/dev/xen/netback/netback.c Fri Feb 23 18:15:50 2018 (r329873) @@ -491,7 +491,7 @@ struct xnb_softc { */ vm_offset_t kva; - /** Psuedo-physical address corresponding to kva. */ + /** Pseudo-physical address corresponding to kva. */ uint64_t gnt_base_addr; /** Various configuration and state bit flags. */ Modified: head/sys/i386/ibcs2/syscalls.master ============================================================================== --- head/sys/i386/ibcs2/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/i386/ibcs2/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, OBSOL, UNIMPL, COMPAT -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/i386/linux/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, NOPROTO, UNIMPL -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/i386/pci/pci_pir.c ============================================================================== --- head/sys/i386/pci/pci_pir.c Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/i386/pci/pci_pir.c Fri Feb 23 18:15:50 2018 (r329873) @@ -648,7 +648,7 @@ pci_pir_probe(int bus, int require_parse) } /* - * The driver for the new-bus psuedo device pir0 for the $PIR table. + * The driver for the new-bus pseudo device pir0 for the $PIR table. */ static int Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/kern/syscalls.master Fri Feb 23 18:15:50 2018 (r329873) @@ -15,7 +15,7 @@ ; COMPAT7, COMPAT11, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) -; name psuedo-prototype of syscall routine +; name pseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: head/sys/netgraph/ng_atmllc.c ============================================================================== --- head/sys/netgraph/ng_atmllc.c Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/netgraph/ng_atmllc.c Fri Feb 23 18:15:50 2018 (r329873) @@ -171,7 +171,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p item) padding = 0; if (hook == priv->atm) { - /* Ditch the psuedoheader. */ + /* Ditch the pseudoheader. */ hdr = mtod(m, struct atmllc *); /* m_adj(m, sizeof(struct atm_pseudohdr)); */ Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Fri Feb 23 17:20:53 2018 (r329872) +++ head/sys/x86/include/apicvar.h Fri Feb 23 18:15:50 2018 (r329873) @@ -169,7 +169,7 @@ #define IRQ_DISABLED (NUM_IO_INTS + 4) /* - * An APIC enumerator is a psuedo bus driver that enumerates APIC's including + * An APIC enumerator is a pseudo bus driver that enumerates APIC's including * CPU's and I/O APIC's. */ struct apic_enumerator { From owner-svn-src-all@freebsd.org Fri Feb 23 18:18:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D43E9F0F0EA; Fri, 23 Feb 2018 18:18:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82E2C6E435; Fri, 23 Feb 2018 18:18:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7981919FE1; Fri, 23 Feb 2018 18:18:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NIIhes080300; Fri, 23 Feb 2018 18:18:43 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NIIhU6080295; Fri, 23 Feb 2018 18:18:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802231818.w1NIIhU6080295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 23 Feb 2018 18:18:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329874 - in head: etc/mtree tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree tests/sys/net X-SVN-Commit-Revision: 329874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 18:18:44 -0000 Author: asomers Date: Fri Feb 23 18:18:42 2018 New Revision: 329874 URL: https://svnweb.freebsd.org/changeset/base/329874 Log: Add tests for lagg(4) and other cloned network interfaces Unfortunately, most of the tests are disabled because they fairly frequently trigger panics. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Added: head/tests/sys/net/ head/tests/sys/net/Makefile (contents, props changed) head/tests/sys/net/if_clone_test.sh (contents, props changed) head/tests/sys/net/if_lagg_test.sh (contents, props changed) head/tests/sys/net/randsleep.c (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Fri Feb 23 18:15:50 2018 (r329873) +++ head/etc/mtree/BSD.tests.dist Fri Feb 23 18:18:42 2018 (r329874) @@ -730,6 +730,8 @@ .. mqueue .. + net + .. netinet .. netipsec Added: head/tests/sys/net/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/Makefile Fri Feb 23 18:18:42 2018 (r329874) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/sys/net +BINDIR= ${TESTSDIR} + +ATF_TESTS_SH+= if_lagg_test +ATF_TESTS_SH+= if_clone_test + +# The tests are written to be run in parallel, but doing so leads to random +# panics. I think it's because the kernel's list of interfaces isn't properly +# locked. +TEST_METADATA+= is_exclusive=true + +MAN= +PROG= randsleep + +WARNS?= 6 + +.include Added: head/tests/sys/net/if_clone_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/if_clone_test.sh Fri Feb 23 18:18:42 2018 (r329874) @@ -0,0 +1,511 @@ +# +# Copyright (c) 2014 Spectra Logic Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer, +# without modification. +# 2. Redistributions in binary form must reproduce at minimum a disclaimer +# substantially similar to the "NO WARRANTY" disclaimer below +# ("Disclaimer") and any redistribution must be conditioned upon +# including a substantially similar Disclaimer requirement for further +# binary redistribution. +# +# NO WARRANTY +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGES. +# +# Authors: Alan Somers (Spectra Logic Corporation) +# +# $FreeBSD$ + +# Outline: +# For each cloned interface type, do three tests +# 1) Create and destroy it +# 2) Create, up, and destroy it +# 3) Create, disable IPv6 auto address assignment, up, and destroy it + +TESTLEN=10 # seconds + +atf_test_case faith_stress cleanup +faith_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a faith(4)" + atf_set "require.user" "root" +} +faith_stress_body() +{ + do_stress "faith" +} +faith_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case faith_up_stress cleanup +faith_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a faith(4)" + atf_set "require.user" "root" +} +faith_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "faith" "" "" +} +faith_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case faith_ipv6_up_stress cleanup +faith_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a faith(4) with IPv6" + atf_set "require.user" "root" +} +faith_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "faith" "6" "" +} +faith_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case gif_stress cleanup +gif_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a gif(4)" + atf_set "require.user" "root" +} +gif_stress_body() +{ + do_stress "gif" +} +gif_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case gif_up_stress cleanup +gif_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a gif(4)" + atf_set "require.user" "root" +} +gif_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "gif" "" "p2p" +} +gif_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case gif_ipv6_up_stress cleanup +gif_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a gif(4) with IPv6" + atf_set "require.user" "root" +} +gif_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: rt_tables_get_rnh_ptr: fam out of bounds." + do_up_stress "gif" "6" "p2p" +} +gif_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case lo_stress cleanup +lo_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy an lo(4)" + atf_set "require.user" "root" +} +lo_stress_body() +{ + do_stress "lo" +} +lo_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case lo_up_stress cleanup +lo_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy an lo(4)" + atf_set "require.user" "root" +} +lo_up_stress_body() +{ + atf_skip "Quickly panics: GPF in rtsock_routemsg" + do_up_stress "lo" "" "" +} +lo_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case lo_ipv6_up_stress cleanup +lo_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy an lo(4) with IPv6" + atf_set "require.user" "root" +} +lo_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: page fault in rtsock_addrmsg" + do_up_stress "lo" "6" "" +} +lo_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tap_stress cleanup +tap_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a tap(4)" + atf_set "require.user" "root" +} +tap_stress_body() +{ + do_stress "tap" +} +tap_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tap_up_stress cleanup +tap_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a tap(4)" + atf_set "require.user" "root" +} +tap_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "tap" "" "" +} +tap_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tap_ipv6_up_stress cleanup +tap_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a tap(4) with IPv6" + atf_set "require.user" "root" +} +tap_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: if_delmulti_locked: inconsistent ifp 0xfffff80150e44000" + do_up_stress "tap" "6" "" +} +tap_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tun_stress cleanup +tun_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a tun(4)" + atf_set "require.user" "root" +} +tun_stress_body() +{ + do_stress "tun" +} +tun_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tun_up_stress cleanup +tun_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a tun(4)" + atf_set "require.user" "root" +} +tun_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "tun" "" "p2p" +} +tun_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case tun_ipv6_up_stress cleanup +tun_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a tun(4) with IPv6" + atf_set "require.user" "root" +} +tun_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "tun" "6" "p2p" +} +tun_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vlan_stress cleanup +vlan_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a vlan(4)" + atf_set "require.user" "root" +} +vlan_stress_body() +{ + do_stress "vlan" +} +vlan_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vlan_up_stress cleanup +vlan_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a vlan(4)" + atf_set "require.user" "root" +} +vlan_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "vlan" "" "" +} +vlan_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vlan_ipv6_up_stress cleanup +vlan_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a vlan(4) with IPv6" + atf_set "require.user" "root" +} +vlan_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "vlan" "6" "" +} +vlan_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vmnet_stress cleanup +vmnet_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a vmnet(4)" + atf_set "require.user" "root" +} +vmnet_stress_body() +{ + do_stress "vmnet" +} +vmnet_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vmnet_up_stress cleanup +vmnet_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a vmnet(4)" + atf_set "require.user" "root" +} +vmnet_up_stress_body() +{ + do_up_stress "vmnet" "" "" +} +vmnet_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_test_case vmnet_ipv6_up_stress cleanup +vmnet_ipv6_up_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a vmnet(4) with IPv6" + atf_set "require.user" "root" +} +vmnet_ipv6_up_stress_body() +{ + atf_skip "Quickly panics: if_freemulti: protospec not NULL" + do_up_stress "vmnet" "6" "" +} +vmnet_ipv6_up_stress_cleanup() +{ + cleanup_ifaces +} + +atf_init_test_cases() +{ + # TODO: add epair(4) tests, which need a different syntax + atf_add_test_case faith_ipv6_up_stress + atf_add_test_case faith_stress + atf_add_test_case faith_up_stress + atf_add_test_case gif_ipv6_up_stress + atf_add_test_case gif_stress + atf_add_test_case gif_up_stress + # Don't test lagg; it has its own test program + atf_add_test_case lo_ipv6_up_stress + atf_add_test_case lo_stress + atf_add_test_case lo_up_stress + atf_add_test_case tap_ipv6_up_stress + atf_add_test_case tap_stress + atf_add_test_case tap_up_stress + atf_add_test_case tun_ipv6_up_stress + atf_add_test_case tun_stress + atf_add_test_case tun_up_stress + atf_add_test_case vlan_ipv6_up_stress + atf_add_test_case vlan_stress + atf_add_test_case vlan_up_stress + atf_add_test_case vmnet_ipv6_up_stress + atf_add_test_case vmnet_stress + atf_add_test_case vmnet_up_stress +} + +do_stress() +{ + local IFACE + + IFACE=`get_iface $1` + + # First thread: create the interface + while true; do + ifconfig $IFACE create 2>/dev/null && \ + echo -n . >> creator_count.txt + done & + CREATOR_PID=$! + + # Second thread: destroy the lagg + while true; do + ifconfig $IFACE destroy 2>/dev/null && \ + echo -n . >> destroyer_count.txt + done & + DESTROYER_PID=$! + + sleep ${TESTLEN} + kill $CREATOR_PID + kill $DESTROYER_PID + echo "Created $IFACE `stat -f %z creator_count.txt` times." + echo "Destroyed it `stat -f %z destroyer_count.txt` times." +} + +# Implement the up stress tests +# Parameters +# $1 Interface class, etc "lo" or "tap" +# $2 "6" to enable IPv6 auto address assignment, anything else otherwise +# $3 p2p for point to point interfaces, anything else for normal interfaces +do_up_stress() +{ + local IFACE IPv6 MAC P2P SRCDIR + + # Configure the interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + DSTADDR="192.0.2.3" + MASK="24" + # ifconfig takes about 10ms to run. To increase race coverage, + # randomly delay the two commands relative to each other by 5ms either + # way. + MEAN_SLEEP_SECONDS=.005 + MAX_SLEEP_USECS=10000 + + IFACE=`get_iface $1` + IPV6=$2 + P2P=$3 + + SRCDIR=$( atf_get_srcdir ) + if [ "$IPV6" = 6 ]; then + ipv6_cmd="true" + else + ipv6_cmd="ifconfig $IFACE inet6 ifdisabled" + fi + if [ "$P2P" = "p2p" ]; then + up_cmd="ifconfig $IFACE up ${ADDR}/${MASK} ${DSTADDR}" + else + up_cmd="ifconfig $IFACE up ${ADDR}/${MASK}" + fi + while true; do + eval "$ipv6_cmd" + { sleep ${MEAN_SLEEP_SECONDS} && \ + eval "$up_cmd" 2> /dev/null && + echo -n . >> up_count.txt ; } & + { ${SRCDIR}/randsleep ${MAX_SLEEP_USECS} && \ + ifconfig $IFACE destroy && + echo -n . >> destroy_count.txt ; } & + wait + ifconfig $IFACE create + done & + LOOP_PID=$! + + sleep ${TESTLEN} + kill $LOOP_PID + echo "Upped ${IFACE} `stat -f %z up_count.txt` times." + echo "Destroyed it `stat -f %z destroy_count.txt` times." +} + +# Creates a new cloned interface, registers it for cleanup, and echoes it +# params: $1 Interface class name (tap, gif, etc) +get_iface() +{ + local CLASS DEV N + + CLASS=$1 + N=0 + while ! ifconfig ${CLASS}${N} create > /dev/null 2>&1; do + if [ "$N" -ge 8 ]; then + atf_skip "Could not create a ${CLASS} interface" + else + N=$(($N + 1)) + fi + done + local DEV=${CLASS}${N} + # Record the device so we can clean it up later + echo ${DEV} >> "devices_to_cleanup" + echo ${DEV} +} + + +cleanup_ifaces() +{ + local DEV + + for DEV in `cat "devices_to_cleanup"`; do + if [ ${DEV%%[0-9]*a} = "epair" ]; then + ifconfig ${DEV}a destroy + else + ifconfig ${DEV} destroy + fi + done + true +} Added: head/tests/sys/net/if_lagg_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/net/if_lagg_test.sh Fri Feb 23 18:18:42 2018 (r329874) @@ -0,0 +1,466 @@ +# +# Copyright (c) 2014 Spectra Logic Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer, +# without modification. +# 2. Redistributions in binary form must reproduce at minimum a disclaimer +# substantially similar to the "NO WARRANTY" disclaimer below +# ("Disclaimer") and any redistribution must be conditioned upon +# including a substantially similar Disclaimer requirement for further +# binary redistribution. +# +# NO WARRANTY +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGES. +# +# Authors: Alan Somers (Spectra Logic Corporation) +# +# $FreeBSD$ + +atf_test_case create cleanup +create_head() +{ + atf_set "descr" "Create a lagg and assign an address" + atf_set "require.user" "root" +} +create_body() +{ + local TAP0 TAP1 LAGG MAC + + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + + TAP0=`get_tap` + TAP1=`get_tap` + LAGG=`get_lagg` + + # Create the lagg + ifconfig $TAP0 up + ifconfig $TAP1 up + atf_check ifconfig $LAGG up laggport $TAP0 laggport $TAP1 \ + ${ADDR}/${MASK} + atf_check -o match:"inet ${ADDR}" ifconfig $LAGG + atf_check -o match:"laggport: ${TAP0}" ifconfig $LAGG + atf_check -o match:"laggport: ${TAP1}" ifconfig $LAGG + + # Check that all members have the same MAC + MAC=`ifconfig $LAGG | awk '/ether/ {print $2}'` + atf_check -o match:"ether ${MAC}" ifconfig $TAP0 + atf_check -o match:"ether ${MAC}" ifconfig $TAP1 + + # Check that no members have an IPv6 link-local address. IPv6 + # link-local addresses should never be merged in any way to prevent + # scope violation. + atf_check -o not-match:"inet6 fe80:" ifconfig $TAP0 + atf_check -o not-match:"inet6 fe80:" ifconfig $TAP1 +} +create_cleanup() +{ + cleanup_tap_and_lagg +} + +atf_test_case status_stress cleanup +status_stress_head() +{ + atf_set "descr" "Simultaneously query a lagg while also creating or destroying it." + atf_set "require.user" "root" +} +status_stress_body() +{ + local TAP0 TAP1 LAGG MAC + + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + + TAP0=`get_tap` + TAP1=`get_tap` + TAP2=`get_tap` + TAP3=`get_tap` + LAGG=`get_lagg` + + # Up the lagg's children + ifconfig $TAP0 inet6 ifdisabled up + ifconfig $TAP1 inet6 ifdisabled up + ifconfig $TAP2 inet6 ifdisabled up + ifconfig $TAP3 inet6 ifdisabled up + + # First thread: create and destroy the lagg + while true; do + ifconfig $LAGG destroy 2>&1 + ifconfig $LAGG create 2>/dev/null + ifconfig $LAGG inet6 ifdisabled + ifconfig $LAGG up laggport $TAP0 laggport $TAP1 laggport $TAP2\ + laggport $TAP3 ${ADDR}/${MASK} 2>/dev/null + echo -n . >> creator_count.txt + done & + CREATOR_PID=$! + + # Second thread: Query the lagg's status + while true; do + ifconfig -am 2> /dev/null > /dev/null + echo -n . >> querier_count.txt + done & + QUERIER_PID=$! + + sleep 60 + kill $CREATOR_PID + kill $QUERIER_PID + echo "Created the lagg `stat -f %z creator_count.txt` times." + echo "Queried its status `stat -f %z querier_count.txt` times" +} +status_stress_cleanup() +{ + cleanup_tap_and_lagg +} + +atf_test_case create_destroy_stress cleanup +create_destroy_stress_head() +{ + atf_set "descr" "Simultaneously create and destroy a lagg" + atf_set "require.user" "root" +} +create_destroy_stress_body() +{ + local TAP0 TAP1 LAGG MAC + + atf_skip "Skipping this test because it easily panics the machine" + + TAP0=`get_tap` + TAP1=`get_tap` + TAP2=`get_tap` + TAP3=`get_tap` + LAGG=`get_lagg` + + # Up the lagg's children + ifconfig $TAP0 inet6 ifdisabled up + ifconfig $TAP1 inet6 ifdisabled up + ifconfig $TAP2 inet6 ifdisabled up + ifconfig $TAP3 inet6 ifdisabled up + + # First thread: create the lagg + while true; do + ifconfig $LAGG create 2>/dev/null && \ + echo -n . >> creator_count.txt + done & + CREATOR_PID=$! + + # Second thread: destroy the lagg + while true; do + ifconfig $LAGG destroy 2>/dev/null && \ + echo -n . >> destroyer_count.txt + done & + DESTROYER_PID=$! + + sleep 60 + kill $CREATOR_PID + kill $DESTROYER_PID + echo "Created the lagg `stat -f %z creator_count.txt` times." + echo "Destroyed it `stat -f %z destroyer_count.txt` times." +} +create_destroy_stress_cleanup() +{ + cleanup_tap_and_lagg +} + +# This test regresses a panic that is particular to LACP. If the child's link +# state changes while the lagg is being destroyed, lacp_linkstate can +# use-after-free. The problem is compounded by two factors: +# 1) In SpectraBSD, downing the parent will also down the child +# 2) The cxgbe driver will show the link state as "no carrier" as soon as you +# down the interface. +# TeamTrack: P2_30328 +atf_test_case lacp_linkstate_destroy_stress cleanup +lacp_linkstate_destroy_stress_head() +{ + atf_set "descr" "Simultaneously destroy an LACP lagg and change its childrens link states" + atf_set "require.user" "root" +} +lacp_linkstate_destroy_stress_body() +{ + local TAP0 TAP1 LAGG MAC SRCDIR + + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + # ifconfig takes about 10ms to run. To increase race coverage, + # randomly delay the two commands relative to each other by 5ms either + # way. + MEAN_SLEEP_SECONDS=.005 + MAX_SLEEP_USECS=10000 + + TAP0=`get_tap` + TAP1=`get_tap` + LAGG=`get_lagg` + + # Up the lagg's children + ifconfig $TAP0 inet6 ifdisabled up + ifconfig $TAP1 inet6 ifdisabled up + + SRCDIR=$( atf_get_srcdir ) + while true; do + ifconfig $LAGG inet6 ifdisabled + # We must open the tap devices to change their link states + cat /dev/$TAP0 > /dev/null & + CAT0_PID=$! + cat /dev/$TAP1 > /dev/null & + CAT1_PID=$! + ifconfig $LAGG up laggport $TAP0 laggport $TAP1 \ + ${ADDR}/${MASK} 2> /dev/null && + { sleep ${MEAN_SLEEP_SECONDS} && \ + kill $CAT0_PID && + kill $CAT1_PID && + echo -n . >> linkstate_count.txt ; } & + { ${SRCDIR}/randsleep ${MAX_SLEEP_USECS} && \ + ifconfig $LAGG destroy && + echo -n . >> destroy_count.txt ; } & + wait + ifconfig $LAGG create + done & + LOOP_PID=$! + + sleep 60 + kill $LOOP_PID + echo "Disconnected the children `stat -f %z linkstate_count.txt` times." + echo "Destroyed the lagg `stat -f %z destroy_count.txt` times." +} +lacp_linkstate_destroy_stress_cleanup() +{ + cleanup_tap_and_lagg +} + +atf_test_case up_destroy_stress cleanup +up_destroy_stress_head() +{ + atf_set "descr" "Simultaneously up and destroy a lagg" + atf_set "require.user" "root" +} +up_destroy_stress_body() +{ + local TAP0 TAP1 LAGG MAC SRCDIR + + atf_skip "Skipping this test because it panics the machine fairly often" + + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + # ifconfig takes about 10ms to run. To increase race coverage, + # randomly delay the two commands relative to each other by 5ms either + # way. + MEAN_SLEEP_SECONDS=.005 + MAX_SLEEP_USECS=10000 + + TAP0=`get_tap` + TAP1=`get_tap` + TAP2=`get_tap` + TAP3=`get_tap` + LAGG=`get_lagg` + + # Up the lagg's children + ifconfig $TAP0 inet6 ifdisabled up + ifconfig $TAP1 inet6 ifdisabled up + ifconfig $TAP2 inet6 ifdisabled up + ifconfig $TAP3 inet6 ifdisabled up + + SRCDIR=$( atf_get_srcdir ) + while true; do + ifconfig $LAGG inet6 ifdisabled + { sleep ${MEAN_SLEEP_SECONDS} && \ + ifconfig $LAGG up laggport $TAP0 laggport $TAP1 \ + laggport $TAP2 laggport $TAP3 \ + ${ADDR}/${MASK} 2> /dev/null && + echo -n . >> up_count.txt ; } & + { ${SRCDIR}/randsleep ${MAX_SLEEP_USECS} && \ + ifconfig $LAGG destroy && + echo -n . >> destroy_count.txt ; } & + wait + ifconfig $LAGG create + done & + LOOP_PID=$! + + sleep 60 + kill $LOOP_PID + echo "Upped the lagg `stat -f %z up_count.txt` times." + echo "Destroyed it `stat -f %z destroy_count.txt` times." +} +up_destroy_stress_cleanup() +{ + cleanup_tap_and_lagg +} + +atf_test_case set_ether cleanup +set_ether_head() +{ + atf_set "descr" "Set a lagg's ethernet address" + atf_set "require.user" "root" +} +set_ether_body() +{ + local TAP0 TAP1 LAGG MAC + + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + MAC="00:11:22:33:44:55" + + TAP0=`get_tap` + TAP1=`get_tap` + LAGG=`get_lagg` + + # Create the lagg + ifconfig $TAP0 up + ifconfig $TAP1 up + atf_check ifconfig $LAGG up laggport $TAP0 laggport $TAP1 \ + ${ADDR}/${MASK} + + # Change the lagg's ethernet address + atf_check ifconfig $LAGG ether ${MAC} + + # Check that all members have the same MAC + atf_check -o match:"ether ${MAC}" ifconfig $LAGG + atf_check -o match:"ether ${MAC}" ifconfig $TAP0 + atf_check -o match:"ether ${MAC}" ifconfig $TAP1 +} +set_ether_cleanup() +{ + cleanup_tap_and_lagg +} + +atf_test_case updown cleanup +updown_head() +{ + atf_set "descr" "upping or downing a lagg ups or downs its children" + atf_set "require.user" "root" +} +updown_body() +{ + local TAP0 TAP1 LAGG MAC + + atf_expect_fail "PR 226144 Upping a lagg interrface should automatically up its children" + # Configure the lagg interface to use an RFC5737 nonrouteable addresses + ADDR="192.0.2.2" + MASK="24" + MAC="00:11:22:33:44:55" + + TAP0=`get_tap` + TAP1=`get_tap` + LAGG=`get_lagg` + + # Create the lagg + ifconfig $TAP0 up + ifconfig $TAP1 up + atf_check ifconfig $LAGG up laggport $TAP0 laggport $TAP1 \ + ${ADDR}/${MASK} + + # Down the lagg + ifconfig $LAGG down + atf_check -o not-match:"flags=.*\" ifconfig $LAGG + atf_check -o not-match:"flags=.*\" ifconfig $TAP0 + atf_check -o not-match:"flags=.*\" ifconfig $TAP1 + # Up the lagg again + ifconfig $LAGG up + atf_check -o match:"flags=.*\" ifconfig $LAGG + atf_check -o match:"flags=.*\" ifconfig $TAP0 + atf_check -o match:"flags=.*\" ifconfig $TAP1 + + # Check that no members have acquired an IPv6 link-local address by + # virtue of being upped. IPv6 link-local addresses should never be + # merged in any way to prevent scope violation. + atf_check -o not-match:"inet6 fe80:" ifconfig $TAP0 + atf_check -o not-match:"inet6 fe80:" ifconfig $TAP1 +} +updown_cleanup() +{ + cleanup_tap_and_lagg +} + +# Check for lock-order reversals. For best results, this test should be run +# last. +atf_test_case witness +witness_head() +{ + atf_set "descr" "Check witness(4) for lock-order reversals in if_lagg" +} +witness_body() +{ + if [ `sysctl -n debug.witness.watch` -ne 1 ]; then + atf_skip "witness(4) is not enabled" + fi + if `sysctl -n debug.witness.badstacks | grep -q 'at lagg_'`; then + sysctl debug.witness.badstacks + atf_fail "Lock-order reversals involving if_lagg.c detected" + fi +} + +atf_init_test_cases() +{ + atf_add_test_case create + atf_add_test_case create_destroy_stress + atf_add_test_case lacp_linkstate_destroy_stress + atf_add_test_case set_ether + atf_add_test_case status_stress + atf_add_test_case up_destroy_stress + atf_add_test_case updown + # For best results, keep the witness test last + atf_add_test_case witness +} + + +# Creates a new tap(4) interface, registers it for cleanup, and echoes it +get_tap() +{ + local TAPN=0 + while ! ifconfig tap${TAPN} create > /dev/null 2>&1; do + if [ "$TAPN" -ge 8 ]; then + atf_skip "Could not create a tap(4) interface" + else + TAPN=$(($TAPN + 1)) + fi + done + local TAPD=tap${TAPN} + # Record the TAP device so we can clean it up later + echo ${TAPD} >> "devices_to_cleanup" + echo ${TAPD} +} + +# Creates a new lagg(4) interface, registers it for cleanup, and echoes it +get_lagg() +{ + local LAGGN=0 + while ! ifconfig lagg${LAGGN} create > /dev/null 2>&1; do + if [ "$LAGGN" -ge 8 ]; then + atf_skip "Could not create a lagg(4) interface" + else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Feb 23 18:26:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 759F8F0FB1E; Fri, 23 Feb 2018 18:26:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21F826EAC1; Fri, 23 Feb 2018 18:26:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1875C1A18C; Fri, 23 Feb 2018 18:26:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NIQV8c084973; Fri, 23 Feb 2018 18:26:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NIQVqr084972; Fri, 23 Feb 2018 18:26:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802231826.w1NIQVqr084972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Feb 2018 18:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329875 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 18:26:32 -0000 Author: kib Date: Fri Feb 23 18:26:31 2018 New Revision: 329875 URL: https://svnweb.freebsd.org/changeset/base/329875 Log: Restore UP build. Reviewed by: truckman Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri Feb 23 18:18:42 2018 (r329874) +++ head/sys/kern/sched_ule.c Fri Feb 23 18:26:31 2018 (r329875) @@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio) td->td_flags |= TDF_NEEDRESCHED; } +#ifdef SMP /* * This tdq is about to idle. Try to steal a thread from another CPU before * choosing the idle thread. @@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq) } spinlock_exit(); } +#endif /* * Handle migration from sched_switch(). This happens only for @@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd, TDQ_LOCK(tdq); mtx = thread_lock_block(td); tdq_load_rem(tdq, td); +#ifdef SMP if (tdq->tdq_load == 0) tdq_trysteal(tdq); +#endif } #if (KTR_COMPILE & KTR_SCHED) != 0 From owner-svn-src-all@freebsd.org Fri Feb 23 19:00:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6285BF12B2B; Fri, 23 Feb 2018 19:00:40 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDF9A70750; Fri, 23 Feb 2018 19:00:39 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f46.google.com with SMTP id 70so13778308lfw.2; Fri, 23 Feb 2018 11:00:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dC9uw/9X/cg6x+QoqJW33aeu9dr3Tt5UY0kTp6LJymY=; b=WJUS/YqOCiZ+rmCQB8+C2+J9kp344c8elcZgThlshnbOYlErw6vj7dxH4jS1RPMcaH w615i7tzd2V2mOI2rvRAE+zYkhasJ8ZESFW9UToOYuhdoJxC/Y8LvHDPpQRuQyq43Z7W d1yYzDJlFNnhTwBcX6JAPOA5x0TAYFlkPUJJl7XqRalnWitejW+SiNs11hMpwuzrZd5b T9MsOzhrlG1Z3EbXPTWLJSnNyAmVGhDj9CA/zkb88wgg1YKm/qtbQpaBDspYRty3yyDT o7zhh/Ax/KZRVCl8bGy1RGcpZZnP0YAAvFZY2dl6v/K/+sTd2LPW/UUONXSUNK1VdCEn QK2Q== X-Gm-Message-State: APf1xPDlipb2uFGsEOkfYTub+X9ddqts/P5JXBxhhUJf3hkcvniJOMTL lCvei5UtVLq4dOV8RG3A3R0YvNPW X-Google-Smtp-Source: AG47ELvIRAYWb3JZwxaj5ecbIFj6tOkL+JZM3nEf3KIFH1ezBqWN1xcsw05t2t2Geq8KrIBscswbMQ== X-Received: by 10.25.84.207 with SMTP id b76mr2022457lfl.29.1519412431753; Fri, 23 Feb 2018 11:00:31 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id b27sm595205ljb.84.2018.02.23.11.00.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 11:00:30 -0800 (PST) Subject: Re: svn commit: r329865 - svnadmin/conf To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org References: <201802231604.w1NG4iHL013787@repo.freebsd.org> From: Andriy Gapon Message-ID: Date: Fri, 23 Feb 2018 21:00:29 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201802231604.w1NG4iHL013787@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 19:00:40 -0000 On 23/02/2018 18:04, Alan Somers wrote: > Author: asomers > Date: Fri Feb 23 16:04:44 2018 > New Revision: 329865 > URL: https://svnweb.freebsd.org/changeset/base/329865 > > Log: > Add myself to sizelimits, for the ZFS test suite import Hyper excited! :-) > Modified: > svnadmin/conf/sizelimit.conf > -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Feb 23 19:09:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36FC3F135CD; Fri, 23 Feb 2018 19:09:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DDFE270E04; Fri, 23 Feb 2018 19:09:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8E901A7F8; Fri, 23 Feb 2018 19:09:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NJ9R7w005236; Fri, 23 Feb 2018 19:09:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NJ9RW5005235; Fri, 23 Feb 2018 19:09:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802231909.w1NJ9RW5005235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Feb 2018 19:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329876 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 329876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 19:09:28 -0000 Author: emaste Date: Fri Feb 23 19:09:27 2018 New Revision: 329876 URL: https://svnweb.freebsd.org/changeset/base/329876 Log: Use linux types for linux-specific syscalls Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14065 Modified: head/sys/amd64/linux/syscalls.master Modified: head/sys/amd64/linux/syscalls.master ============================================================================== --- head/sys/amd64/linux/syscalls.master Fri Feb 23 18:26:31 2018 (r329875) +++ head/sys/amd64/linux/syscalls.master Fri Feb 23 19:09:27 2018 (r329876) @@ -58,8 +58,8 @@ 9 AUE_MMAP STD { int linux_mmap2(l_ulong addr, l_ulong len, \ l_ulong prot, l_ulong flags, l_ulong fd, \ l_ulong pgoff); } -10 AUE_MPROTECT STD { int linux_mprotect(caddr_t addr, int len, \ - int prot); } +10 AUE_MPROTECT STD { int linux_mprotect(caddr_t addr, l_int len, \ + l_int prot); } 11 AUE_MUNMAP NOPROTO { int munmap(caddr_t addr, int len); } 12 AUE_NULL STD { int linux_brk(l_ulong dsend); } 13 AUE_NULL STD { int linux_rt_sigaction(l_int sig, \ @@ -115,7 +115,7 @@ struct l_itimerval *itv, \ struct l_itimerval *oitv); } 39 AUE_GETPID STD { int linux_getpid(void); } -40 AUE_SENDFILE STD { int linux_sendfile(int out, int in, \ +40 AUE_SENDFILE STD { int linux_sendfile(l_int out, l_int in, \ l_long *offset, l_size_t count); } 41 AUE_SOCKET STD { int linux_socket(l_int domain, l_int type, \ l_int protocol); } @@ -150,12 +150,12 @@ l_int optname, l_uintptr_t optval, \ l_uintptr_t optlen); } 56 AUE_RFORK STD { int linux_clone(l_int flags, void *stack, \ - void *parent_tidptr, void * child_tidptr, void *tls ); } + void *parent_tidptr, void *child_tidptr, void *tls); } 57 AUE_FORK STD { int linux_fork(void); } 58 AUE_VFORK STD { int linux_vfork(void); } 59 AUE_EXECVE STD { int linux_execve(char *path, char **argp, \ char **envp); } -60 AUE_EXIT STD { void linux_exit(int rval); } +60 AUE_EXIT STD { void linux_exit(l_int rval); } 61 AUE_WAIT4 STD { int linux_wait4(l_pid_t pid, \ l_int *status, l_int options, \ struct rusage *rusage); } @@ -281,7 +281,7 @@ struct l_statfs_buf *buf); } 139 AUE_NULL STD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -140 AUE_GETPRIORITY STD { int linux_getpriority(int which, int who); } +140 AUE_GETPRIORITY STD { int linux_getpriority(l_int which, l_int who); } 141 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \ int prio); } 142 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ @@ -359,10 +359,10 @@ 197 AUE_NULL STD { int linux_removexattr(void); } 198 AUE_NULL STD { int linux_lremovexattr(void); } 199 AUE_NULL STD { int linux_fremovexattr(void); } -200 AUE_NULL STD { int linux_tkill(int tid, int sig); } +200 AUE_NULL STD { int linux_tkill(l_int tid, l_int sig); } 201 AUE_NULL STD { int linux_time(l_time_t *tm); } -202 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } +202 AUE_NULL STD { int linux_sys_futex(void *uaddr, l_int op, l_int val, \ + struct l_timespec *timeout, void *uaddr2, l_int val3); } 203 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ l_ulong *user_mask_ptr); } 204 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ @@ -381,11 +381,11 @@ 216 AUE_NULL STD { int linux_remap_file_pages(void); } 217 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } -218 AUE_NULL STD { int linux_set_tid_address(int *tidptr); } +218 AUE_NULL STD { int linux_set_tid_address(l_int *tidptr); } 219 AUE_NULL UNIMPL restart_syscall 220 AUE_NULL STD { int linux_semtimedop(void); } -221 AUE_NULL STD { int linux_fadvise64(int fd, l_loff_t offset, \ - l_size_t len, int advice); } +221 AUE_NULL STD { int linux_fadvise64(l_int fd, l_loff_t offset, \ + l_size_t len, l_int advice); } 222 AUE_NULL STD { int linux_timer_create(clockid_t clock_id, \ struct sigevent *evp, l_timer_t *timerid); } 223 AUE_NULL STD { int linux_timer_settime(l_timer_t timerid, l_int flags, \ @@ -398,12 +398,12 @@ 229 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); } 230 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ struct l_timespec *rqtp, struct l_timespec *rmtp); } -231 AUE_EXIT STD { int linux_exit_group(int error_code); } +231 AUE_EXIT STD { int linux_exit_group(l_int error_code); } 232 AUE_NULL STD { int linux_epoll_wait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout); } 233 AUE_NULL STD { int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \ struct epoll_event *event); } -234 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } +234 AUE_NULL STD { int linux_tgkill(l_int tgid, l_int pid, l_int sig); } 235 AUE_UTIMES STD { int linux_utimes(char *fname, \ struct l_timeval *tptr); } 236 AUE_NULL UNIMPL vserver @@ -417,8 +417,8 @@ 244 AUE_NULL STD { int linux_mq_notify(void); } 245 AUE_NULL STD { int linux_mq_getsetattr(void); } 246 AUE_NULL STD { int linux_kexec_load(void); } -247 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ - l_siginfo_t *info, int options, \ +247 AUE_WAIT6 STD { int linux_waitid(l_int idtype, l_pid_t id, \ + l_siginfo_t *info, l_int options, \ struct rusage *rusage); } 248 AUE_NULL STD { int linux_add_key(void); } 249 AUE_NULL STD { int linux_request_key(void); } From owner-svn-src-all@freebsd.org Fri Feb 23 20:01:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3396F17E81; Fri, 23 Feb 2018 20:01:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3AA7575B; Fri, 23 Feb 2018 20:01:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 764271B1AD; Fri, 23 Feb 2018 20:01:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NK1ggB037795; Fri, 23 Feb 2018 20:01:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NK1g0G037793; Fri, 23 Feb 2018 20:01:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802232001.w1NK1g0G037793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Feb 2018 20:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329877 - head/sys/dev/isci/scil X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/isci/scil X-SVN-Commit-Revision: 329877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:01:43 -0000 Author: emaste Date: Fri Feb 23 20:01:42 2018 New Revision: 329877 URL: https://svnweb.freebsd.org/changeset/base/329877 Log: Correct typo in ATA_WRITE_UNCORRECTABLE_PSEUDO Also correct a typo in the comment for these values, noted by jimharris. Reviewed by: jimharris Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3715 Modified: head/sys/dev/isci/scil/intel_ata.h head/sys/dev/isci/scil/sati_write_long.c Modified: head/sys/dev/isci/scil/intel_ata.h ============================================================================== --- head/sys/dev/isci/scil/intel_ata.h Fri Feb 23 19:09:27 2018 (r329876) +++ head/sys/dev/isci/scil/intel_ata.h Fri Feb 23 20:01:42 2018 (r329877) @@ -301,13 +301,13 @@ /*@}*/ /** - * @name ATA_WRITE_UNCORRECTIABLE feature field values + * @name ATA_WRITE_UNCORRECTABLE feature field values * * These constants define the Write Uncorrectable feature values * used with the SATI translation. */ /*@{*/ -#define ATA_WRITE_UNCORRECTABLE_PSUEDO 0x55 +#define ATA_WRITE_UNCORRECTABLE_PSEUDO 0x55 #define ATA_WRITE_UNCORRECTABLE_FLAGGED 0xAA /*@}*/ Modified: head/sys/dev/isci/scil/sati_write_long.c ============================================================================== --- head/sys/dev/isci/scil/sati_write_long.c Fri Feb 23 19:09:27 2018 (r329876) +++ head/sys/dev/isci/scil/sati_write_long.c Fri Feb 23 20:01:42 2018 (r329877) @@ -176,7 +176,7 @@ SATI_STATUS sati_write_long_translate_command( sati_ata_write_uncorrectable_construct( ata_io, sequence, - ATA_WRITE_UNCORRECTABLE_PSUEDO + ATA_WRITE_UNCORRECTABLE_PSEUDO ); sequence->type = SATI_SEQUENCE_WRITE_LONG; status = SATI_SUCCESS; @@ -188,7 +188,7 @@ SATI_STATUS sati_write_long_translate_command( sati_ata_write_uncorrectable_construct( ata_io, sequence, - ATA_WRITE_UNCORRECTABLE_PSUEDO + ATA_WRITE_UNCORRECTABLE_PSEUDO ); sequence->type = SATI_SEQUENCE_WRITE_LONG; status = SATI_SUCCESS; From owner-svn-src-all@freebsd.org Fri Feb 23 20:15:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AA8AF18E76; Fri, 23 Feb 2018 20:15:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1710F7627C; Fri, 23 Feb 2018 20:15:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 118D71B3C8; Fri, 23 Feb 2018 20:15:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NKFKrf043805; Fri, 23 Feb 2018 20:15:20 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NKFJUe043792; Fri, 23 Feb 2018 20:15:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802232015.w1NKFJUe043792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Feb 2018 20:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329878 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include crypto/aesni crypto/armv8 crypto/via dev/efidev dev/random i386/i386 i386/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include crypto/aesni crypto/armv8 crypto/via dev/efidev dev/random i386/i386 i386/include X-SVN-Commit-Revision: 329878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:15:21 -0000 Author: cem Date: Fri Feb 23 20:15:19 2018 New Revision: 329878 URL: https://svnweb.freebsd.org/changeset/base/329878 Log: Remove unused error return from API that cannot fail No implementation of fpu_kern_enter() can fail, and it was causing needless error checking boilerplate and confusion. Change the return code to void to match reality. (This trivial change took nine days to land because of the commit hook on sys/dev/random. Please consider removing the hook or otherwise lowering the bar -- secteam never seems to have free time to review patches.) Reported by: Lachlan McIlroy Reviewed by: delphij Approved by: secteam (delphij) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14380 Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/include/fpu.h head/sys/arm64/arm64/vfp.c head/sys/arm64/include/vfp.h head/sys/crypto/aesni/aesni.c head/sys/crypto/armv8/armv8_crypto.c head/sys/crypto/via/padlock.c head/sys/crypto/via/padlock_cipher.c head/sys/crypto/via/padlock_hash.c head/sys/dev/efidev/efirt.c head/sys/dev/random/nehemiah.c head/sys/i386/i386/npx.c head/sys/i386/include/npx.h Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/amd64/amd64/fpu.c Fri Feb 23 20:15:19 2018 (r329878) @@ -965,7 +965,7 @@ fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx) return ((struct savefpu *)p); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -997,11 +997,11 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx fpurestore(fpu_initialstate); set_pcb_flags(pcb, PCB_KERNFPU | PCB_FPUNOSAVE | PCB_FPUINITDONE); - return (0); + return; } if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); @@ -1013,7 +1013,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); - return (0); + return; } int Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/amd64/include/fpu.h Fri Feb 23 20:15:19 2018 (r329878) @@ -72,7 +72,7 @@ int fputrap_x87(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); -int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); int fpu_kern_thread(u_int flags); Modified: head/sys/arm64/arm64/vfp.c ============================================================================== --- head/sys/arm64/arm64/vfp.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/arm64/arm64/vfp.c Fri Feb 23 20:15:19 2018 (r329878) @@ -256,7 +256,7 @@ fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) free(ctx, M_FPUKERN_CTX); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -279,12 +279,12 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx vfp_enable(); pcb->pcb_fpflags |= PCB_FP_KERN | PCB_FP_NOSAVE | PCB_FP_STARTED; - return (0); + return; } if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } /* * Check either we are already using the VFP in the kernel, or @@ -300,7 +300,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_fpflags |= PCB_FP_KERN; pcb->pcb_fpflags &= ~PCB_FP_STARTED; - return (0); + return; } int Modified: head/sys/arm64/include/vfp.h ============================================================================== --- head/sys/arm64/include/vfp.h Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/arm64/include/vfp.h Fri Feb 23 20:15:19 2018 (r329878) @@ -60,7 +60,7 @@ struct fpu_kern_ctx; struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int); void fpu_kern_free_ctx(struct fpu_kern_ctx *); -int fpu_kern_enter(struct thread *, struct fpu_kern_ctx *, u_int); +void fpu_kern_enter(struct thread *, struct fpu_kern_ctx *, u_int); int fpu_kern_leave(struct thread *, struct fpu_kern_ctx *); int fpu_kern_thread(u_int); int is_fpu_kern_thread(u_int); Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/crypto/aesni/aesni.c Fri Feb 23 20:15:19 2018 (r329878) @@ -577,10 +577,8 @@ aesni_cipher_setup(struct aesni_session *ses, struct c kt = is_fpu_kern_thread(0) || (encini == NULL); if (!kt) { ACQUIRE_CTX(ctxidx, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out; } error = 0; @@ -590,7 +588,6 @@ aesni_cipher_setup(struct aesni_session *ses, struct c if (!kt) { fpu_kern_leave(curthread, ctx); -out: RELEASE_CTX(ctxidx, ctx); } return (error); @@ -730,10 +727,8 @@ aesni_cipher_process(struct aesni_session *ses, struct kt = is_fpu_kern_thread(0); if (!kt) { ACQUIRE_CTX(ctxidx, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out2; } /* Do work */ @@ -761,7 +756,6 @@ aesni_cipher_process(struct aesni_session *ses, struct out: if (!kt) { fpu_kern_leave(curthread, ctx); -out2: RELEASE_CTX(ctxidx, ctx); } return (error); Modified: head/sys/crypto/armv8/armv8_crypto.c ============================================================================== --- head/sys/crypto/armv8/armv8_crypto.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/crypto/armv8/armv8_crypto.c Fri Feb 23 20:15:19 2018 (r329878) @@ -467,7 +467,7 @@ armv8_crypto_cipher_process(struct armv8_crypto_sessio struct fpu_kern_ctx *ctx; uint8_t *buf; uint8_t iv[AES_BLOCK_LEN]; - int allocated, error, i; + int allocated, i; int encflag, ivlen; int kt; @@ -477,15 +477,11 @@ armv8_crypto_cipher_process(struct armv8_crypto_sessio if (buf == NULL) return (ENOMEM); - error = 0; - kt = is_fpu_kern_thread(0); if (!kt) { AQUIRE_CTX(i, ctx); - error = fpu_kern_enter(curthread, ctx, + fpu_kern_enter(curthread, ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error != 0) - goto out; } if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) { @@ -534,14 +530,13 @@ armv8_crypto_cipher_process(struct armv8_crypto_sessio if (!kt) { fpu_kern_leave(curthread, ctx); -out: RELEASE_CTX(i, ctx); } if (allocated) { bzero(buf, enccrd->crd_len); free(buf, M_ARMV8_CRYPTO); } - return (error); + return (0); } static device_method_t armv8_crypto_methods[] = { Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/crypto/via/padlock.c Fri Feb 23 20:15:19 2018 (r329878) @@ -246,12 +246,10 @@ padlock_newsession(device_t dev, uint32_t *sidp, struc if (macini != NULL) { td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); - if (error == 0) { - error = padlock_hash_setup(ses, macini); - fpu_kern_leave(td, ses->ses_fpu_ctx); - } + error = padlock_hash_setup(ses, macini); + fpu_kern_leave(td, ses->ses_fpu_ctx); if (error != 0) { padlock_freesession_one(sc, ses, 0); return (error); Modified: head/sys/crypto/via/padlock_cipher.c ============================================================================== --- head/sys/crypto/via/padlock_cipher.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/crypto/via/padlock_cipher.c Fri Feb 23 20:15:19 2018 (r329878) @@ -205,7 +205,7 @@ padlock_cipher_process(struct padlock_session *ses, st struct thread *td; u_char *buf, *abuf; uint32_t *key; - int allocated, error; + int allocated; buf = padlock_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) @@ -250,10 +250,7 @@ padlock_cipher_process(struct padlock_session *ses, st } td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); - if (error != 0) - goto out; + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); padlock_cbc(abuf, abuf, enccrd->crd_len / AES_BLOCK_LEN, key, cw, ses->ses_iv); fpu_kern_leave(td, ses->ses_fpu_ctx); @@ -270,10 +267,9 @@ padlock_cipher_process(struct padlock_session *ses, st AES_BLOCK_LEN, ses->ses_iv); } - out: if (allocated) { bzero(buf, enccrd->crd_len + 16); free(buf, M_PADLOCK); } - return (error); + return (0); } Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/crypto/via/padlock_hash.c Fri Feb 23 20:15:19 2018 (r329878) @@ -377,10 +377,7 @@ padlock_hash_process(struct padlock_session *ses, stru int error; td = curthread; - error = fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); - if (error != 0) - return (error); + fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/dev/efidev/efirt.c Fri Feb 23 20:15:19 2018 (r329878) @@ -194,7 +194,6 @@ efi_enter(void) { struct thread *td; pmap_t curpmap; - int error; if (efi_runtime == NULL) return (ENXIO); @@ -202,12 +201,7 @@ efi_enter(void) curpmap = &td->td_proc->p_vmspace->vm_pmap; PMAP_LOCK(curpmap); mtx_lock(&efi_lock); - error = fpu_kern_enter(td, NULL, FPU_KERN_NOCTX); - if (error != 0) { - PMAP_UNLOCK(curpmap); - return (error); - } - + fpu_kern_enter(td, NULL, FPU_KERN_NOCTX); return (efi_arch_enter()); } Modified: head/sys/dev/random/nehemiah.c ============================================================================== --- head/sys/dev/random/nehemiah.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/dev/random/nehemiah.c Fri Feb 23 20:15:19 2018 (r329878) @@ -101,17 +101,14 @@ random_nehemiah_read(void *buf, u_int c) size_t count, ret; uint64_t tmp; - if ((fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL) == 0)) { - b = buf; - for (count = c; count > 0; count -= ret) { - ret = MIN(VIA_RNG_store(&tmp), count); - memcpy(b, &tmp, ret); - b += ret; - } - fpu_kern_leave(curthread, fpu_ctx_save); + fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL); + b = buf; + for (count = c; count > 0; count -= ret) { + ret = MIN(VIA_RNG_store(&tmp), count); + memcpy(b, &tmp, ret); + b += ret; } - else - c = 0; + fpu_kern_leave(curthread, fpu_ctx_save); return (c); } Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/i386/i386/npx.c Fri Feb 23 20:15:19 2018 (r329878) @@ -1325,7 +1325,7 @@ fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx) return ((union savefpu *)p); } -int +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; @@ -1334,7 +1334,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; - return (0); + return; } pcb = td->td_pcb; KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == @@ -1347,7 +1347,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); pcb->pcb_flags |= PCB_KERNNPX; pcb->pcb_flags &= ~PCB_NPXINITDONE; - return (0); + return; } int Modified: head/sys/i386/include/npx.h ============================================================================== --- head/sys/i386/include/npx.h Fri Feb 23 20:01:42 2018 (r329877) +++ head/sys/i386/include/npx.h Fri Feb 23 20:15:19 2018 (r329878) @@ -76,7 +76,7 @@ void npx_set_fpregs_xmm(struct save87 *, struct savexm struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); -int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, +void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); int fpu_kern_thread(u_int flags); From owner-svn-src-all@freebsd.org Fri Feb 23 20:18:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB086F1A251; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6016976538; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B15B1B3DC; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NKIATa043962; Fri, 23 Feb 2018 20:18:10 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NKI9Hc043953; Fri, 23 Feb 2018 20:18:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802232018.w1NKI9Hc043953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Feb 2018 20:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329879 - in head/stand: libsa userboot/userboot zfs X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: libsa userboot/userboot zfs X-SVN-Commit-Revision: 329879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:18:11 -0000 Author: cem Date: Fri Feb 23 20:18:09 2018 New Revision: 329879 URL: https://svnweb.freebsd.org/changeset/base/329879 Log: libsa: Const-ify buffer argument of write(2) analog Reported by: kevans Reviewed by: delphij, eadler, imp, kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14482 Modified: head/stand/libsa/cd9660.c head/stand/libsa/nfs.c head/stand/libsa/nullfs.c head/stand/libsa/stand.h head/stand/libsa/tftp.c head/stand/libsa/ufs.c head/stand/libsa/write.c head/stand/userboot/userboot/host.c head/stand/zfs/zfs.c Modified: head/stand/libsa/cd9660.c ============================================================================== --- head/stand/libsa/cd9660.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/cd9660.c Fri Feb 23 20:18:09 2018 (r329879) @@ -66,7 +66,7 @@ static int cd9660_open(const char *path, struct open_f static int cd9660_close(struct open_file *f); static int cd9660_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int cd9660_write(struct open_file *f, void *buf, size_t size, +static int cd9660_write(struct open_file *f, const void *buf, size_t size, size_t *resid); static off_t cd9660_seek(struct open_file *f, off_t offset, int where); static int cd9660_stat(struct open_file *f, struct stat *sb); @@ -557,7 +557,8 @@ again: } static int -cd9660_write(struct open_file *f __unused, void *start __unused, size_t size __unused, size_t *resid __unused) +cd9660_write(struct open_file *f __unused, const void *buf __unused, + size_t size __unused, size_t *resid __unused) { return EROFS; } Modified: head/stand/libsa/nfs.c ============================================================================== --- head/stand/libsa/nfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/nfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -126,7 +126,6 @@ struct nfs_iodesc { int nfs_open(const char *path, struct open_file *f); static int nfs_close(struct open_file *f); static int nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t nfs_seek(struct open_file *f, off_t offset, int where); static int nfs_stat(struct open_file *f, struct stat *sb); static int nfs_readdir(struct open_file *f, struct dirent *d); @@ -138,7 +137,7 @@ struct fs_ops nfs_fsops = { nfs_open, nfs_close, nfs_read, - nfs_write, + null_write, nfs_seek, nfs_stat, nfs_readdir @@ -713,15 +712,6 @@ ret: *resid = size; return (0); -} - -/* - * Not implemented. - */ -int -nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - return (EROFS); } off_t Modified: head/stand/libsa/nullfs.c ============================================================================== --- head/stand/libsa/nullfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/nullfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -83,7 +83,7 @@ int null_read (struct open_file *f, void *buf, size_t return EIO; } -int null_write (struct open_file *f, void *buf, size_t size, size_t *resid) +int null_write (struct open_file *f, const void *buf, size_t size, size_t *resid) { return EIO; } Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/stand.h Fri Feb 23 20:18:09 2018 (r329879) @@ -105,7 +105,7 @@ struct fs_ops { int (*fo_close)(struct open_file *f); int (*fo_read)(struct open_file *f, void *buf, size_t size, size_t *resid); - int (*fo_write)(struct open_file *f, void *buf, + int (*fo_write)(struct open_file *f, const void *buf, size_t size, size_t *resid); off_t (*fo_seek)(struct open_file *f, off_t offset, int where); int (*fo_stat)(struct open_file *f, struct stat *sb); @@ -383,7 +383,7 @@ extern void nullsys(void); extern int null_open(const char *path, struct open_file *f); extern int null_close(struct open_file *f); extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); -extern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid); +extern int null_write(struct open_file *f, const void *buf, size_t size, size_t *resid); extern off_t null_seek(struct open_file *f, off_t offset, int where); extern int null_stat(struct open_file *f, struct stat *sb); extern int null_readdir(struct open_file *f, struct dirent *d); Modified: head/stand/libsa/tftp.c ============================================================================== --- head/stand/libsa/tftp.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/tftp.c Fri Feb 23 20:18:09 2018 (r329879) @@ -69,7 +69,8 @@ static int tftp_open(const char *path, struct open_fil static int tftp_close(struct open_file *f); static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int tftp_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int tftp_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static off_t tftp_seek(struct open_file *f, off_t offset, int where); static int tftp_set_blksize(struct tftp_handle *h, const char *str); static int tftp_stat(struct open_file *f, struct stat *sb); @@ -574,8 +575,8 @@ tftp_close(struct open_file *f) } static int -tftp_write(struct open_file *f __unused, void *start __unused, size_t size __unused, - size_t *resid __unused /* out */) +tftp_write(struct open_file *f __unused, const void *start __unused, + size_t size __unused, size_t *resid __unused /* out */) { return (EROFS); } Modified: head/stand/libsa/ufs.c ============================================================================== --- head/stand/libsa/ufs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/ufs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -84,7 +84,8 @@ __FBSDID("$FreeBSD$"); #include "string.h" static int ufs_open(const char *path, struct open_file *f); -static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int ufs_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static int ufs_close(struct open_file *f); static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t ufs_seek(struct open_file *f, off_t offset, int where); @@ -131,7 +132,7 @@ struct file { static int read_inode(ino_t, struct open_file *); static int block_map(struct open_file *, ufs2_daddr_t, ufs2_daddr_t *); static int buf_read_file(struct open_file *, char **, size_t *); -static int buf_write_file(struct open_file *, char *, size_t *); +static int buf_write_file(struct open_file *, const char *, size_t *); static int search_directory(char *, struct open_file *, ino_t *); static int ufs_use_sa_read(void *, off_t, void **, int); @@ -306,7 +307,7 @@ block_map(f, file_block, disk_block_p) static int buf_write_file(f, buf_p, size_p) struct open_file *f; - char *buf_p; + const char *buf_p; size_t *size_p; /* out */ { struct file *fp = (struct file *)f->f_fsdata; @@ -770,14 +771,14 @@ ufs_read(f, start, size, resid) static int ufs_write(f, start, size, resid) struct open_file *f; - void *start; + const void *start; size_t size; size_t *resid; /* out */ { struct file *fp = (struct file *)f->f_fsdata; size_t csize; int rc = 0; - char *addr = start; + const char *addr = start; csize = size; while ((size != 0) && (csize != 0)) { Modified: head/stand/libsa/write.c ============================================================================== --- head/stand/libsa/write.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/write.c Fri Feb 23 20:18:09 2018 (r329879) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); ssize_t write(fd, dest, bcount) int fd; - void *dest; + const void *dest; size_t bcount; { struct open_file *f = &files[fd]; @@ -82,7 +82,8 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), bcount, dest, &resid); + btodb(f->f_offset), bcount, __DECONST(void *, dest), + &resid); if (errno) return (-1); f->f_offset += resid; Modified: head/stand/userboot/userboot/host.c ============================================================================== --- head/stand/userboot/userboot/host.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/userboot/userboot/host.c Fri Feb 23 20:18:09 2018 (r329879) @@ -74,16 +74,6 @@ host_read(struct open_file *f, void *start, size_t siz return (CALLBACK(read, f->f_fsdata, start, size, resid)); } -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -host_write(struct open_file *f, void *start, size_t size, size_t *resid) -{ - - return (EROFS); -} - static off_t host_seek(struct open_file *f, off_t offset, int where) { @@ -183,7 +173,7 @@ struct fs_ops host_fsops = { host_open, host_close, host_read, - host_write, + null_write, host_seek, host_stat, host_readdir Modified: head/stand/zfs/zfs.c ============================================================================== --- head/stand/zfs/zfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/zfs/zfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #define ZFS_BE_LAST 8 static int zfs_open(const char *path, struct open_file *f); -static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static int zfs_close(struct open_file *f); static int zfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t zfs_seek(struct open_file *f, off_t offset, int where); @@ -69,7 +68,7 @@ struct fs_ops zfs_fsops = { zfs_open, zfs_close, zfs_read, - zfs_write, + null_write, zfs_seek, zfs_stat, zfs_readdir @@ -171,16 +170,6 @@ zfs_read(struct open_file *f, void *start, size_t size *resid = size - n; return (0); -} - -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -zfs_write(struct open_file *f, void *start, size_t size, size_t *resid /* out */) -{ - - return (EROFS); } static off_t From owner-svn-src-all@freebsd.org Fri Feb 23 20:25:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EAE3F1ADA5 for ; Fri, 23 Feb 2018 20:25:00 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2859676D44 for ; Fri, 23 Feb 2018 20:24:59 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 863d74ce-18d7-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 863d74ce-18d7-11e8-b951-f99fef315fd9; Fri, 23 Feb 2018 20:24:18 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w1NKOpOd067544; Fri, 23 Feb 2018 13:24:51 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1519417491.91697.193.camel@freebsd.org> Subject: Re: svn commit: r329866 - head/sys/cam From: Ian Lepore To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 23 Feb 2018 13:24:51 -0700 In-Reply-To: <201802231606.w1NG6t45013919@repo.freebsd.org> References: <201802231606.w1NG6t45013919@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:25:00 -0000 On Fri, 2018-02-23 at 16:06 +0000, Warner Losh wrote: > -static inline int > +static inline bool >  cam_iosched_has_flagged_work(struct cam_iosched_softc *isc) >  { >         return !!(isc->flags & CAM_IOSCHED_FLAG_WORK_FLAGS); >  } There should be no need for the ugly !! here, conversion to bool in C99 is like it is for c++, it converts to zero if the expression being converted has a value of zero, or to one otherwise. -- Ian From owner-svn-src-all@freebsd.org Fri Feb 23 20:53:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED9BAF1D9B6; Fri, 23 Feb 2018 20:53:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4E2782B6; Fri, 23 Feb 2018 20:53:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22b.google.com with SMTP id a75so4441797itd.0; Fri, 23 Feb 2018 12:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=Lhw3OsmkzxsalgKTb2f8XpY8Dubu9f2TvPFz3ArrrkI=; b=B8T/Xt0aKnEIpLGZ6MHPXPPDpG945GmZ3JS7GgXqYneJO6LihxC1Xd/uAPQNru2Ao4 DvlAfS+BKvtYvyEt0jcC1/Z8YuDZQZ3v9jnbyTIYBL1kS4RAFjyIcvEAqBEvtx9jwKmm X/NPPM9zsuGi9NBR+Tf0PlC69GDSscnnRGJJiThCgzKn14e8b+TNuz2ayEWdRAO7UD2k F38GK5/pzVwMsFk/10C337ukFD5Vp2sb8qF+J1K7Fh/8COqQUvnvFg/u3a1f9CqFzjaW /PwScCLTDtrML5BWKmQ9wOot66grFHSn+3D0i/r+KtuSroximU7SLdpB/iYwPMKunVP2 /tbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=Lhw3OsmkzxsalgKTb2f8XpY8Dubu9f2TvPFz3ArrrkI=; b=e/sb+tP00hSSKZtJsAEdoBax2Gh0+MAhnCcjO2gaoOcfL1wR96x8y87OzJB+TyEQvF 1KflXFpe/d4LBfrZY2nI7HSuMh5gtvX4lUCmgkLztSgxWrIYq3vQ0hTVg8Lcvkswrpre 8xHWti+EEntORsjTK21GRZEjN2H7AcHUH3ik77sC2h7p/Pyf1PyImlc3VF29EUms5RqT wYMdFPLIrLVC2bzOnmCKDKWYlHTUKzGRqgrga9S9QvoZacGHqM5pVdu0T2Yjth0T3Zoz 1sYF0mCDaPxChTXQeYgqWIKsqh3P8vqtImXzDPgosgficREXXAHV3/cjcZWAUCGVVn/T 6EfA== X-Gm-Message-State: APf1xPCexW2yvtzWI/1ML7BlI+BzTpjJcWBN93sBYlOCsLIHV8wMOAta Q7e6EFY4ZFUM8qrY1rc0kqWiHXpRP6MeBBO7NX+Mm1mz X-Google-Smtp-Source: AH8x226/aioF0JvsahjwnvS79tyv353Oo0OqPG2fd/xfLI6KUkTxA8tAd0ZLhkqVM2YTQieCjxmuNiUdw3ssl4IuPr4= X-Received: by 10.36.83.20 with SMTP id n20mr3811809itb.52.1519419215729; Fri, 23 Feb 2018 12:53:35 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.163.13 with HTTP; Fri, 23 Feb 2018 12:53:15 -0800 (PST) In-Reply-To: <201802232001.w1NK1g0G037793@repo.freebsd.org> References: <201802232001.w1NK1g0G037793@repo.freebsd.org> From: Ed Maste Date: Fri, 23 Feb 2018 15:53:15 -0500 X-Google-Sender-Auth: YKsiI03h3Zcpzkt0x-bZHHPIc2M Message-ID: Subject: Re: svn commit: r329877 - head/sys/dev/isci/scil To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:53:37 -0000 On 23 February 2018 at 15:01, Ed Maste wrote: > Author: emaste > Date: Fri Feb 23 20:01:42 2018 > New Revision: 329877 > URL: https://svnweb.freebsd.org/changeset/base/329877 > > Log: > Correct typo in ATA_WRITE_UNCORRECTABLE_PSEUDO > > Also correct a typo in the comment for these values, noted by jimharris. > > Reviewed by: jimharris > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D3715 Oops, I copied and pasted the wrong review link. It should be https://reviews.freebsd.org/D14489. From owner-svn-src-all@freebsd.org Fri Feb 23 21:57:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5606EF23A9C; Fri, 23 Feb 2018 21:57:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 061F37ACD4; Fri, 23 Feb 2018 21:57:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F08DA1C3F9; Fri, 23 Feb 2018 21:57:10 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NLvAP2095500; Fri, 23 Feb 2018 21:57:10 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NLvA3b095499; Fri, 23 Feb 2018 21:57:10 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802232157.w1NLvA3b095499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 23 Feb 2018 21:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329880 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 21:57:11 -0000 Author: mckusick Date: Fri Feb 23 21:57:10 2018 New Revision: 329880 URL: https://svnweb.freebsd.org/changeset/base/329880 Log: Include error number in the "fsync: giving up on dirty" message (in case it ever starts happening again in spite of 328444). Submitted by: Andreas Longwitz Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Fri Feb 23 20:18:09 2018 (r329879) +++ head/sys/kern/vfs_default.c Fri Feb 23 21:57:10 2018 (r329880) @@ -714,12 +714,13 @@ loop2: if ((mp != NULL && mp->mnt_secondary_writes > 0) || (error == 0 && --maxretry >= 0)) goto loop1; - error = EAGAIN; + if (error == 0) + error = EAGAIN; } } BO_UNLOCK(bo); - if (error == EAGAIN) - vn_printf(vp, "fsync: giving up on dirty "); + if (error != 0) + vn_printf(vp, "fsync: giving up on dirty (error = %d) ", error); return (error); } From owner-svn-src-all@freebsd.org Fri Feb 23 22:23:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47F56F25AFD; Fri, 23 Feb 2018 22:23:29 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C70317C039; Fri, 23 Feb 2018 22:23:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1DB61C8C9; Fri, 23 Feb 2018 22:23:28 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NMNS2x010894; Fri, 23 Feb 2018 22:23:28 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NMNSoH010893; Fri, 23 Feb 2018 22:23:28 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802232223.w1NMNSoH010893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 23 Feb 2018 22:23:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329881 - stable/11/sbin/fsck_ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sbin/fsck_ffs X-SVN-Commit-Revision: 329881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 22:23:29 -0000 Author: mckusick Date: Fri Feb 23 22:23:28 2018 New Revision: 329881 URL: https://svnweb.freebsd.org/changeset/base/329881 Log: MFC of 329749. Fix a read past the end of a buffer in fsck. Modified: stable/11/sbin/fsck_ffs/inode.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/inode.c ============================================================================== --- stable/11/sbin/fsck_ffs/inode.c Fri Feb 23 21:57:10 2018 (r329880) +++ stable/11/sbin/fsck_ffs/inode.c Fri Feb 23 22:23:28 2018 (r329881) @@ -451,8 +451,10 @@ cacheino(union dinode *dp, ino_t inumber) if (howmany(DIP(dp, di_size), sblock.fs_bsize) > NDADDR) blks = NDADDR + NIADDR; - else + else if (DIP(dp, di_size) > 0) blks = howmany(DIP(dp, di_size), sblock.fs_bsize); + else + blks = 1; inp = (struct inoinfo *) Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) From owner-svn-src-all@freebsd.org Fri Feb 23 22:49:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8E3BF2742D; Fri, 23 Feb 2018 22:49:02 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670075.outbound.protection.outlook.com [40.107.67.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT TLS CA 4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E42D7CF50; Fri, 23 Feb 2018 22:49:01 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM (52.132.66.153) by YQBPR0101MB1459.CANPRD01.PROD.OUTLOOK.COM (52.132.69.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Fri, 23 Feb 2018 22:49:00 +0000 Received: from YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c9:f1bb:c28:946e]) by YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c9:f1bb:c28:946e%13]) with mapi id 15.20.0527.017; Fri, 23 Feb 2018 22:48:59 +0000 From: Rick Macklem To: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r329875 - head/sys/kern Thread-Topic: svn commit: r329875 - head/sys/kern Thread-Index: AQHTrNPbHhr1sq3e30C2bSmXFyQ5xaOyld/5 Date: Fri, 23 Feb 2018 22:48:59 +0000 Message-ID: References: <201802231826.w1NIQVqr084972@repo.freebsd.org> In-Reply-To: <201802231826.w1NIQVqr084972@repo.freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; YQBPR0101MB1459; 7:BaOBtzmlWaFHFw+xEisYG9ZCqBjjK0Kq1ycB2MTRDFMswVYQJdTKUkCgxWZcN9LhSsUnpEv2COt7DzCA6Aa9xOj5rRNPd2xlI/mBh/EMKIc7rHNTejuYN/HTbiNb0WmskeeySHnfwuB7q9tRZq69SPYbd6Ni2Wd1apqv7LDzGmQpE29bJeeXAmA0Letp+fFN3/+nCAIv6GceLQtcFlXe340AbWmC7ccA6uNGVMTXVeRfP5ZJ9afplgl1gdrCoaxH x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 5e6e2131-f31f-4bda-50e7-08d57b0fa110 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989060)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:YQBPR0101MB1459; x-ms-traffictypediagnostic: YQBPR0101MB1459: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(56005881305849); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231200)(944501161)(52105095)(93006095)(93001095)(10201501046)(3002001)(6041288)(20161123562045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:YQBPR0101MB1459; BCL:0; PCL:0; RULEID:; SRVR:YQBPR0101MB1459; x-forefront-prvs: 0592A9FDE6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(39380400002)(346002)(396003)(13624006)(199004)(189003)(6306002)(5250100002)(2201001)(9686003)(7696005)(478600001)(105586002)(450100002)(55016002)(99286004)(25786009)(76176011)(2950100002)(68736007)(3660700001)(59450400001)(5660300001)(97736004)(6436002)(6506007)(106356001)(966005)(3280700002)(2900100001)(86362001)(229853002)(316002)(33656002)(26005)(6246003)(81156014)(81166006)(8936002)(8676002)(786003)(102836004)(2906002)(74316002)(74482002)(305945005)(53936002)(186003)(14454004)(2501003)(110136005)(6346003); DIR:OUT; SFP:1101; SCL:1; SRVR:YQBPR0101MB1459; H:YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-microsoft-antispam-message-info: tKtTK1moWaRevvKzOIgN3TjELCWmMQvLhjFRb0kwQvsDwO8BoKVpmZHg5naxM5bWFmm340l/QJGi754Zdt/6GpdeRkXXrJ8sBrvX2YGgCa0n7Xb4UydTgUIHNLPRdz62/ENX0tboMIMKfTZ0VcKAUebpsK/XJiozs2NBaK6uV1E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 5e6e2131-f31f-4bda-50e7-08d57b0fa110 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2018 22:48:59.9407 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQBPR0101MB1459 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 22:49:03 -0000 Konstantin Belousov wrote: >Author: kib >Date: Fri Feb 23 18:26:31 2018 >New Revision: 329875 >URL: https://svnweb.freebsd.org/changeset/base/329875 > >Log: > Restore UP build. > > Reviewed by: truckman > Sponsored by: The FreeBSD Foundation > >Modified: > head/sys/kern/sched_ule.c > >Modified: head/sys/kern/sched_ule.c >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >--- head/sys/kern/sched_ule.c Fri Feb 23 18:18:42 2018 (r329874) >+++ head/sys/kern/sched_ule.c Fri Feb 23 18:26:31 2018 (r329875) >@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio) > td->td_flags |=3D TDF_NEEDRESCHED; > } > >+#ifdef SMP > /* > * This tdq is about to idle. Try to steal a thread from another CPU bef= ore > * choosing the idle thread. >@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq) > } > spinlock_exit(); >} >+#endif > > /* > * Handle migration from sched_switch(). This happens only for >@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newt= d, > TDQ_LOCK(tdq); > mtx =3D thread_lock_block(td); > tdq_load_rem(tdq, td); >+#ifdef SMP > if (tdq->tdq_load =3D=3D 0) Since the function isn't called for UP, should this "if" also check for ncp= us > 1 by any chance? (I know nothing about ULE, so please ignore this if it doesn't make sense;-= ) > tdq_trysteal(tdq); >+#endif > } > > #if (KTR_COMPILE & KTR_SCHED) !=3D 0 rick= From owner-svn-src-all@freebsd.org Fri Feb 23 22:51:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBD0F27727; Fri, 23 Feb 2018 22:51:53 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E37327D83E; Fri, 23 Feb 2018 22:51:52 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE3141CD69; Fri, 23 Feb 2018 22:51:52 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NMpqv8025108; Fri, 23 Feb 2018 22:51:52 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NMpqn4025101; Fri, 23 Feb 2018 22:51:52 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802232251.w1NMpqn4025101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 23 Feb 2018 22:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329882 - in head/sys: conf kern sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: conf kern sys vm X-SVN-Commit-Revision: 329882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 22:51:53 -0000 Author: jeff Date: Fri Feb 23 22:51:51 2018 New Revision: 329882 URL: https://svnweb.freebsd.org/changeset/base/329882 Log: Add a generic Proportional Integral Derivative (PID) controller algorithm and use it to regulate page daemon output. This provides much smoother and more responsive page daemon output, anticipating demand and avoiding pageout stalls by increasing the number of pages to match the workload. This is a reimplementation of work done by myself and mlaier at Isilon. Reviewed by: bsdimp Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14402 Added: head/sys/kern/subr_pidctrl.c (contents, props changed) head/sys/sys/pidctrl.h (contents, props changed) Modified: head/sys/conf/files head/sys/vm/vm_meter.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Feb 23 22:23:28 2018 (r329881) +++ head/sys/conf/files Fri Feb 23 22:51:51 2018 (r329882) @@ -3874,6 +3874,7 @@ kern/subr_msgbuf.c standard kern/subr_param.c standard kern/subr_pcpu.c standard kern/subr_pctrie.c standard +kern/subr_pidctrl.c standard kern/subr_power.c standard kern/subr_prf.c standard kern/subr_prof.c standard Added: head/sys/kern/subr_pidctrl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_pidctrl.c Fri Feb 23 22:51:51 2018 (r329882) @@ -0,0 +1,157 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +void +pidctrl_init(struct pidctrl *pc, int interval, int setpoint, int bound, + int Kpd, int Kid, int Kdd) +{ + + bzero(pc, sizeof(*pc)); + pc->pc_setpoint = setpoint; + pc->pc_interval = interval; + pc->pc_bound = bound * setpoint * Kid; + pc->pc_Kpd = Kpd; + pc->pc_Kid = Kid; + pc->pc_Kdd = Kdd; +} + +void +pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_oid_list *parent) +{ + + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "error", CTLFLAG_RD, + &pc->pc_error, 0, "Current difference from setpoint value (P)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "olderror", CTLFLAG_RD, + &pc->pc_olderror, 0, "Error value from last interval"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "integral", CTLFLAG_RD, + &pc->pc_integral, 0, "Accumulated error integral (I)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "derivative", + CTLFLAG_RD, &pc->pc_derivative, 0, "Error derivative (I)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "input", CTLFLAG_RD, + &pc->pc_input, 0, "Last controller process variable input"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "output", CTLFLAG_RD, + &pc->pc_output, 0, "Last controller output"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "ticks", CTLFLAG_RD, + &pc->pc_ticks, 0, "Last controler runtime"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "setpoint", CTLFLAG_RW, + &pc->pc_setpoint, 0, "Desired level for process variable"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "interval", CTLFLAG_RD, + &pc->pc_interval, 0, "Interval between calculations (ticks)"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "bound", CTLFLAG_RW, + &pc->pc_bound, 0, "Integral wind-up limit"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kpd", CTLFLAG_RW, + &pc->pc_Kpd, 0, "Inverse of proportional gain"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kid", CTLFLAG_RW, + &pc->pc_Kid, 0, "Inverse of integral gain"); + SYSCTL_ADD_INT(NULL, parent, OID_AUTO, "kdd", CTLFLAG_RW, + &pc->pc_Kdd, 0, "Inverse of derivative gain"); +} + +int +pidctrl_classic(struct pidctrl *pc, int input) +{ + int output, error; + int Kpd, Kid, Kdd; + + error = pc->pc_setpoint - input; + pc->pc_ticks = ticks; + pc->pc_olderror = pc->pc_error; + + /* Fetch gains and prevent divide by zero. */ + Kpd = MAX(pc->pc_Kpd, 1); + Kid = MAX(pc->pc_Kid, 1); + Kdd = MAX(pc->pc_Kdd, 1); + + /* Compute P (proportional error), I (integral), D (derivative) */ + pc->pc_error = error; + pc->pc_integral = + MAX(MIN(pc->pc_integral + error, pc->pc_bound), -pc->pc_bound); + pc->pc_derivative = error - pc->pc_olderror; + + /* Divide by inverse gain values to produce output. */ + output = ((pc->pc_error / pc->pc_Kpd) + + (pc->pc_integral / pc->pc_Kid)) + + (pc->pc_derivative / pc->pc_Kdd); + /* Save for sysctl. */ + pc->pc_output = output; + pc->pc_input = input; + + return output; +} + +int +pidctrl_daemon(struct pidctrl *pc, int input) +{ + int output, error; + int Kpd, Kid, Kdd; + + error = pc->pc_setpoint - input; + /* + * When ticks expired we reset our variables and start a new + * interval. If we're called multiple times during one interval + * we attempt to report a target as if the entire error came at + * the interval boundary. + */ + if ((u_int)(ticks - pc->pc_ticks) >= pc->pc_interval) { + pc->pc_ticks = ticks; + pc->pc_olderror = pc->pc_error; + pc->pc_output = pc->pc_error = 0; + } else { + error = MAX(error + pc->pc_error, 0); + } + + /* Fetch gains and prevent divide by zero. */ + Kpd = MAX(pc->pc_Kpd, 1); + Kid = MAX(pc->pc_Kid, 1); + Kdd = MAX(pc->pc_Kdd, 1); + + /* Compute P (proportional error), I (integral), D (derivative) */ + pc->pc_error = error; + pc->pc_integral = + MAX(MIN(pc->pc_integral + error, pc->pc_bound), 0); + pc->pc_derivative = error - pc->pc_olderror; + + /* Divide by inverse gain values to produce output. */ + output = ((error / pc->pc_Kpd) + + (pc->pc_integral / pc->pc_Kid)) + + (pc->pc_derivative / pc->pc_Kdd); + output = MAX(output - pc->pc_output, 0); + pc->pc_output += output; + pc->pc_input = input; + + return output; +} Added: head/sys/sys/pidctrl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/pidctrl.h Fri Feb 23 22:51:51 2018 (r329882) @@ -0,0 +1,123 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_PIDCTRL_H_ +#define _SYS_PIDCTRL_H_ + +/* + * Proportional Integral Derivative controller. + * + * This controller is intended to replace a multitude of threshold based + * daemon regulation systems. These systems produce sharp sawtooths of + * activity which can cause latency spikes and other undesireable bursty + * behavior. The PID controller adapts to changing load conditions and + * adjusts the work done by the daemon to keep a smoother output. + * + * The setpoint can be thought of as a single watermark that the controller + * is always trying to reach. Compared to a high water/low water type + * algorithm the pid controller is dynamically deciding the low water and + * regulating to the high water. The setpoint should be high enough that + * the controller and daemon have time to observe the rise in value and + * respond to it, else the resource may be exhausted. More frequent wakeups + * permit higher setpoints and less underutilized resources. + * + * The controller has been optimised for simplicity of math making it quite + * inexpensive to execute. There is no floating point and so the gains must + * be the inverse of whole integers. + * + * Failing to measure and tune the gain parameters can result in wild + * oscillations in output. It is strongly encouraged that controllers are + * tested and tuned under a wide variety of workloads before gain values are + * picked. Some reasonable defaults are provided below. + */ + +struct pidctrl { + /* Saved control variables. */ + int pc_error; /* Current error. */ + int pc_olderror; /* Saved error for derivative. */ + int pc_integral; /* Integral accumulator. */ + int pc_derivative; /* Change from last error. */ + int pc_input; /* Last input. */ + int pc_output; /* Last output. */ + int pc_ticks; /* Last sampling time. */ + /* configuration options, runtime tunable via sysctl */ + int pc_setpoint; /* Desired level */ + int pc_interval; /* Update interval in ticks. */ + int pc_bound; /* Integral wind-up limit. */ + int pc_Kpd; /* Proportional gain divisor. */ + int pc_Kid; /* Integral gain divisor. */ + int pc_Kdd; /* Derivative gain divisor. */ +}; + +/* + * Reasonable default divisors. + * + * Actual gains are 1/divisor. Gains interact in complex ways with the + * setpoint and interval. Measurement under multiple loads should be + * taken to ensure adequate stability and rise time. + */ +#define PIDCTRL_KPD 3 /* Default proportional divisor. */ +#define PIDCTRL_KID 4 /* Default integral divisor. */ +#define PIDCTRL_KDD 8 /* Default derivative divisor. */ +#define PIDCTRL_BOUND 4 /* Bound factor, setpoint multiple. */ + +struct sysctl_oid_list; + +void pidctrl_init(struct pidctrl *pc, int interval, int setpoint, + int bound, int Kpd, int Kid, int Kdd); +void pidctrl_init_sysctl(struct pidctrl *pc, struct sysctl_oid_list *parent); + +/* + * This is the classic PID controller where the interval is clamped to + * [-bound, bound] and the output may be negative. This should be used + * in continuous control loops that can adjust a process variable in + * either direction. This is a descrete time controller and should + * only be called once per-interval or the derivative term will be + * inaccurate. + */ +int pidctrl_classic(struct pidctrl *pc, int input); + +/* + * This controler is intended for consumer type daemons that can only + * regulate in a positive direction, that is to say, they can not exert + * positive pressure on the process variable or input. They can only + * reduce it by doing work. As such the integral is bound between [0, bound] + * and the output is similarly a positive value reflecting the units of + * work necessary to be completed in the current interval to eliminate error. + * + * It is a descrete time controller but can be invoked more than once in a + * given time interval for ease of client implementation. This should only + * be done in overload situations or the controller may not produce a stable + * output. Calling it less frequently when there is no work to be done will + * increase the rise time but should otherwise be harmless. + */ +int pidctrl_daemon(struct pidctrl *pc, int input); + +#endif /* !_SYS_PIDCTRL_H_ */ Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Fri Feb 23 22:23:28 2018 (r329881) +++ head/sys/vm/vm_meter.c Fri Feb 23 22:51:51 2018 (r329882) @@ -473,3 +473,58 @@ vm_laundry_count(void) return vm_pagequeue_count(PQ_LAUNDRY); } +static void +vm_domain_stats_init(struct vm_domain *vmd, struct sysctl_oid *parent) +{ + struct sysctl_oid *oid; + + vmd->vmd_oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(parent), OID_AUTO, + vmd->vmd_name, CTLFLAG_RD, NULL, ""); + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, + "stats", CTLFLAG_RD, NULL, ""); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_count", CTLFLAG_RD, &vmd->vmd_free_count, 0, + "Free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "active", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_cnt, 0, + "Active pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt, 0, + "Inactive pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "laundry", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt, 0, + "laundry pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "unswappable", + CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_UNSWAPPABLE].pq_cnt, 0, + "Unswappable pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive_target", CTLFLAG_RD, &vmd->vmd_inactive_target, 0, + "Target inactive pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_target", CTLFLAG_RD, &vmd->vmd_free_target, 0, + "Target free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_reserved", CTLFLAG_RD, &vmd->vmd_free_reserved, 0, + "Reserved free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_min", CTLFLAG_RD, &vmd->vmd_free_min, 0, + "Minimum free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_severe", CTLFLAG_RD, &vmd->vmd_free_severe, 0, + "Severe free pages"); + +} + +static void +vm_stats_init(void *arg __unused) +{ + struct sysctl_oid *oid; + int i; + + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_vm), OID_AUTO, + "domain", CTLFLAG_RD, NULL, ""); + for (i = 0; i < vm_ndomains; i++) + vm_domain_stats_init(VM_DOMAIN(i), oid); +} + +SYSINIT(vmstats_init, SI_SUB_VM_CONF, SI_ORDER_FIRST, vm_stats_init, NULL); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Feb 23 22:23:28 2018 (r329881) +++ head/sys/vm/vm_page.c Fri Feb 23 22:51:51 2018 (r329882) @@ -430,6 +430,7 @@ vm_page_domain_init(int domain) MTX_DEF | MTX_DUPOK); } mtx_init(&vmd->vmd_free_mtx, "vm page free queue", NULL, MTX_DEF); + snprintf(vmd->vmd_name, sizeof(vmd->vmd_name), "%d", domain); } /* Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Feb 23 22:23:28 2018 (r329881) +++ head/sys/vm/vm_pageout.c Fri Feb 23 22:51:51 2018 (r329882) @@ -124,7 +124,7 @@ static void vm_pageout(void); static void vm_pageout_init(void); static int vm_pageout_clean(vm_page_t m, int *numpagedout); static int vm_pageout_cluster(vm_page_t m); -static bool vm_pageout_scan(struct vm_domain *vmd, int pass); +static bool vm_pageout_scan(struct vm_domain *vmd, int pass, int shortage); static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, int starting_page_shortage); @@ -146,7 +146,7 @@ SDT_PROBE_DEFINE(vm, , , vm__lowmem_scan); /* Pagedaemon activity rates, in subdivisions of one second. */ #define VM_LAUNDER_RATE 10 -#define VM_INACT_SCAN_RATE 2 +#define VM_INACT_SCAN_RATE 10 static int vm_pageout_oom_seq = 12; @@ -1104,7 +1104,7 @@ dolaundry: * queue scan to meet the target. */ static bool -vm_pageout_scan(struct vm_domain *vmd, int pass) +vm_pageout_scan(struct vm_domain *vmd, int pass, int shortage) { vm_page_t m, next; struct vm_pagequeue *pq; @@ -1148,7 +1148,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) */ if (pass > 0) { deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); - page_shortage = vm_paging_target(vmd) + deficit; + page_shortage = shortage + deficit; } else page_shortage = deficit = 0; starting_page_shortage = page_shortage; @@ -1398,7 +1398,7 @@ drop_page: */ inactq_shortage = vmd->vmd_inactive_target - (pq->pq_cnt + vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt / act_scan_laundry_weight) + - vm_paging_target(vmd) + deficit + addl_page_shortage; + shortage + deficit + addl_page_shortage; inactq_shortage *= act_scan_laundry_weight; pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; @@ -1764,12 +1764,13 @@ static void vm_pageout_worker(void *arg) { struct vm_domain *vmd; - int domain, pass; + int domain, pass, shortage; bool target_met; domain = (uintptr_t)arg; vmd = VM_DOMAIN(domain); pass = 0; + shortage = 0; target_met = true; /* @@ -1792,48 +1793,39 @@ vm_pageout_worker(void *arg) vm_domain_free_lock(vmd); /* - * Do not clear vmd_pageout_wanted until we reach our free page - * target. Otherwise, we may be awakened over and over again, - * wasting CPU time. + * Might the page daemon need to run again? */ - if (vmd->vmd_pageout_wanted && target_met) - vmd->vmd_pageout_wanted = false; - - /* - * Might the page daemon receive a wakeup call? - */ - if (vmd->vmd_pageout_wanted) { + if (vm_paging_needed(vmd, vmd->vmd_free_count)) { /* - * No. Either vmd_pageout_wanted was set by another - * thread during the previous scan, which must have - * been a level 0 scan, or vmd_pageout_wanted was - * already set and the scan failed to free enough - * pages. If we haven't yet performed a level >= 1 - * (page reclamation) scan, then increase the level - * and scan again now. Otherwise, sleep a bit and - * try again later. + * Yes, the scan failed to free enough pages. If + * we have performed a level >= 1 (page reclamation) + * scan, then sleep a bit and try again. */ vm_domain_free_unlock(vmd); - if (pass >= 1) + if (pass > 1) pause("pwait", hz / VM_INACT_SCAN_RATE); - pass++; } else { /* - * Yes. If threads are still sleeping in vm_wait() - * then we immediately start a new scan. Otherwise, - * sleep until the next wakeup or until pages need to - * have their reference stats updated. + * No, sleep until the next wakeup or until pages + * need to have their reference stats updated. */ + vmd->vmd_pageout_wanted = false; if (mtx_sleep(&vmd->vmd_pageout_wanted, vm_domain_free_lockptr(vmd), PDROP | PVM, - "psleep", hz) == 0) { + "psleep", hz / VM_INACT_SCAN_RATE) == 0) VM_CNT_INC(v_pdwakeups); - pass = 1; - } else - pass = 0; } + shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); + if (shortage && pass == 0) + pass = 1; - target_met = vm_pageout_scan(vmd, pass); + target_met = vm_pageout_scan(vmd, pass, shortage); + /* + * If the target was not met we must increase the pass to + * more aggressively reclaim. + */ + if (!target_met) + pass++; } } @@ -1844,6 +1836,7 @@ static void vm_pageout_init_domain(int domain) { struct vm_domain *vmd; + struct sysctl_oid *oid; vmd = VM_DOMAIN(domain); vmd->vmd_interrupt_free_min = 2; @@ -1870,10 +1863,10 @@ vm_pageout_init_domain(int domain) vmd->vmd_inactive_target = vmd->vmd_free_count / 3; /* - * Set the default wakeup threshold to be 10% above the minimum - * page limit. This keeps the steady state out of shortfall. + * Set the default wakeup threshold to be 10% below the paging + * target. This keeps the steady state out of shortfall. */ - vmd->vmd_pageout_wakeup_thresh = (vmd->vmd_free_min / 10) * 11; + vmd->vmd_pageout_wakeup_thresh = (vmd->vmd_free_target / 10) * 9; /* * Target amount of memory to move out of the laundry queue during a @@ -1882,6 +1875,14 @@ vm_pageout_init_domain(int domain) */ vmd->vmd_background_launder_target = (vmd->vmd_free_target - vmd->vmd_free_min) / 10; + + /* Initialize the pageout daemon pid controller. */ + pidctrl_init(&vmd->vmd_pid, hz / VM_INACT_SCAN_RATE, + vmd->vmd_free_target, PIDCTRL_BOUND, + PIDCTRL_KPD, PIDCTRL_KID, PIDCTRL_KDD); + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, + "pidctrl", CTLFLAG_RD, NULL, ""); + pidctrl_init_sysctl(&vmd->vmd_pid, SYSCTL_CHILDREN(oid)); } static void Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Fri Feb 23 22:23:28 2018 (r329881) +++ head/sys/vm/vm_pagequeue.h Fri Feb 23 22:51:51 2018 (r329882) @@ -73,6 +73,8 @@ struct vm_pagequeue { const char * const pq_name; } __aligned(CACHE_LINE_SIZE); +#include +struct sysctl_oid; struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; @@ -83,6 +85,7 @@ struct vm_domain { long vmd_segs; /* bitmask of the segments */ /* Paging control variables, locked by domain_free_mtx. */ + struct pidctrl vmd_pid; /* Pageout controller. */ u_int vmd_free_count; boolean_t vmd_oom; int vmd_oom_seq; @@ -113,6 +116,10 @@ struct vm_domain { u_int vmd_pageout_wakeup_thresh;/* (c) min pages to wake pagedaemon */ u_int vmd_interrupt_free_min; /* (c) reserved pages for int code */ u_int vmd_free_severe; /* (c) severe page depletion point */ + + /* Name for sysctl etc. */ + struct sysctl_oid *vmd_oid; + char vmd_name[sizeof(__XSTRING(MAXMEMDOM))]; } __aligned(CACHE_LINE_SIZE); extern struct vm_domain vm_dom[MAXMEMDOM]; From owner-svn-src-all@freebsd.org Fri Feb 23 22:59:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03A2CF27EAD; Fri, 23 Feb 2018 22:59:27 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mx2.catspoiler.org (mx2.catspoiler.org [IPv6:2607:f740:16::d18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "amnesiac", Issuer "amnesiac" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 981337DBB7; Fri, 23 Feb 2018 22:59:26 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org ([76.212.85.177]) by mx2.catspoiler.org (8.15.2/8.15.2) with ESMTPS id w1NN08sj005143 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Feb 2018 23:00:10 GMT (envelope-from truckman@FreeBSD.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTPS id w1NMxHds025380 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Feb 2018 14:59:17 -0800 (PST) (envelope-from truckman@FreeBSD.org) Date: Fri, 23 Feb 2018 14:59:11 -0800 (PST) From: Don Lewis Subject: Re: svn commit: r329875 - head/sys/kern To: Rick Macklem cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: Message-ID: References: <201802231826.w1NIQVqr084972@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 22:59:27 -0000 On 23 Feb, Rick Macklem wrote: > Konstantin Belousov wrote: >>Author: kib >>Date: Fri Feb 23 18:26:31 2018 >>New Revision: 329875 >>URL: https://svnweb.freebsd.org/changeset/base/329875 >> >>Log: >> Restore UP build. >> >> Reviewed by: truckman >> Sponsored by: The FreeBSD Foundation >> >>Modified: >> head/sys/kern/sched_ule.c >> >>Modified: head/sys/kern/sched_ule.c >>============================================================================== >>--- head/sys/kern/sched_ule.c Fri Feb 23 18:18:42 2018 (r329874) >>+++ head/sys/kern/sched_ule.c Fri Feb 23 18:26:31 2018 (r329875) >>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio) >> td->td_flags |= TDF_NEEDRESCHED; >> } >> >>+#ifdef SMP >> /* >> * This tdq is about to idle. Try to steal a thread from another CPU before >> * choosing the idle thread. >>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq) >> } >> spinlock_exit(); > >} >>+#endif >> >> /* >> * Handle migration from sched_switch(). This happens only for >>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd, >> TDQ_LOCK(tdq); >> mtx = thread_lock_block(td); >> tdq_load_rem(tdq, td); >>+#ifdef SMP >> if (tdq->tdq_load == 0) > Since the function isn't called for UP, should this "if" also check for ncpus > 1 by any chance? > (I know nothing about ULE, so please ignore this if it doesn't make sense;-) >> tdq_trysteal(tdq); >>+#endif >> } >> >> #if (KTR_COMPILE & KTR_SCHED) != 0 That would probably be a microoptimization. I think one of the tests at the top of tdq_trysteal() will cause an immediate return. Basically you'd be eliminating an extraneous function call in the path to switching to the idle thread after you have already determined that you don't have any work to do. From owner-svn-src-all@freebsd.org Fri Feb 23 23:07:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9F81F289C0; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98EA67E378; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F2351CF37; Fri, 23 Feb 2018 23:07:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NN7fVZ031073; Fri, 23 Feb 2018 23:07:41 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NN7fK9031072; Fri, 23 Feb 2018 23:07:41 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802232307.w1NN7fK9031072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 23 Feb 2018 23:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329883 - stable/10/sbin/fsck_ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sbin/fsck_ffs X-SVN-Commit-Revision: 329883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:07:42 -0000 Author: mckusick Date: Fri Feb 23 23:07:41 2018 New Revision: 329883 URL: https://svnweb.freebsd.org/changeset/base/329883 Log: MFC of 329749. Fix a read past the end of a buffer in fsck. Modified: stable/10/sbin/fsck_ffs/inode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/inode.c ============================================================================== --- stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 22:51:51 2018 (r329882) +++ stable/10/sbin/fsck_ffs/inode.c Fri Feb 23 23:07:41 2018 (r329883) @@ -451,8 +451,10 @@ cacheino(union dinode *dp, ino_t inumber) if (howmany(DIP(dp, di_size), sblock.fs_bsize) > NDADDR) blks = NDADDR + NIADDR; - else + else if (DIP(dp, di_size) > 0) blks = howmany(DIP(dp, di_size), sblock.fs_bsize); + else + blks = 1; inp = (struct inoinfo *) Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) From owner-svn-src-all@freebsd.org Fri Feb 23 23:21:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5268AF297A9; Fri, 23 Feb 2018 23:21:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA7CD7EBF8; Fri, 23 Feb 2018 23:21:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w1NNL3iB005142 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 24 Feb 2018 01:21:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w1NNL3iB005142 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w1NNL3e2005141; Sat, 24 Feb 2018 01:21:03 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Feb 2018 01:21:03 +0200 From: Konstantin Belousov To: Don Lewis Cc: Rick Macklem , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r329875 - head/sys/kern Message-ID: <20180223232103.GK94212@kib.kiev.ua> References: <201802231826.w1NIQVqr084972@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:21:15 -0000 On Fri, Feb 23, 2018 at 02:59:11PM -0800, Don Lewis wrote: > On 23 Feb, Rick Macklem wrote: > > Konstantin Belousov wrote: > >>Author: kib > >>Date: Fri Feb 23 18:26:31 2018 > >>New Revision: 329875 > >>URL: https://svnweb.freebsd.org/changeset/base/329875 > >> > >>Log: > >> Restore UP build. > >> > >> Reviewed by: truckman > >> Sponsored by: The FreeBSD Foundation > >> > >>Modified: > >> head/sys/kern/sched_ule.c > >> > >>Modified: head/sys/kern/sched_ule.c > >>============================================================================== > >>--- head/sys/kern/sched_ule.c Fri Feb 23 18:18:42 2018 (r329874) > >>+++ head/sys/kern/sched_ule.c Fri Feb 23 18:26:31 2018 (r329875) > >>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio) > >> td->td_flags |= TDF_NEEDRESCHED; > >> } > >> > >>+#ifdef SMP > >> /* > >> * This tdq is about to idle. Try to steal a thread from another CPU before > >> * choosing the idle thread. > >>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq) > >> } > >> spinlock_exit(); > > >} > >>+#endif > >> > >> /* > >> * Handle migration from sched_switch(). This happens only for > >>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd, > >> TDQ_LOCK(tdq); > >> mtx = thread_lock_block(td); > >> tdq_load_rem(tdq, td); > >>+#ifdef SMP > >> if (tdq->tdq_load == 0) > > Since the function isn't called for UP, should this "if" also check for ncpus > 1 by any chance? > > (I know nothing about ULE, so please ignore this if it doesn't make sense;-) > >> tdq_trysteal(tdq); > >>+#endif > >> } > >> > >> #if (KTR_COMPILE & KTR_SCHED) != 0 > > That would probably be a microoptimization. I think one of the tests at > the top of tdq_trysteal() will cause an immediate return. Basically > you'd be eliminating an extraneous function call in the path to > switching to the idle thread after you have already determined that you > don't have any work to do. Yes, smp_started is zero on UP. From owner-svn-src-all@freebsd.org Fri Feb 23 23:25:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8F6FF29CAD; Fri, 23 Feb 2018 23:25:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 734237F100; Fri, 23 Feb 2018 23:25:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A08F1D2AC; Fri, 23 Feb 2018 23:25:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NNPMwS041090; Fri, 23 Feb 2018 23:25:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NNPMg5041089; Fri, 23 Feb 2018 23:25:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802232325.w1NNPMg5041089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Feb 2018 23:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329885 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 329885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:25:23 -0000 Author: markj Date: Fri Feb 23 23:25:22 2018 New Revision: 329885 URL: https://svnweb.freebsd.org/changeset/base/329885 Log: Remove a bogus assertion from vm_page_launder(). After r328977, a wired page m may have m->queue != PQ_NONE. Reviewed by: kib X-MFC with: r328977 Differential Revision: https://reviews.freebsd.org/D14485 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Feb 23 23:16:15 2018 (r329884) +++ head/sys/vm/vm_page.c Fri Feb 23 23:25:22 2018 (r329885) @@ -3435,14 +3435,11 @@ vm_page_launder(vm_page_t m) int queue; vm_page_assert_locked(m); - if ((queue = m->queue) != PQ_LAUNDRY) { - if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { - if (queue != PQ_NONE) - vm_page_dequeue(m); - vm_page_enqueue(PQ_LAUNDRY, m); - } else - KASSERT(queue == PQ_NONE, - ("wired page %p is queued", m)); + if ((queue = m->queue) != PQ_LAUNDRY && m->wire_count == 0 && + (m->oflags & VPO_UNMANAGED) == 0) { + if (queue != PQ_NONE) + vm_page_dequeue(m); + vm_page_enqueue(PQ_LAUNDRY, m); } } From owner-svn-src-all@freebsd.org Fri Feb 23 23:27:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31FB2F29F0A; Fri, 23 Feb 2018 23:27:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D82417F30A; Fri, 23 Feb 2018 23:27:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B49E61D2B1; Fri, 23 Feb 2018 23:27:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NNRrj4041209; Fri, 23 Feb 2018 23:27:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NNRr0L041208; Fri, 23 Feb 2018 23:27:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802232327.w1NNRr0L041208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Feb 2018 23:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329886 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 329886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:27:54 -0000 Author: markj Date: Fri Feb 23 23:27:53 2018 New Revision: 329886 URL: https://svnweb.freebsd.org/changeset/base/329886 Log: Correct some comments after r328954. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D14486 Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Feb 23 23:25:22 2018 (r329885) +++ head/sys/vm/vm_reserv.c Fri Feb 23 23:27:53 2018 (r329886) @@ -511,19 +511,14 @@ vm_reserv_populate(vm_reserv_t rv, int index) } /* - * Allocates a contiguous set of physical pages of the given size "npages" - * from existing or newly created reservations. All of the physical pages - * must be at or above the given physical address "low" and below the given - * physical address "high". The given value "alignment" determines the - * alignment of the first physical page in the set. If the given value - * "boundary" is non-zero, then the set of physical pages cannot cross any - * physical address boundary that is a multiple of that value. Both - * "alignment" and "boundary" must be a power of two. + * Attempts to allocate a contiguous set of physical pages from existing + * reservations. See vm_reserv_alloc_contig() for a description of the + * function's parameters. * * The page "mpred" must immediately precede the offset "pindex" within the * specified object. * - * The object and free page queue must be locked. + * The object must be locked. */ vm_page_t vm_reserv_extend_contig(int req, vm_object_t object, vm_pindex_t pindex, @@ -606,7 +601,7 @@ out: /* * Allocates a contiguous set of physical pages of the given size "npages" - * from existing or newly created reservations. All of the physical pages + * from newly created reservations. All of the physical pages * must be at or above the given physical address "low" and below the given * physical address "high". The given value "alignment" determines the * alignment of the first physical page in the set. If the given value @@ -614,6 +609,9 @@ out: * physical address boundary that is a multiple of that value. Both * "alignment" and "boundary" must be a power of two. * + * Callers should first invoke vm_reserv_extend_contig() to attempt an + * allocation from existing reservations. + * * The page "mpred" must immediately precede the offset "pindex" within the * specified object. * @@ -836,7 +834,9 @@ vm_reserv_extend(int req, vm_object_t object, vm_pinde } /* - * Allocates a page from an existing reservation. + * Attempts to allocate a new reservation for the object, and allocates a + * page from that reservation. Callers should first invoke vm_reserv_extend() + * to attempt an allocation from an existing reservation. * * The page "mpred" must immediately precede the offset "pindex" within the * specified object. From owner-svn-src-all@freebsd.org Fri Feb 23 23:56:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F656F2B832; Fri, 23 Feb 2018 23:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3628C803BC; Fri, 23 Feb 2018 23:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A90B1D78F; Fri, 23 Feb 2018 23:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NNuYTI055928; Fri, 23 Feb 2018 23:56:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NNuXEL055927; Fri, 23 Feb 2018 23:56:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802232356.w1NNuXEL055927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Feb 2018 23:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329887 - stable/11/sys/opencrypto X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/opencrypto X-SVN-Commit-Revision: 329887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:56:34 -0000 Author: jhb Date: Fri Feb 23 23:56:33 2018 New Revision: 329887 URL: https://svnweb.freebsd.org/changeset/base/329887 Log: MFC 327803: Flesh out static dtrace probes for /dev/crypto ioctl errors. In particular, no probes were present for AEAD requests, but also for some other error cases in other ioctl requests. Sponsored by: Chelsio Communications Modified: stable/11/sys/opencrypto/cryptodev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/opencrypto/cryptodev.c ============================================================================== --- stable/11/sys/opencrypto/cryptodev.c Fri Feb 23 23:27:53 2018 (r329886) +++ stable/11/sys/opencrypto/cryptodev.c Fri Feb 23 23:56:33 2018 (r329887) @@ -443,6 +443,7 @@ cryptof_ioctl( default: CRYPTDEB("invalid cipher"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } @@ -490,6 +491,7 @@ cryptof_ioctl( break; default: CRYPTDEB("invalid mac"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } @@ -503,6 +505,8 @@ cryptof_ioctl( sop->keylen < txform->minkey) { CRYPTDEB("invalid cipher parameters"); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } @@ -511,6 +515,8 @@ cryptof_ioctl( if ((error = copyin(sop->key, crie.cri_key, crie.cri_klen / 8))) { CRYPTDEB("invalid key"); + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } if (thash) @@ -523,6 +529,8 @@ cryptof_ioctl( if (sop->mackeylen != thash->keysize) { CRYPTDEB("invalid mac key length"); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } @@ -532,6 +540,8 @@ cryptof_ioctl( if ((error = copyin(sop->mackey, cria.cri_key, cria.cri_klen / 8))) { CRYPTDEB("invalid mac key"); + SDT_PROBE1(opencrypto, dev, ioctl, + error, __LINE__); goto bail; } } @@ -547,6 +557,8 @@ cryptof_ioctl( error = checkforsoftware(&crid); if (error) { CRYPTDEB("checkforsoftware"); + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } } else @@ -554,6 +566,7 @@ cryptof_ioctl( error = crypto_newsession(&sid, (txform ? &crie : &cria), crid); if (error) { CRYPTDEB("crypto_newsession"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } @@ -564,6 +577,7 @@ cryptof_ioctl( if (cse == NULL) { crypto_freesession(sid); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); CRYPTDEB("csecreate"); goto bail; } @@ -596,8 +610,10 @@ bail: case CIOCFSESSION: ses = *(u_int32_t *)data; cse = csefind(fcr, ses); - if (cse == NULL) + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } csedelete(fcr, cse); error = csefree(cse); break; @@ -627,8 +643,10 @@ bail: case CIOCKEY32: case CIOCKEY232: #endif - if (!crypto_userasymcrypto) + if (!crypto_userasymcrypto) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EPERM); /* XXX compat? */ + } #ifdef COMPAT_FREEBSD32 if (cmd == CIOCKEY32 || cmd == CIOCKEY232) { kop = &kopc; @@ -662,8 +680,12 @@ bail: * fallback to doing them in software. */ *(int *)data = 0; - } else + } else { error = crypto_getfeat((int *)data); + if (error) + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + } break; case CIOCFINDDEV: error = cryptodev_find((struct crypt_find_op *)data); @@ -671,12 +693,15 @@ bail: case CIOCCRYPTAEAD: caead = (struct crypt_aead *)data; cse = csefind(fcr, caead->ses); - if (cse == NULL) + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } error = cryptodev_aead(cse, caead, active_cred, td); break; default: error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); break; } return (error); @@ -887,12 +912,16 @@ cryptodev_aead( struct cryptodesc *crde = NULL, *crda = NULL; int error; - if (caead->len > 256*1024-4 || caead->aadlen > 256*1024-4) + if (caead->len > 256*1024-4 || caead->aadlen > 256*1024-4) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (E2BIG); + } if (cse->txform == NULL || cse->thash == NULL || caead->tag == NULL || - (caead->len % cse->txform->blocksize) != 0) + (caead->len % cse->txform->blocksize) != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } uio = &cse->uio; uio->uio_iov = &cse->iovec; @@ -910,6 +939,7 @@ cryptodev_aead( crp = crypto_getreq(2); if (crp == NULL) { error = ENOMEM; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } @@ -917,12 +947,16 @@ cryptodev_aead( crde = crda->crd_next; if ((error = copyin(caead->aad, cse->uio.uio_iov[0].iov_base, - caead->aadlen))) + caead->aadlen))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if ((error = copyin(caead->src, (char *)cse->uio.uio_iov[0].iov_base + - caead->aadlen, caead->len))) + caead->aadlen, caead->len))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } crda->crd_skip = 0; crda->crd_len = caead->aadlen; @@ -955,11 +989,14 @@ cryptodev_aead( if (caead->iv) { if (caead->ivlen > sizeof cse->tmp_iv) { error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - if ((error = copyin(caead->iv, cse->tmp_iv, caead->ivlen))) + if ((error = copyin(caead->iv, cse->tmp_iv, caead->ivlen))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } bcopy(cse->tmp_iv, crde->crd_iv, caead->ivlen); crde->crd_flags |= CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; } else { @@ -969,8 +1006,10 @@ cryptodev_aead( } if ((error = copyin(caead->tag, (caddr_t)cse->uio.uio_iov[0].iov_base + - caead->len + caead->aadlen, cse->thash->hashsize))) + caead->len + caead->aadlen, cse->thash->hashsize))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } again: /* * Let the dispatch run unlocked, then, interlock against the @@ -985,8 +1024,10 @@ again: error = msleep(crp, &cse->lock, PWAIT, "crydev", 0); mtx_unlock(&cse->lock); - if (error != 0) + if (error != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if (crp->crp_etype == EAGAIN) { crp->crp_etype = 0; @@ -996,22 +1037,28 @@ again: if (crp->crp_etype != 0) { error = crp->crp_etype; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } if (cse->error) { error = cse->error; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } if (caead->dst && (error = copyout( (caddr_t)cse->uio.uio_iov[0].iov_base + caead->aadlen, caead->dst, - caead->len))) + caead->len))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if ((error = copyout((caddr_t)cse->uio.uio_iov[0].iov_base + - caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) + caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } bail: crypto_freereq(crp); @@ -1050,6 +1097,7 @@ cryptodev_key(struct crypt_kop *kop) int in, out, size, i; if (kop->crk_iparams + kop->crk_oparams > CRK_MAXPARAM) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EFBIG); } @@ -1059,30 +1107,38 @@ cryptodev_key(struct crypt_kop *kop) case CRK_MOD_EXP: if (in == 3 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_MOD_EXP_CRT: if (in == 6 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DSA_SIGN: if (in == 5 && out == 2) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DSA_VERIFY: if (in == 7 && out == 0) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DH_COMPUTE_KEY: if (in == 3 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); default: + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, M_WAITOK|M_ZERO); - if (!krp) + if (!krp) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (ENOMEM); + } krp->krp_op = kop->crk_op; krp->krp_status = kop->crk_status; krp->krp_iparams = kop->crk_iparams; @@ -1092,9 +1148,11 @@ cryptodev_key(struct crypt_kop *kop) krp->krp_callback = (int (*) (struct cryptkop *)) cryptodevkey_cb; for (i = 0; i < CRK_MAXPARAM; i++) { - if (kop->crk_param[i].crp_nbits > 65536) + if (kop->crk_param[i].crp_nbits > 65536) { /* Limit is the same as in OpenBSD */ + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } krp->krp_param[i].crp_nbits = kop->crk_param[i].crp_nbits; } for (i = 0; i < krp->krp_iparams + krp->krp_oparams; i++) { @@ -1105,22 +1163,28 @@ cryptodev_key(struct crypt_kop *kop) if (i >= krp->krp_iparams) continue; error = copyin(kop->crk_param[i].crp_p, krp->krp_param[i].crp_p, size); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } } error = crypto_kdispatch(krp); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } error = tsleep(krp, PSOCK, "crydev", 0); if (error) { /* XXX can this happen? if so, how do we recover? */ + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; } kop->crk_crid = krp->krp_crid; /* device that did the work */ if (krp->krp_status != 0) { error = krp->krp_status; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; } @@ -1129,8 +1193,10 @@ cryptodev_key(struct crypt_kop *kop) if (size == 0) continue; error = copyout(krp->krp_param[i].crp_p, kop->crk_param[i].crp_p, size); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } } fail: From owner-svn-src-all@freebsd.org Sat Feb 24 01:15:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D60F05C1F; Sat, 24 Feb 2018 01:15:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06B5983E1B; Sat, 24 Feb 2018 01:15:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3BE31E4BF; Sat, 24 Feb 2018 01:15:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O1FXNo096869; Sat, 24 Feb 2018 01:15:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O1FXs9096868; Sat, 24 Feb 2018 01:15:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802240115.w1O1FXs9096868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 24 Feb 2018 01:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329888 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 01:15:34 -0000 Author: cem Date: Sat Feb 24 01:15:33 2018 New Revision: 329888 URL: https://svnweb.freebsd.org/changeset/base/329888 Log: kern/sys_generic.c: style(9) return(foo) -> return (foo) No functional change. Sponsored by: Dell EMC Isilon Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Fri Feb 23 23:56:33 2018 (r329887) +++ head/sys/kern/sys_generic.c Sat Feb 24 01:15:33 2018 (r329888) @@ -206,7 +206,7 @@ sys_read(td, uap) auio.uio_resid = uap->nbyte; auio.uio_segflg = UIO_USERSPACE; error = kern_readv(td, uap->fd, &auio); - return(error); + return (error); } /* @@ -369,7 +369,7 @@ dofileread(td, fd, fp, auio, offset, flags) /* Finish zero length reads right here */ if (auio->uio_resid == 0) { td->td_retval[0] = 0; - return(0); + return (0); } auio->uio_rw = UIO_READ; auio->uio_offset = offset; @@ -420,7 +420,7 @@ sys_write(td, uap) auio.uio_resid = uap->nbyte; auio.uio_segflg = UIO_USERSPACE; error = kern_writev(td, uap->fd, &auio); - return(error); + return (error); } /* @@ -459,7 +459,7 @@ kern_pwrite(struct thread *td, int fd, const void *buf auio.uio_resid = nbyte; auio.uio_segflg = UIO_USERSPACE; error = kern_pwritev(td, fd, &auio, offset); - return(error); + return (error); } #if defined(COMPAT_FREEBSD6) From owner-svn-src-all@freebsd.org Sat Feb 24 01:33:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FE2F06C31; Sat, 24 Feb 2018 01:33:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B6B484C95; Sat, 24 Feb 2018 01:33:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45E7D1E8A3; Sat, 24 Feb 2018 01:33:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O1XIJb006950; Sat, 24 Feb 2018 01:33:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O1XI3L006949; Sat, 24 Feb 2018 01:33:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201802240133.w1O1XI3L006949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 24 Feb 2018 01:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329890 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 329890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 01:33:18 -0000 Author: bdrewery Date: Sat Feb 24 01:33:17 2018 New Revision: 329890 URL: https://svnweb.freebsd.org/changeset/base/329890 Log: Fix installation with read-only OBJDIR. Reported by: npn Sponsored by: Dell EMC Modified: head/share/mk/src.sys.obj.mk Modified: head/share/mk/src.sys.obj.mk ============================================================================== --- head/share/mk/src.sys.obj.mk Sat Feb 24 01:24:57 2018 (r329889) +++ head/share/mk/src.sys.obj.mk Sat Feb 24 01:33:17 2018 (r329890) @@ -177,7 +177,8 @@ CheckAutoObj() { \ fi; \ } .if !empty(__objdir) -.if ${.CURDIR} == ${__objdir} +.if ${.CURDIR} == ${__objdir} || \ + (exists(${__objdir}) && ${.TARGETS:M*install*} == ${.TARGETS}) __objdir_writable?= yes .elif empty(__objdir_writable) __objdir_writable!= \ From owner-svn-src-all@freebsd.org Sat Feb 24 01:24:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92666F06390; Sat, 24 Feb 2018 01:24:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 443D0845AD; Sat, 24 Feb 2018 01:24:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F2141E6B7; Sat, 24 Feb 2018 01:24:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O1OwYX001713; Sat, 24 Feb 2018 01:24:58 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O1OwdL001712; Sat, 24 Feb 2018 01:24:58 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201802240124.w1O1OwdL001712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Sat, 24 Feb 2018 01:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329889 - head/sys/amd64/acpica X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/sys/amd64/acpica X-SVN-Commit-Revision: 329889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 01:24:58 -0000 Author: jkim Date: Sat Feb 24 01:24:57 2018 New Revision: 329889 URL: https://svnweb.freebsd.org/changeset/base/329889 Log: Partially revert r197863 to reduce diff against i386. When I wrote the patch, I wanted to remove SYSINIT() usage from amd64 code. There is no reason to keep the divergence any more because iwasaki merged most amd64 suspend/resume code to i386 with r235622. Note this also fixed an enge case reported by royger. [1] Suggested by: jhb Reviewed by: royger Tested by: royger [1] MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14400 [1] Modified: head/sys/amd64/acpica/acpi_machdep.c Modified: head/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- head/sys/amd64/acpica/acpi_machdep.c Sat Feb 24 01:15:33 2018 (r329888) +++ head/sys/amd64/acpica/acpi_machdep.c Sat Feb 24 01:24:57 2018 (r329889) @@ -63,6 +63,7 @@ acpi_machdep_init(device_t dev) sc = device_get_softc(dev); acpi_apm_init(sc); + acpi_install_wakeup_handler(sc); if (intr_model != ACPI_INTR_PIC) acpi_SetIntrModel(intr_model); @@ -349,20 +350,13 @@ nexus_acpi_probe(device_t dev) static int nexus_acpi_attach(device_t dev) { - device_t acpi_dev; - int error; nexus_init_resources(); bus_generic_probe(dev); - acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0); - if (acpi_dev == NULL) + if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL) panic("failed to add acpi0 device"); - error = bus_generic_attach(dev); - if (error == 0) - acpi_install_wakeup_handler(device_get_softc(acpi_dev)); - - return (error); + return (bus_generic_attach(dev)); } static device_method_t nexus_acpi_methods[] = { From owner-svn-src-all@freebsd.org Sat Feb 24 01:58:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA04DF09300; Sat, 24 Feb 2018 01:58:53 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7835085ECA; Sat, 24 Feb 2018 01:58:53 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 732A81ECCC; Sat, 24 Feb 2018 01:58:53 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O1wrRu017041; Sat, 24 Feb 2018 01:58:53 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O1wr30017040; Sat, 24 Feb 2018 01:58:53 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802240158.w1O1wr30017040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 24 Feb 2018 01:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329892 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 329892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 01:58:54 -0000 Author: cem Date: Sat Feb 24 01:58:53 2018 New Revision: 329892 URL: https://svnweb.freebsd.org/changeset/base/329892 Log: libsa: Change write(2)-alike prototype to match definition Broken in r329879. Apparently old GCC detects this, but modern GCC didn't. Mea culpa. Reported by: np Sponsored by: Dell EMC Isilon Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Sat Feb 24 01:46:56 2018 (r329891) +++ head/stand/libsa/stand.h Sat Feb 24 01:58:53 2018 (r329892) @@ -289,7 +289,7 @@ extern int open(const char *, int); extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); -extern ssize_t write(int, void *, size_t); +extern ssize_t write(int, const void *, size_t); extern struct dirent *readdirfd(int); extern void srandom(unsigned int); From owner-svn-src-all@freebsd.org Sat Feb 24 01:46:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 559E6F078E8; Sat, 24 Feb 2018 01:46:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 074DB854D9; Sat, 24 Feb 2018 01:46:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC1C41EAB3; Sat, 24 Feb 2018 01:46:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O1kux1012104; Sat, 24 Feb 2018 01:46:56 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O1kuLT012099; Sat, 24 Feb 2018 01:46:56 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802240146.w1O1kuLT012099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 24 Feb 2018 01:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329891 - in head/sys/powerpc: include mpc85xx powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include mpc85xx powerpc X-SVN-Commit-Revision: 329891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 01:46:57 -0000 Author: jhibbits Date: Sat Feb 24 01:46:56 2018 New Revision: 329891 URL: https://svnweb.freebsd.org/changeset/base/329891 Log: Remove platform_cpu_idle() and platform_cpu_idle_wakeup() interfaces These interfaces were put in place to let QorIQ SoCs dictate CPU idling semantics, in order to support capabilities such as NAP mode and deep sleep. However, this never stabilized, and the idling support reverted back to CPU-level rather than SoC level. Move this code back to cpu.c instead. If at a later date the lower power modes do come to fruition, it should be done by overriding the cpu_idle_hook instead of this platform hook. Modified: head/sys/powerpc/include/platform.h head/sys/powerpc/mpc85xx/platform_mpc85xx.c head/sys/powerpc/powerpc/cpu.c head/sys/powerpc/powerpc/platform.c head/sys/powerpc/powerpc/platform_if.m Modified: head/sys/powerpc/include/platform.h ============================================================================== --- head/sys/powerpc/include/platform.h Sat Feb 24 01:33:17 2018 (r329890) +++ head/sys/powerpc/include/platform.h Sat Feb 24 01:46:56 2018 (r329891) @@ -62,8 +62,6 @@ void platform_smp_ap_init(void); const char *installed_platform(void); void platform_probe_and_attach(void); -void platform_cpu_idle(int); - void platform_sleep(void); #endif /* _MACHINE_PLATFORM_H_ */ Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:33:17 2018 (r329890) +++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:46:56 2018 (r329891) @@ -95,8 +95,6 @@ static int mpc85xx_smp_next_cpu(platform_t, struct cpu static int mpc85xx_smp_get_bsp(platform_t, struct cpuref *cpuref); static int mpc85xx_smp_start_cpu(platform_t, struct pcpu *cpu); static void mpc85xx_smp_timebase_sync(platform_t, u_long tb, int ap); -static void mpc85xx_idle(platform_t, int cpu); -static int mpc85xx_idle_wakeup(platform_t plat, int cpu); static void mpc85xx_reset(platform_t); @@ -113,8 +111,6 @@ static platform_method_t mpc85xx_methods[] = { PLATFORMMETHOD(platform_smp_timebase_sync, mpc85xx_smp_timebase_sync), PLATFORMMETHOD(platform_reset, mpc85xx_reset), - PLATFORMMETHOD(platform_idle, mpc85xx_idle), - PLATFORMMETHOD(platform_idle_wakeup, mpc85xx_idle_wakeup), PLATFORMMETHOD_END }; @@ -539,28 +535,3 @@ mpc85xx_smp_timebase_sync(platform_t plat, u_long tb, mttb(tb); } -static void -mpc85xx_idle(platform_t plat, int cpu) -{ - uint32_t reg; - - if (mpc85xx_is_qoriq()) { - /* - * Base binutils doesn't know what the 'wait' instruction is, so - * use the opcode encoding here. - */ - __asm __volatile("wrteei 1; .long 0x7c00007c"); - } else { - reg = mfmsr(); - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (reg | PSL_WE)); - } -} - -static int -mpc85xx_idle_wakeup(platform_t plat, int cpu) -{ - - return (0); -} Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sat Feb 24 01:33:17 2018 (r329890) +++ head/sys/powerpc/powerpc/cpu.c Sat Feb 24 01:46:56 2018 (r329891) @@ -719,9 +719,29 @@ cpu_idle_60x(sbintime_t sbt) static void cpu_idle_booke(sbintime_t sbt) { + register_t msr; + uint16_t vers; -#ifdef BOOKE_E500 - platform_cpu_idle(PCPU_GET(cpuid)); + msr = mfmsr(); + vers = mfpvr() >> 16; + +#ifdef BOOKE + switch (vers) { + case FSL_E500mc: + case FSL_E5500: + case FSL_E6500: + /* + * Base binutils doesn't know what the 'wait' instruction is, so + * use the opcode encoding here. + */ + __asm __volatile(".long 0x7c00007c"); + break; + default: + powerpc_sync(); + mtmsr(msr | PSL_WE); + isync(); + break; + } #endif } Modified: head/sys/powerpc/powerpc/platform.c ============================================================================== --- head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:33:17 2018 (r329890) +++ head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:46:56 2018 (r329891) @@ -255,19 +255,6 @@ cpu_reset() PLATFORM_RESET(plat_obj); } -int -cpu_idle_wakeup(int cpu) -{ - return (PLATFORM_IDLE_WAKEUP(plat_obj, cpu)); -} - -void -platform_cpu_idle(int cpu) -{ - - PLATFORM_IDLE(plat_obj, cpu); -} - void platform_smp_timebase_sync(u_long tb, int ap) { Modified: head/sys/powerpc/powerpc/platform_if.m ============================================================================== --- head/sys/powerpc/powerpc/platform_if.m Sat Feb 24 01:33:17 2018 (r329890) +++ head/sys/powerpc/powerpc/platform_if.m Sat Feb 24 01:46:56 2018 (r329891) @@ -84,14 +84,6 @@ CODE { { return; } - static void platform_null_idle(platform_t plat, int cpu) - { - return; - } - static int platform_null_idle_wakeup(platform_t plat, int cpu) - { - return (0); - } }; /** @@ -217,22 +209,6 @@ METHOD cpu_group_t smp_topo { METHOD void reset { platform_t _plat; }; - -/** - * @brief Idle a CPU - */ -METHOD void idle { - platform_t _plat; - int _cpu; -} DEFAULT platform_null_idle; - -/** - * @brief Wake up an idle CPU - */ -METHOD int idle_wakeup { - platform_t _plat; - int _cpu; -} DEFAULT platform_null_idle_wakeup; /** * @brief Suspend the CPU From owner-svn-src-all@freebsd.org Sat Feb 24 02:05:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75100F096ED; Sat, 24 Feb 2018 02:05:26 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf0-x234.google.com (mail-pf0-x234.google.com [IPv6:2607:f8b0:400e:c00::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0AE6862F6; Sat, 24 Feb 2018 02:05:25 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf0-x234.google.com with SMTP id a17so4244130pff.8; Fri, 23 Feb 2018 18:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9WQuZWHjS7VxFCjmGyzALQ7RTNDA9OhTWsx7rwymoJg=; b=bBPlcuNgwCWqfxlqDzkhaY18/5TKUBRl6QYlrNJvlMxx1Tz+c6ZInvv+o6yFR9iSLW YqMroIyw0Shn+mQEB91uY8YiXX3heYa1Py+JX2WzWBR2j2LNNpaCh2gAs44ZyVKryE0P guroTrJhiuahTNdV/n5wgYFlcBkUytH63n4RablbgyuUH4Ei4lcWXypidlaXtOtznWZ/ Y6zZ2iaGpm94OuHEK1djtvux30zKKekWIS22hX0AEhhC2k+4Ir1GXmcgSsZm4RKAY7M4 +AEIe91CEtYneBvqXiuUlBTsgxPY59uswbHy5h5WOYV3sKhCMbXIckBcmpR9Oy8jcsPu b63w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=9WQuZWHjS7VxFCjmGyzALQ7RTNDA9OhTWsx7rwymoJg=; b=fqPACnSqMkASVklhujmPQ1yP35BLWp7MBOHIRxk8USMnFn7YTN+5+jNhIUHIsWKhtR AZt9VbJYnRS8A0Oabn6TlUX6kZ5jg7oUUJUUQkyOIZCqAVlhN/ch5xi6NnOYTPMGyGVl LbFWisUCLX9AC58GPuq+SuafJGBjj1FhKOr6EPVYg7LIQveyErDC/lHhTef16gr4Zaab ZN1lETmeTG6/dw/Ejn2BO2znq7598aPeelzqON1ockPLKjVsw63hPxvDqSpInn0mXOjg NA6/puhQi5/Hgizgyc11BOueaUeXDSgdUMgB+ap+Ygx0tXeeDDZWvJAx/yiTMr/n70wm N4/A== X-Gm-Message-State: APf1xPDXgjBknKRaVGYo+zzrkRLj34zcsSDaPRAGpXYMhzOscfgH2Zmo t+4hx0fPnhpIshkCMdJ/xcG1oo0o X-Google-Smtp-Source: AH8x225hKAm5XXxUuqBdrR0750OtvxCifO901LOidBtVFrzjg/bI6uSAA9OfZ+xlstp0rPzudZYJbA== X-Received: by 10.98.60.15 with SMTP id j15mr3607859pfa.7.1519437924937; Fri, 23 Feb 2018 18:05:24 -0800 (PST) Received: from [192.168.1.100] (152.94.214.218.sta.wbroadband.net.au. [218.214.94.152]) by smtp.gmail.com with ESMTPSA id d186sm7093981pfd.1.2018.02.23.18.05.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 18:05:24 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r329874 - in head: etc/mtree tests/sys/net To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201802231818.w1NIIhU6080295@repo.freebsd.org> From: Kubilay Kocak Message-ID: Date: Sat, 24 Feb 2018 13:05:00 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Thunderbird/54.0a2 MIME-Version: 1.0 In-Reply-To: <201802231818.w1NIIhU6080295@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 02:05:26 -0000 On 2/24/18 5:18 AM, Alan Somers wrote: > Unfortunately, most of the tests are disabled because they fairly frequently > trigger panics. Do the atf_skip annotations/reasons show up in the output even though they're not run? Somewhat related, do the test machines use debug bits and produce good debug output/backtraces in these situations? ./koobs From owner-svn-src-all@freebsd.org Sat Feb 24 02:57:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DABCF0D62A; Sat, 24 Feb 2018 02:57:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47355682C0; Sat, 24 Feb 2018 02:57:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 403D51F7C1; Sat, 24 Feb 2018 02:57:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O2vPt8046885; Sat, 24 Feb 2018 02:57:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O2vO7Y046881; Sat, 24 Feb 2018 02:57:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240257.w1O2vO7Y046881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 02:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329895 - in head/stand: liblua libsa X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: liblua libsa X-SVN-Commit-Revision: 329895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 02:57:25 -0000 Author: kevans Date: Sat Feb 24 02:57:24 2018 New Revision: 329895 URL: https://svnweb.freebsd.org/changeset/base/329895 Log: liblua: Implement write support Write support (even if it only works on UFS) will be needed for nextboot functionality. Reviewed by: cem, imp Differential Revision: https://reviews.freebsd.org/D14478 Modified: head/stand/liblua/lstd.c head/stand/liblua/lstd.h head/stand/liblua/lutils.c head/stand/libsa/stand.h Modified: head/stand/liblua/lstd.c ============================================================================== --- head/stand/liblua/lstd.c Sat Feb 24 02:52:39 2018 (r329894) +++ head/stand/liblua/lstd.c Sat Feb 24 02:57:24 2018 (r329895) @@ -35,13 +35,32 @@ FILE * fopen(const char *filename, const char *mode) { struct stat st; - int fd; + int fd, m, o; FILE *f; - if (mode == NULL || mode[0] != 'r') + if (mode == NULL) return NULL; - fd = open(filename, O_RDONLY); + switch (*mode++) { + case 'r': /* open for reading */ + m = O_RDONLY; + o = 0; + break; + + case 'w': /* open for writing */ + m = O_WRONLY; + /* These are not actually implemented yet */ + o = O_CREAT | O_TRUNC; + break; + + default: /* illegal mode */ + return (NULL); + } + + if (*mode == '+') + m = O_RDWR; + + fd = open(filename, m | o); if (fd < 0) return NULL; @@ -83,6 +102,21 @@ fread(void *ptr, size_t size, size_t count, FILE *stre stream->offset += r; return (r); +} + +size_t +fwrite(const void *ptr, size_t size, size_t count, FILE *stream) +{ + ssize_t w; + + if (stream == NULL || ptr == NULL) + return (0); + w = write(stream->fd, ptr, size * count); + if (w == -1) + return (0); + + stream->offset += w; + return ((size_t)w); } int Modified: head/stand/liblua/lstd.h ============================================================================== --- head/stand/liblua/lstd.h Sat Feb 24 02:52:39 2018 (r329894) +++ head/stand/liblua/lstd.h Sat Feb 24 02:57:24 2018 (r329895) @@ -51,6 +51,7 @@ typedef struct DIR FILE *fopen(const char *filename, const char *mode); FILE *freopen( const char *filename, const char *mode, FILE *stream); size_t fread(void *ptr, size_t size, size_t count, FILE *stream); +size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream); int fclose(FILE *stream); int ferror(FILE *stream); int feof(FILE *stream); Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Sat Feb 24 02:52:39 2018 (r329894) +++ head/stand/liblua/lutils.c Sat Feb 24 02:57:24 2018 (r329895) @@ -165,15 +165,24 @@ lua_printc(lua_State *L) static int lua_openfile(lua_State *L) { - const char *str; + const char *mode, *str; + int nargs; - if (lua_gettop(L) != 1) { + nargs = lua_gettop(L); + if (nargs < 1 || nargs > 2) { lua_pushnil(L); return 1; } str = lua_tostring(L, 1); - - FILE * f = fopen(str, "r"); + mode = "r"; + if (nargs > 1) { + mode = lua_tostring(L, 2); + if (mode == NULL) { + lua_pushnil(L); + return 1; + } + } + FILE * f = fopen(str, mode); if (f != NULL) { FILE ** ptr = (FILE**)lua_newuserdata(L, sizeof(FILE**)); *ptr = f; @@ -237,6 +246,61 @@ lua_readfile(lua_State *L) return 2; } +/* + * Implements io.write(file, ...) + * Any number of string and number arguments may be passed to it, + * and it will return the number of bytes written, or nil, an error string, and + * the errno. + */ +static int +lua_writefile(lua_State *L) +{ + FILE **f; + const char *buf; + int i, nargs; + size_t bufsz, w, wrsz; + + buf = NULL; + bufsz = 0; + w = 0; + wrsz = 0; + nargs = lua_gettop(L); + if (nargs < 2) { + errno = EINVAL; + return luaL_fileresult(L, 0, NULL); + } + + f = (FILE**)lua_touserdata(L, 1); + + if (f == NULL || *f == NULL) { + errno = EINVAL; + return luaL_fileresult(L, 0, NULL); + } + + /* Do a validation pass first */ + for (i = 0; i < nargs - 1; i++) { + /* + * With Lua's API, lua_isstring really checks if the argument + * is a string or a number. The latter will be implicitly + * converted to a string by our later call to lua_tolstring. + */ + if (!lua_isstring(L, i + 2)) { + errno = EINVAL; + return luaL_fileresult(L, 0, NULL); + } + } + for (i = 0; i < nargs - 1; i++) { + /* We've already validated; there's no chance of failure */ + buf = lua_tolstring(L, i + 2, &bufsz); + wrsz = fwrite(buf, 1, bufsz, *f); + if (wrsz < bufsz) + return luaL_fileresult(L, 0, NULL); + w += wrsz; + } + lua_pushinteger(L, w); + return 1; +} + #define REG_SIMPLE(n) { #n, lua_ ## n } static const struct luaL_Reg loaderlib[] = { REG_SIMPLE(delay), @@ -257,6 +321,7 @@ static const struct luaL_Reg iolib[] = { REG_SIMPLE(ischar), { "open", lua_openfile }, { "read", lua_readfile }, + { "write", lua_writefile }, { NULL, NULL }, }; #undef REG_SIMPLE Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Sat Feb 24 02:52:39 2018 (r329894) +++ head/stand/libsa/stand.h Sat Feb 24 02:57:24 2018 (r329895) @@ -286,6 +286,9 @@ extern int open(const char *, int); #define O_RDONLY 0x0 #define O_WRONLY 0x1 #define O_RDWR 0x2 +/* NOT IMPLEMENTED */ +#define O_CREAT 0x0200 /* create if nonexistent */ +#define O_TRUNC 0x0400 /* truncate to zero length */ extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); From owner-svn-src-all@freebsd.org Sat Feb 24 02:44:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C59EF0BD37; Sat, 24 Feb 2018 02:44:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x234.google.com (mail-lf0-x234.google.com [IPv6:2a00:1450:4010:c07::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0551687B0C; Sat, 24 Feb 2018 02:44:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x234.google.com with SMTP id v9so14962852lfa.11; Fri, 23 Feb 2018 18:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=zVJVC6y81akLSeeTn6ncGKhfgXu36cl4Xe8FW34entI=; b=eYr2N6XOegv+77Bj62FODCwQUk9FAU//VFJ/FQxFJnN0zgWV3obkLASvL5VBBmJGeh cU1pVc+w3EWN+a5D+GK+G+MilnVqvxVPkeBwzoeDXwH+bwbtd90Rpp9FRX+2JrlGkAJi bW6xqjHStPzjtfBMOhMXebGq+B+6POCdkBjyy+v+cYdHhk+XSDWrAHZQYuf+VEYwpBIq Yq+ZVc9wduo5KP4+9pxmSDEF3Qih3RE2alESUlXC0FEGRcqZzVA9YHGy6rfarNqzyVx4 9JtT7tu+V62f1zgaSJMiFVp0ccFswkZsuBIri4CLQb/q+nD8tZAlZagbjgNHnHxISoE7 +tQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=zVJVC6y81akLSeeTn6ncGKhfgXu36cl4Xe8FW34entI=; b=D9BkbShEBX/vYFBDYU3Klzy9uY7IFn7+Vy36CuhL9ofc8x+NrG91Jrg2dNYbPmJW1r OKsHYvB2J6/ZWEBEvanYRXhQHHOtj2ed2O0SUqAdql58Qa4omkyip6Rxh5RQ5J+Xp3Hl kWgctLs+JNEQlSVI7Q437awUKlTJwYv7ZKTdfXaV2K/K1nbgVMmMqkYuaxDxCpvJCEYz wSvk/28FA67LcExmkIDm7g2JkhX0r7YKwrjEelCZ1vEaKALOp+HS73XNnLO5XYaCT35d WCHHNIL+KlVctyJ22xa+Snzzpih/AsxZu2LIP4X47sfdaOT7K4+glo9LsIGj6z6ldr8K gacA== X-Gm-Message-State: APf1xPANsseprAAHN+k4cZ/G/GBeHmL2Cjk8N7zDArv54ub8+1H6NcWY kvhsEBDYwYN83W0MbPDEd55yc8l6CHjlB940bBI= X-Google-Smtp-Source: AG47ELuVudY3RllIgzBxIXAjvNmFGzSt4HqeeRyV7QtDssFAW5C0yn8uS+CvShh/QKwlQo1b6SKuIPcuWkehxWD+DEs= X-Received: by 10.46.20.30 with SMTP id u30mr2845846ljd.12.1519440259390; Fri, 23 Feb 2018 18:44:19 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.30.66 with HTTP; Fri, 23 Feb 2018 18:44:18 -0800 (PST) In-Reply-To: References: <201802231818.w1NIIhU6080295@repo.freebsd.org> From: Alan Somers Date: Fri, 23 Feb 2018 19:44:18 -0700 X-Google-Sender-Auth: VYX13c57vo3ZyDFljTXS9unB7wE Message-ID: Subject: Re: svn commit: r329874 - in head: etc/mtree tests/sys/net To: Kubilay Kocak Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 02:44:22 -0000 On Fri, Feb 23, 2018 at 7:05 PM, Kubilay Kocak wrote: > On 2/24/18 5:18 AM, Alan Somers wrote: > > Unfortunately, most of the tests are disabled because they fairly > frequently > > trigger panics. > > Do the atf_skip annotations/reasons show up in the output even though > they're not run? > Yep. > > Somewhat related, do the test machines use debug bits and produce good > debug output/backtraces in these situations? > Do you mean the test machine at ci.freebsd.org? AFAIK it's just like any other head system. Invariants are on by default. > > ./koobs > > > From owner-svn-src-all@freebsd.org Sat Feb 24 03:35:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59334F1019B; Sat, 24 Feb 2018 03:35:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07AD46A3E5; Sat, 24 Feb 2018 03:35:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 021E91FF25; Sat, 24 Feb 2018 03:35:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3ZZnw067557; Sat, 24 Feb 2018 03:35:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3ZZvr067556; Sat, 24 Feb 2018 03:35:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240335.w1O3ZZvr067556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 03:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329897 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:35:36 -0000 Author: kevans Date: Sat Feb 24 03:35:35 2018 New Revision: 329897 URL: https://svnweb.freebsd.org/changeset/base/329897 Log: lualoader: Add nextboot support config.parse now takes an extra callback that is invoked on the full text of the config file. This callback dictates where we should actually try to parse this file or not. For nextboot, we use this to halt parsing if we see 'nextboot_enable="NO"'. If we don't, parse it and write 'nextboot_enable="NO" ' to it. The same caveat as with forth still applies- writing is only supported by UFS. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 03:33:46 2018 (r329896) +++ head/stand/lua/config.lua Sat Feb 24 03:35:35 2018 (r329897) @@ -124,6 +124,27 @@ pattern_table = { } } +local function check_nextboot() + local nextboot_file = loader.getenv("nextboot_file") + if nextboot_file == nil then + return + end + + local function check_nextboot_disabled(text) + return not text:match("^nextboot_enable=\"NO\"") + end + + if not config.parse(nextboot_file, true, check_nextboot_disabled) then + -- This only fails if it actually hit a parse error + print("Failed to parse nextboot configuration: '" .. + nextboot_file .. "'") + end + + local nfile = io.open(nextboot_file, 'w') + io.write(nfile, "nextboot_enable=\"NO\" ") + io.close(nfile) +end + -- Module exports -- Which variables we changed config.env_changed = {} @@ -273,7 +294,9 @@ function config.loadmod(mod, silent) end -- silent runs will not return false if we fail to open the file -function config.parse(name, silent) +-- check_and_halt, if it's set, will be executed on the full text of the config +-- file. If it returns false, we are to halt immediately. +function config.parse(name, silent, check_and_halt) if silent == nil then silent = false end @@ -294,6 +317,13 @@ function config.parse(name, silent) return silent end + + if check_and_halt ~= nil then + if not check_and_halt(text) then + -- We'll just pretend that everything is fine... + return true + end + end local n = 1 local status = true @@ -438,6 +468,8 @@ function config.load(file) end end end + + check_nextboot() -- Cache the provided module_path at load time for later use config.module_path = loader.getenv("module_path") From owner-svn-src-all@freebsd.org Sat Feb 24 03:33:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97808F0FF63; Sat, 24 Feb 2018 03:33:47 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45E8A6A1D0; Sat, 24 Feb 2018 03:33:47 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 268681FF17; Sat, 24 Feb 2018 03:33:47 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3Xk9o067443; Sat, 24 Feb 2018 03:33:46 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3Xkic067442; Sat, 24 Feb 2018 03:33:46 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201802240333.w1O3Xkic067442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 24 Feb 2018 03:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329896 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 329896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:33:47 -0000 Author: mckusick Date: Sat Feb 24 03:33:46 2018 New Revision: 329896 URL: https://svnweb.freebsd.org/changeset/base/329896 Log: Relax the location restraints when validating one of the backup superblocks. Modified: head/sys/ufs/ffs/ffs_subr.c Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Sat Feb 24 02:57:24 2018 (r329895) +++ head/sys/ufs/ffs/ffs_subr.c Sat Feb 24 03:33:46 2018 (r329896) @@ -162,28 +162,28 @@ static int readsuper(void *, struct fs **, off_t, * The administrator must complete newfs before using this volume. */ int -ffs_sbget(void *devfd, struct fs **fsp, off_t altsuperblock, +ffs_sbget(void *devfd, struct fs **fsp, off_t altsblock, struct malloc_type *filltype, int (*readfunc)(void *devfd, off_t loc, void **bufp, int size)) { struct fs *fs; - int i, ret, size, blks; + int i, error, size, blks; uint8_t *space; int32_t *lp; char *buf; *fsp = NULL; - if (altsuperblock != -1) { - if ((ret = readsuper(devfd, fsp, altsuperblock, readfunc)) != 0) - return (ret); + if (altsblock != -1) { + if ((error = readsuper(devfd, fsp, -altsblock, readfunc)) != 0) + return (error); } else { for (i = 0; sblock_try[i] != -1; i++) { - if ((ret = readsuper(devfd, fsp, sblock_try[i], + if ((error = readsuper(devfd, fsp, sblock_try[i], readfunc)) == 0) break; - if (ret == ENOENT) + if (error == ENOENT) continue; - return (ret); + return (error); } if (sblock_try[i] == -1) return (ENOENT); @@ -209,13 +209,13 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsuper if (i + fs->fs_frag > blks) size = (blks - i) * fs->fs_fsize; buf = NULL; - ret = (*readfunc)(devfd, + error = (*readfunc)(devfd, dbtob(fsbtodb(fs, fs->fs_csaddr + i)), (void **)&buf, size); - if (ret) { + if (error) { UFS_FREE(buf, filltype); UFS_FREE(fs->fs_csp, filltype); fs->fs_csp = NULL; - return (ret); + return (error); } memcpy(space, buf, size); UFS_FREE(buf, filltype); @@ -242,8 +242,13 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo int (*readfunc)(void *devfd, off_t loc, void **bufp, int size)) { struct fs *fs; - int error; + int error, altblk; + altblk = 0; + if (sblockloc < 0) { + altblk = 1; + sblockloc = - sblockloc; + } error = (*readfunc)(devfd, sblockloc, (void **)fsp, SBLOCKSIZE); if (*fsp != NULL) (*fsp)->fs_csp = NULL; /* Not yet any summary information */ @@ -252,9 +257,10 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo fs = *fsp; if (fs->fs_magic == FS_BAD_MAGIC) return (EINVAL); - if (((fs->fs_magic == FS_UFS1_MAGIC && sblockloc <= SBLOCK_UFS1) || - (fs->fs_magic == FS_UFS2_MAGIC && - sblockloc == fs->fs_sblockloc)) && + if (((fs->fs_magic == FS_UFS1_MAGIC && (altblk || + sblockloc <= SBLOCK_UFS1)) || + (fs->fs_magic == FS_UFS2_MAGIC && (altblk || + sblockloc == fs->fs_sblockloc))) && fs->fs_ncg >= 1 && fs->fs_bsize >= MINBSIZE && fs->fs_bsize <= MAXBSIZE && From owner-svn-src-all@freebsd.org Sat Feb 24 03:43:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04308F106E4; Sat, 24 Feb 2018 03:43:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A69286AA45; Sat, 24 Feb 2018 03:43:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1886200E2; Sat, 24 Feb 2018 03:43:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3hAOW072455; Sat, 24 Feb 2018 03:43:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3hA0E072454; Sat, 24 Feb 2018 03:43:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240343.w1O3hA0E072454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 03:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329899 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:43:11 -0000 Author: kevans Date: Sat Feb 24 03:43:10 2018 New Revision: 329899 URL: https://svnweb.freebsd.org/changeset/base/329899 Log: lualoader: Correct test and name The functionality was correct, but our style guidelines tend to request that we shy away from using boolean operations in place of explicit comparisons to nil. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 03:38:51 2018 (r329898) +++ head/stand/lua/config.lua Sat Feb 24 03:43:10 2018 (r329899) @@ -130,11 +130,11 @@ local function check_nextboot() return end - local function check_nextboot_disabled(text) - return not text:match("^nextboot_enable=\"NO\"") + local function check_nextboot_enabled(text) + return text:match("^nextboot_enable=\"NO\"") == nil end - if not config.parse(nextboot_file, true, check_nextboot_disabled) then + if not config.parse(nextboot_file, true, check_nextboot_enabled) then -- This only fails if it actually hit a parse error print("Failed to parse nextboot configuration: '" .. nextboot_file .. "'") From owner-svn-src-all@freebsd.org Sat Feb 24 03:48:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D414F10BC0; Sat, 24 Feb 2018 03:48:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3466AE98; Sat, 24 Feb 2018 03:48:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34421200F9; Sat, 24 Feb 2018 03:48:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3mrU1072786; Sat, 24 Feb 2018 03:48:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3mriA072785; Sat, 24 Feb 2018 03:48:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240348.w1O3mriA072785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 03:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329902 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:48:53 -0000 Author: kevans Date: Sat Feb 24 03:48:52 2018 New Revision: 329902 URL: https://svnweb.freebsd.org/changeset/base/329902 Log: lualoader: Remove unused variable; we now use the effective line number Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Sat Feb 24 03:47:04 2018 (r329901) +++ head/stand/lua/drawer.lua Sat Feb 24 03:48:52 2018 (r329902) @@ -277,7 +277,7 @@ function drawer.drawmenu(m) if type(menu_entries) == "function" then menu_entries = menu_entries() end - for line_num, e in ipairs(menu_entries) do + for _, e in ipairs(menu_entries) do -- Allow menu items to be conditionally visible by specifying -- a visible function. if e.visible ~= nil and not e.visible() then From owner-svn-src-all@freebsd.org Sat Feb 24 04:02:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD023F11919; Sat, 24 Feb 2018 04:02:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 818D46B7C1; Sat, 24 Feb 2018 04:02:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C6B12041C; Sat, 24 Feb 2018 04:02:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O426vW081755; Sat, 24 Feb 2018 04:02:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O4267k081754; Sat, 24 Feb 2018 04:02:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240402.w1O4267k081754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 04:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329903 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 04:02:07 -0000 Author: kevans Date: Sat Feb 24 04:02:06 2018 New Revision: 329903 URL: https://svnweb.freebsd.org/changeset/base/329903 Log: lualoader: Explain nextboot stuff a little bit more Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 03:48:52 2018 (r329902) +++ head/stand/lua/config.lua Sat Feb 24 04:02:06 2018 (r329903) @@ -140,12 +140,17 @@ local function check_nextboot() nextboot_file .. "'") end + -- Attempt to rewrite the first line and only the first line of the + -- nextboot_file. We overwrite it with nextboot_enable="NO", then + -- check for that on load. See: check_nextboot_enabled + -- It's worth noting that this won't work on every filesystem, so we + -- won't do anything notable if we have any errors in this process. local nfile = io.open(nextboot_file, 'w') if nfile ~= nil then - -- We're overwriting the first line of the file, so we need the - -- trailing space to account for the extra character taken up by - -- the string nextboot_enable="YES" -- our new end quotation - -- mark lands on the S. + -- We need the trailing space here to account for the extra + -- character taken up by the string nextboot_enable="YES" + -- Or new end quotation mark lands on the S, and we want to + -- rewrite the entirety of the first line. io.write(nfile, "nextboot_enable=\"NO\" ") io.close(nfile) end From owner-svn-src-all@freebsd.org Sat Feb 24 03:38:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21CE2F102AF; Sat, 24 Feb 2018 03:38:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE14A6A564; Sat, 24 Feb 2018 03:38:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5DE31FF2D; Sat, 24 Feb 2018 03:38:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3cpLE067696; Sat, 24 Feb 2018 03:38:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3cpe6067695; Sat, 24 Feb 2018 03:38:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240338.w1O3cpe6067695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 03:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329898 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:38:52 -0000 Author: kevans Date: Sat Feb 24 03:38:51 2018 New Revision: 329898 URL: https://svnweb.freebsd.org/changeset/base/329898 Log: lualoader: Plug file handle not properly closed Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 03:35:35 2018 (r329897) +++ head/stand/lua/config.lua Sat Feb 24 03:38:51 2018 (r329898) @@ -309,6 +309,8 @@ function config.parse(name, silent, check_and_halt) end local text, _ = io.read(f) + -- We might have read in the whole file, this won't be needed any more. + io.close(f) if text == nil then if not silent then From owner-svn-src-all@freebsd.org Sat Feb 24 03:47:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B60B0F10A8D; Sat, 24 Feb 2018 03:47:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6986E6AD7C; Sat, 24 Feb 2018 03:47:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 641DF200F3; Sat, 24 Feb 2018 03:47:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O3l42r072693; Sat, 24 Feb 2018 03:47:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O3l4YV072692; Sat, 24 Feb 2018 03:47:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802240347.w1O3l4YV072692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 03:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329901 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 03:47:04 -0000 Author: kevans Date: Sat Feb 24 03:47:04 2018 New Revision: 329901 URL: https://svnweb.freebsd.org/changeset/base/329901 Log: lualoader: Add comment on trailing space, don't operate on nil Functionally, the latter error wouldn't necessarily hurt anything. io.write will just error out as it's not passed a valid file handle. Still, we can do better than that. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 03:45:50 2018 (r329900) +++ head/stand/lua/config.lua Sat Feb 24 03:47:04 2018 (r329901) @@ -141,8 +141,14 @@ local function check_nextboot() end local nfile = io.open(nextboot_file, 'w') - io.write(nfile, "nextboot_enable=\"NO\" ") - io.close(nfile) + if nfile ~= nil then + -- We're overwriting the first line of the file, so we need the + -- trailing space to account for the extra character taken up by + -- the string nextboot_enable="YES" -- our new end quotation + -- mark lands on the S. + io.write(nfile, "nextboot_enable=\"NO\" ") + io.close(nfile) + end end -- Module exports From owner-svn-src-all@freebsd.org Sat Feb 24 05:24:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB20F15AA9; Sat, 24 Feb 2018 05:24:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBCD66E83F; Sat, 24 Feb 2018 05:24:01 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f47.google.com with SMTP id v194so5587524itb.0; Fri, 23 Feb 2018 21:24:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=jNSfR5sYpL4J7yFy3hIrfqz/1jrg4PqDLgKgDzveUXA=; b=BPLlaWYb4sESBGnOPkj4ypY+a1bbu3t2bJ/zbi+O2n3DHu+11uKdciow2oqGvzsXd4 vAOterwnmRSu7x1esNCmDyCzKOsmjDxvBTH9/8URDx0uOgJhJ9dl3RsccbQyem1Ego+4 55RG/sd4EvDbLCEKJ0csSKB5TtFC+XYfJGChgdwD4MvMTFvhEgK8600S/1bzXd97u2OZ RRoijWqA7vee6xqgL9PUhqgTOg8Kg5pqYKbU8AiQMjl9Gyu786ohmxfDe5aoBn/AJ5I4 ydLX6u360BE5T+hpIugARzSUH7T1qrUCdugds5otfBaUCd+GWaZtDdv1RnA1f4WKZ+yq WELg== X-Gm-Message-State: APf1xPAwUfzBA6JV4M5VV6XSrBmGna1mI1yO66nDmCAx1IkvWqSwcwZo kb4M69ecXsxQSsFV+AOwJANMZUYX X-Google-Smtp-Source: AG47ELt0rRMih7AVEflMs5bqj3aqScNFGU8KfNREWgaC9YoeVkbgb0JX0wrqYIQLDPL68+8RpLEMEA== X-Received: by 10.36.91.201 with SMTP id g192mr5321208itb.101.1519449834769; Fri, 23 Feb 2018 21:23:54 -0800 (PST) Received: from mail-io0-f173.google.com (mail-io0-f173.google.com. [209.85.223.173]) by smtp.gmail.com with ESMTPSA id g65sm2339838itd.3.2018.02.23.21.23.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 21:23:54 -0800 (PST) Received: by mail-io0-f173.google.com with SMTP id b34so11999542ioj.6; Fri, 23 Feb 2018 21:23:54 -0800 (PST) X-Received: by 10.107.161.79 with SMTP id k76mr4452367ioe.19.1519449834330; Fri, 23 Feb 2018 21:23:54 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Fri, 23 Feb 2018 21:23:53 -0800 (PST) In-Reply-To: <201802240333.w1O3Xkic067442@repo.freebsd.org> References: <201802240333.w1O3Xkic067442@repo.freebsd.org> From: Conrad Meyer Date: Fri, 23 Feb 2018 21:23:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329896 - head/sys/ufs/ffs To: Kirk McKusick Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 05:24:02 -0000 On Fri, Feb 23, 2018 at 7:33 PM, Kirk McKusick wrote: > Author: mckusick > Date: Sat Feb 24 03:33:46 2018 > New Revision: 329896 > URL: https://svnweb.freebsd.org/changeset/base/329896 > > Log: > Relax the location restraints when validating one of the > backup superblocks. Hi Kirk, For future readers, would you mind elaborating a little bit about why the code was the way it was and why that was too strict? Thanks, Conrad From owner-svn-src-all@freebsd.org Sat Feb 24 08:44:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFD56F23B15; Sat, 24 Feb 2018 08:44:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8257975996; Sat, 24 Feb 2018 08:44:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D1F723363; Sat, 24 Feb 2018 08:44:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1O8ipIP021888; Sat, 24 Feb 2018 08:44:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1O8ipGJ021887; Sat, 24 Feb 2018 08:44:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802240844.w1O8ipGJ021887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 24 Feb 2018 08:44:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329904 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 329904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 08:44:52 -0000 Author: hselasky Date: Sat Feb 24 08:44:51 2018 New Revision: 329904 URL: https://svnweb.freebsd.org/changeset/base/329904 Log: Fix race when detach is called right after attach in if_axge, that the network device pointer might be NULL. Wait for any pending tasks to complete before calling axge_stop(). MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/net/if_axge.c Modified: head/sys/dev/usb/net/if_axge.c ============================================================================== --- head/sys/dev/usb/net/if_axge.c Sat Feb 24 04:02:06 2018 (r329903) +++ head/sys/dev/usb/net/if_axge.c Sat Feb 24 08:44:51 2018 (r329904) @@ -587,6 +587,10 @@ axge_detach(device_t dev) sc = device_get_softc(dev); ue = &sc->sc_ue; if (device_is_attached(dev)) { + + /* wait for any post attach or other command to complete */ + usb_proc_drain(&ue->ue_tq); + AXGE_LOCK(sc); /* * XXX @@ -878,7 +882,8 @@ axge_stop(struct usb_ether *ue) val &= ~MSR_RE; axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_MSR, val); - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if (ifp != NULL) + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->sc_flags &= ~AXGE_FLAG_LINK; /* From owner-svn-src-all@freebsd.org Sat Feb 24 10:26:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A421AF2A0C5; Sat, 24 Feb 2018 10:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5416379B87; Sat, 24 Feb 2018 10:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E66824414; Sat, 24 Feb 2018 10:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OAQQfO072688; Sat, 24 Feb 2018 10:26:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OAQQ6v072687; Sat, 24 Feb 2018 10:26:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802241026.w1OAQQ6v072687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Feb 2018 10:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329905 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 329905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 10:26:26 -0000 Author: kib Date: Sat Feb 24 10:26:26 2018 New Revision: 329905 URL: https://svnweb.freebsd.org/changeset/base/329905 Log: Hide all vm/vm_pageout.h content under #ifdef _KERNEL. There are no parts useful for usermode applications in vm/vm_pageout.h. Even for the specific applications like fstat and lsof. In my opinion, this protection is redundant and instead userspace should not include the header at all. Since there are apparently broken third party codebases, give them a bit of slack by providing transitional period. Reported by: julian Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_pageout.h Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Sat Feb 24 08:44:51 2018 (r329904) +++ head/sys/vm/vm_pageout.h Sat Feb 24 10:26:26 2018 (r329905) @@ -65,6 +65,8 @@ #ifndef _VM_VM_PAGEOUT_H_ #define _VM_VM_PAGEOUT_H_ +#ifdef _KERNEL + /* * Header file for pageout daemon. */ @@ -100,11 +102,10 @@ void vm_wait_domain(int domain); void vm_wait_min(void); void vm_wait_severe(void); -#ifdef _KERNEL int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *); void vm_pageout_oom(int shortage); void vm_swapout_run(void); void vm_swapout_run_idle(void); -#endif +#endif /* _KERNEL */ #endif /* _VM_VM_PAGEOUT_H_ */ From owner-svn-src-all@freebsd.org Sat Feb 24 10:33:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D5AEF2AB5A; Sat, 24 Feb 2018 10:33:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C11487A2B7; Sat, 24 Feb 2018 10:33:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBCFC245AB; Sat, 24 Feb 2018 10:33:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OAXV1o077640; Sat, 24 Feb 2018 10:33:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OAXV7i077639; Sat, 24 Feb 2018 10:33:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201802241033.w1OAXV7i077639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 24 Feb 2018 10:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329906 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 329906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 10:33:32 -0000 Author: andrew Date: Sat Feb 24 10:33:31 2018 New Revision: 329906 URL: https://svnweb.freebsd.org/changeset/base/329906 Log: Correctly set the 16kB page size field in the ITS BASER register. Some new arm64 hardware, e.g. ThunderX2, seems to use this page size so was failing to attach as the register value read back was incorrect. While here fix the spelling on shareability. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Sat Feb 24 10:26:26 2018 (r329905) +++ head/sys/arm64/arm64/gicv3_its.c Sat Feb 24 10:33:31 2018 (r329906) @@ -489,7 +489,7 @@ gicv3_its_table_init(device_t dev, struct gicv3_its_so break; case PAGE_SIZE_16K: /* 16KB */ reg |= - GITS_BASER_PSZ_4K << GITS_BASER_PSZ_SHIFT; + GITS_BASER_PSZ_16K << GITS_BASER_PSZ_SHIFT; break; case PAGE_SIZE_64K: /* 64KB */ reg |= @@ -502,7 +502,7 @@ gicv3_its_table_init(device_t dev, struct gicv3_its_so /* Read back to check */ tmp = gic_its_read_8(sc, GITS_BASER(i)); - /* Do the snareability masks line up? */ + /* Do the shareability masks line up? */ if ((tmp & GITS_BASER_SHARE_MASK) != (reg & GITS_BASER_SHARE_MASK)) { share = (tmp & GITS_BASER_SHARE_MASK) >> From owner-svn-src-all@freebsd.org Sat Feb 24 13:04:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B4E9F0F4E0; Sat, 24 Feb 2018 13:04:03 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD96F81045; Sat, 24 Feb 2018 13:04:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B86CB25E73; Sat, 24 Feb 2018 13:04:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OD42oR053565; Sat, 24 Feb 2018 13:04:02 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OD429l053564; Sat, 24 Feb 2018 13:04:02 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802241304.w1OD429l053564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 24 Feb 2018 13:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329907 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 329907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 13:04:03 -0000 Author: ae Date: Sat Feb 24 13:04:02 2018 New Revision: 329907 URL: https://svnweb.freebsd.org/changeset/base/329907 Log: MFC r329561: Check packet length to do not make out of bounds access. Also save ah_nxt value to use it later, since ah pointer can become invalid. Reported by: Maxime Villard Modified: stable/11/sys/netipsec/xform_ah.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/xform_ah.c ============================================================================== --- stable/11/sys/netipsec/xform_ah.c Sat Feb 24 10:33:31 2018 (r329906) +++ stable/11/sys/netipsec/xform_ah.c Sat Feb 24 13:04:02 2018 (r329907) @@ -582,6 +582,16 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski error = EACCES; goto bad; } + if (skip + authsize + rplen > m->m_pkthdr.len) { + DPRINTF(("%s: bad mbuf length %u (expecting %lu)" + " for packet in SA %s/%08lx\n", __func__, + m->m_pkthdr.len, (u_long) (skip + authsize + rplen), + ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)), + (u_long) ntohl(sav->spi))); + AHSTAT_INC(ahs_badauthl); + error = EACCES; + goto bad; + } AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl); /* Get crypto descriptors. */ @@ -626,6 +636,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Zeroize the authenticator on the packet. */ m_copyback(m, skip + rplen, authsize, ipseczeroes); + /* Save ah_nxt, since ah pointer can become invalid after "massage" */ + hl = ah->ah_nxt; + /* "Massage" the packet headers for crypto processing. */ error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family, skip, ahx->type, 0); @@ -648,7 +661,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* These are passed as-is to the callback. */ xd->sav = sav; - xd->nxt = ah->ah_nxt; + xd->nxt = hl; xd->protoff = protoff; xd->skip = skip; xd->cryptoid = cryptoid; From owner-svn-src-all@freebsd.org Sat Feb 24 14:34:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53D27F235B2; Sat, 24 Feb 2018 14:34:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0697D86135; Sat, 24 Feb 2018 14:34:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0189B26D93; Sat, 24 Feb 2018 14:34:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OEYNlx001177; Sat, 24 Feb 2018 14:34:23 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OEYNwM001176; Sat, 24 Feb 2018 14:34:23 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201802241434.w1OEYNwM001176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 24 Feb 2018 14:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329908 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 329908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 14:34:24 -0000 Author: cognet Date: Sat Feb 24 14:34:23 2018 New Revision: 329908 URL: https://svnweb.freebsd.org/changeset/base/329908 Log: Use NULL as a mtx type instead of "", as it otherwise confuses WITNESS. Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Sat Feb 24 13:04:02 2018 (r329907) +++ head/sys/arm/arm/gic.c Sat Feb 24 14:34:23 2018 (r329908) @@ -448,7 +448,7 @@ arm_gic_attach(device_t dev) gic_sc = sc; /* Initialize mutex */ - mtx_init(&sc->mutex, "GIC lock", "", MTX_SPIN); + mtx_init(&sc->mutex, "GIC lock", NULL, MTX_SPIN); /* Distributor Interface */ sc->gic_d_bst = rman_get_bustag(sc->gic_res[0]); @@ -1423,7 +1423,7 @@ arm_gicv2m_attach(device_t dev) arm_gic_reserve_msi_range(device_get_parent(dev), sc->sc_spi_start, sc->sc_spi_count); - mtx_init(&sc->sc_mutex, "GICv2m lock", "", MTX_DEF); + mtx_init(&sc->sc_mutex, "GICv2m lock", NULL, MTX_DEF); intr_msi_register(dev, sc->sc_xref); From owner-svn-src-all@freebsd.org Sat Feb 24 15:13:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 873B4F26D8D; Sat, 24 Feb 2018 15:13:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C3DC6839A; Sat, 24 Feb 2018 15:13:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3707E27449; Sat, 24 Feb 2018 15:13:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OFDLpw022214; Sat, 24 Feb 2018 15:13:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OFDLIM022213; Sat, 24 Feb 2018 15:13:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802241513.w1OFDLIM022213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 24 Feb 2018 15:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329909 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 329909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 15:13:21 -0000 Author: asomers Date: Sat Feb 24 15:13:20 2018 New Revision: 329909 URL: https://svnweb.freebsd.org/changeset/base/329909 Log: tests: require ksh93 in the Kyuafiles for all atf-ksh93 test programs Modified: head/share/mk/atf.test.mk Modified: head/share/mk/atf.test.mk ============================================================================== --- head/share/mk/atf.test.mk Sat Feb 24 14:34:23 2018 (r329908) +++ head/share/mk/atf.test.mk Sat Feb 24 15:13:20 2018 (r329909) @@ -88,6 +88,7 @@ _TESTS+= ${ATF_TESTS_KSH93} .for _T in ${ATF_TESTS_KSH93} SCRIPTSDIR_${_T}= ${TESTSDIR} TEST_INTERFACE.${_T}= atf +TEST_METADATA.${_T}+= required_programs="ksh93" CLEANFILES+= ${_T} ${_T}.tmp # TODO(jmmv): It seems to me that this SED and SRC functionality should # exist in bsd.prog.mk along the support for SCRIPTS. Move it there if From owner-svn-src-all@freebsd.org Sat Feb 24 16:01:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA46DF2AB51; Sat, 24 Feb 2018 16:01:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 973186A450; Sat, 24 Feb 2018 16:01:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91EF327B15; Sat, 24 Feb 2018 16:01:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OG1LPH043734; Sat, 24 Feb 2018 16:01:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OG1LQ3043733; Sat, 24 Feb 2018 16:01:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802241601.w1OG1LQ3043733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 24 Feb 2018 16:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329910 - head/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Commit-Revision: 329910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 16:01:22 -0000 Author: asomers Date: Sat Feb 24 16:01:21 2018 New Revision: 329910 URL: https://svnweb.freebsd.org/changeset/base/329910 Log: Implement CTASSERT using _Static_assert Prevents warnings about "unused typedef" with GCC-6 Reported by: GCC-6 MFC after: 18 days X-MFC-With: 329722 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb 24 15:13:20 2018 (r329909) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb 24 16:01:21 2018 (r329910) @@ -133,8 +133,8 @@ _NOTE(CONSTCOND) } while (0) #ifndef CTASSERT #define CTASSERT(x) _CTASSERT(x, __LINE__) #define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) \ - typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] +#define __CTASSERT(x, y) \ + _Static_assert((x), "Static assert failed at " #y) #endif #ifdef _KERNEL From owner-svn-src-all@freebsd.org Sat Feb 24 16:28:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06900F2C54C; Sat, 24 Feb 2018 16:28:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6DD36B4DD; Sat, 24 Feb 2018 16:28:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A175627FB1; Sat, 24 Feb 2018 16:28:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OGSjjR058028; Sat, 24 Feb 2018 16:28:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OGSjfe058027; Sat, 24 Feb 2018 16:28:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201802241628.w1OGSjfe058027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Feb 2018 16:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329911 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 329911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 16:28:46 -0000 Author: ian Date: Sat Feb 24 16:28:45 2018 New Revision: 329911 URL: https://svnweb.freebsd.org/changeset/base/329911 Log: Add a functional detach() routine, to make things kldunload-friendly. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sat Feb 24 16:01:21 2018 (r329910) +++ head/sys/dev/flash/mx25l.c Sat Feb 24 16:28:45 2018 (r329911) @@ -89,8 +89,13 @@ struct mx25l_softc struct proc *sc_p; struct bio_queue_head sc_bio_queue; unsigned int sc_flags; + unsigned int sc_taskstate; }; +#define TSTATE_STOPPED 0 +#define TSTATE_STOPPING 1 +#define TSTATE_RUNNING 2 + #define M25PXX_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define M25PXX_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define M25PXX_LOCK_INIT(_sc) \ @@ -527,6 +532,8 @@ mx25l_attach(device_t dev) bioq_init(&sc->sc_bio_queue); kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash"); + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(sc->sc_dev, "%s, sector %d bytes, %d sectors\n", ident->name, ident->sectorsize, ident->sectorcount); @@ -536,8 +543,33 @@ mx25l_attach(device_t dev) static int mx25l_detach(device_t dev) { + struct mx25l_softc *sc; + int err; - return (EIO); + sc = device_get_softc(dev); + err = 0; + + M25PXX_LOCK(sc); + if (sc->sc_taskstate == TSTATE_RUNNING) { + sc->sc_taskstate = TSTATE_STOPPING; + wakeup(sc); + while (err == 0 && sc->sc_taskstate != TSTATE_STOPPED) { + err = msleep(sc, &sc->sc_mtx, 0, "mx25dt", hz * 3); + if (err != 0) { + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(dev, + "Failed to stop queue task\n"); + } + } + } + M25PXX_UNLOCK(sc); + + if (err == 0 && sc->sc_taskstate == TSTATE_STOPPED) { + disk_destroy(sc->sc_disk); + bioq_flush(&sc->sc_bio_queue, NULL, ENXIO); + M25PXX_LOCK_DESTROY(sc); + } + return (err); } static int @@ -605,9 +637,15 @@ mx25l_task(void *arg) dev = sc->sc_dev; M25PXX_LOCK(sc); do { + if (sc->sc_taskstate == TSTATE_STOPPING) { + sc->sc_taskstate = TSTATE_STOPPED; + M25PXX_UNLOCK(sc); + wakeup(sc); + kproc_exit(0); + } bp = bioq_first(&sc->sc_bio_queue); if (bp == NULL) - msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); + msleep(sc, &sc->sc_mtx, PRIBIO, "mx25jq", 0); } while (bp == NULL); bioq_remove(&sc->sc_bio_queue, bp); M25PXX_UNLOCK(sc); From owner-svn-src-all@freebsd.org Sat Feb 24 16:31:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3328F2C824; Sat, 24 Feb 2018 16:31:27 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5030D6B771; Sat, 24 Feb 2018 16:31:27 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31329280F5; Sat, 24 Feb 2018 16:31:27 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OGVReB059078; Sat, 24 Feb 2018 16:31:27 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OGVQb7059076; Sat, 24 Feb 2018 16:31:26 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201802241631.w1OGVQb7059076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 24 Feb 2018 16:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329912 - in head/lib/libcasper: libcasper services/cap_dns X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/lib/libcasper: libcasper services/cap_dns X-SVN-Commit-Revision: 329912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 16:31:28 -0000 Author: oshogbo Date: Sat Feb 24 16:31:26 2018 New Revision: 329912 URL: https://svnweb.freebsd.org/changeset/base/329912 Log: Fix reference to nvlist in man pages. Reviewed by: @bcr @brueffer Pointed out by: @brueffer Differential Revision: https://reviews.freebsd.org/D14410 Modified: head/lib/libcasper/libcasper/libcasper.3 head/lib/libcasper/services/cap_dns/cap_dns.3 Modified: head/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- head/lib/libcasper/libcasper/libcasper.3 Sat Feb 24 16:28:45 2018 (r329911) +++ head/lib/libcasper/libcasper/libcasper.3 Sat Feb 24 16:31:26 2018 (r329912) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 17, 2018 +.Dd February 24, 2018 .Dt LIBCASPER 3 .Os .Sh NAME @@ -160,25 +160,34 @@ it means there are no limits set. The .Fn cap_limit_set function sets limits for the given capability. -The limits are provided as nvlist. +The limits are provided as +.Xr nvlist 9 . The exact format depends on the service the capability represents. .Pp The .Fn cap_send_nvlist -function sends the given nvlist over the given capability. +function sends the given +.Xr nvlist 9 +over the given capability. This is low level interface to communicate with casper services. Most services should provide higher level API. .Pp The .Fn cap_recv_nvlist -function receives the given nvlist over the given capability. +function receives the given +.Xr nvlist 9 +over the given capability. .Pp The .Fn cap_xfer_nvlist -function sends the given nvlist, destroys it and receives new nvlist in -response over the given capability. -It does not matter if the function succeeds or fails, the nvlist given -for sending will always be destroyed once the function returns. +function sends the given +.Xr nvlist 9, +destroys it and receives new +.Xr nvlist 9 +in response over the given capability. +It does not matter if the function succeeds or fails, the +.Xr nvlist 9 +given for sending will always be destroyed once the function returns. .Pp The .Fn cap_service_open Modified: head/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.3 Sat Feb 24 16:28:45 2018 (r329911) +++ head/lib/libcasper/services/cap_dns/cap_dns.3 Sat Feb 24 16:31:26 2018 (r329912) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 10, 2018 +.Dd February 24, 2018 .Dt CAP_DNS 3 .Os .Sh NAME @@ -105,7 +105,9 @@ and .Fn cap_dns_family_limit functions, but the limits of service can be set also using .Xr cap_limit_set 3 . -The nvlist for that function can contain the following values and types: +The +.Xr nvlist 9 +for that function can contain the following values and types: .Bl -ohang -offset indent .It type ( NV_TYPE_STRING ) The From owner-svn-src-all@freebsd.org Sat Feb 24 16:50:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB924F2DDB3; Sat, 24 Feb 2018 16:50:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C4B46C4D6; Sat, 24 Feb 2018 16:50:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6722B28312; Sat, 24 Feb 2018 16:50:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OGovIX070767; Sat, 24 Feb 2018 16:50:57 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OGovSU070766; Sat, 24 Feb 2018 16:50:57 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201802241650.w1OGovSU070766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 24 Feb 2018 16:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r329913 - stable/10/sys/net X-SVN-Group: stable-10 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/10/sys/net X-SVN-Commit-Revision: 329913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 16:50:57 -0000 Author: eugen Date: Sat Feb 24 16:50:57 2018 New Revision: 329913 URL: https://svnweb.freebsd.org/changeset/base/329913 Log: Fix after incomplete MFC r326012: correctly delete loopback route while removing interface address. Reported by: Andreas Longwitz Approved by: avg (mentor) Modified: stable/10/sys/net/if.c Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Sat Feb 24 16:31:26 2018 (r329912) +++ stable/10/sys/net/if.c Sat Feb 24 16:50:57 2018 (r329913) @@ -1699,7 +1699,7 @@ ifa_del_loopback_route(struct ifaddr *ifa, struct sock null_sdl.sdl_type = ifa->ifa_ifp->if_type; null_sdl.sdl_index = ifa->ifa_ifp->if_index; bzero(&info, sizeof(info)); - info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; info.rti_info[RTAX_DST] = ia; info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; error = rtrequest1_fib(RTM_DELETE, &info, NULL, ifa->ifa_ifp->if_fib); From owner-svn-src-all@freebsd.org Sat Feb 24 17:13:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80FDDF2F46E; Sat, 24 Feb 2018 17:13:16 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 251E96D2D4; Sat, 24 Feb 2018 17:13:16 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FCB7287C1; Sat, 24 Feb 2018 17:13:16 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OHDF1e083384; Sat, 24 Feb 2018 17:13:15 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OHDFhx083383; Sat, 24 Feb 2018 17:13:15 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201802241713.w1OHDFhx083383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sat, 24 Feb 2018 17:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329914 - head/cddl/lib/libdtrace X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/cddl/lib/libdtrace X-SVN-Commit-Revision: 329914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 17:13:16 -0000 Author: dteske Date: Sat Feb 24 17:13:15 2018 New Revision: 329914 URL: https://svnweb.freebsd.org/changeset/base/329914 Log: Updates and enhancements to io.d to aid DTrace scripting + Add dev_type do devinfo_t + Add b_cmd to bufinfo_t + Add constants for BIO_* and DEVSTAT_TYPE_* + Add inline for converting BIO_* int to string + Add inline for converting DEVSTAT_TYPE_* int to string + Add mask for dev_type & DEVSTAT_TYPE_MASK to string + Add mask for dev_type & DEVSTAT_TYPE_IF_MASK to string Reviewed by: markj Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/D14396 Modified: head/cddl/lib/libdtrace/io.d Modified: head/cddl/lib/libdtrace/io.d ============================================================================== --- head/cddl/lib/libdtrace/io.d Sat Feb 24 16:50:57 2018 (r329913) +++ head/cddl/lib/libdtrace/io.d Sat Feb 24 17:13:15 2018 (r329914) @@ -18,6 +18,8 @@ * * CDDL HEADER END * + * Portions Copyright 2018 Devin Teske dteske@freebsd.org + * * $FreeBSD$ */ /* @@ -32,6 +34,7 @@ typedef struct devinfo { int dev_major; /* major number */ int dev_minor; /* minor number */ int dev_instance; /* instance number */ + int dev_type; /* type of device */ string dev_name; /* name of device */ string dev_statname; /* name of device + instance/minor */ string dev_pathname; /* pathname of device */ @@ -42,12 +45,14 @@ translator devinfo_t < struct devstat *D > { dev_major = D->device_number; dev_minor = D->unit_number; dev_instance = 0; + dev_type = D->device_type; dev_name = stringof(D->device_name); dev_statname = stringof(D->device_name); dev_pathname = stringof(D->device_name); }; typedef struct bufinfo { + int b_cmd; /* I/O operation */ int b_flags; /* flags */ long b_bcount; /* number of bytes */ caddr_t b_addr; /* buffer address */ @@ -62,6 +67,7 @@ typedef struct bufinfo { #pragma D binding "1.0" translator translator bufinfo_t < struct bio *B > { + b_cmd = B->bio_cmd; b_flags = B->bio_flags; b_bcount = B->bio_bcount; b_addr = B->bio_data; @@ -105,3 +111,151 @@ inline int O_SYNC = 0x0080; #pragma D binding "1.1" O_SYNC inline int O_TRUNC = 0x0400; #pragma D binding "1.1" O_TRUNC + +/* + * The following inline constants can be used to examine bio_cmd of struct bio + * or a translated bufinfo_t. + */ +inline int BIO_READ = 0x01; +#pragma D binding "1.13" BIO_READ +inline int BIO_WRITE = 0x02; +#pragma D binding "1.13" BIO_WRITE +inline int BIO_DELETE = 0x03; +#pragma D binding "1.13" BIO_DELETE +inline int BIO_GETATTR = 0x04; +#pragma D binding "1.13" BIO_GETATTR +inline int BIO_FLUSH = 0x05; +#pragma D binding "1.13" BIO_FLUSH +inline int BIO_CMD0 = 0x06; +#pragma D binding "1.13" BIO_CMD0 +inline int BIO_CMD1 = 0x07; +#pragma D binding "1.13" BIO_CMD1 +inline int BIO_CMD2 = 0x08; +#pragma D binding "1.13" BIO_CMD2 +inline int BIO_ZONE = 0x09; +#pragma D binding "1.13" BIO_ZONE + +/* + * The following inline constants can be used to examine bio_flags of struct + * bio or a translated bufinfo_t. + */ +inline int BIO_ERROR = 0x01; +#pragma D binding "1.13" BIO_ERROR +inline int BIO_DONE = 0x02; +#pragma D binding "1.13" BIO_DONE +inline int BIO_ONQUEUE = 0x04; +#pragma D binding "1.13" BIO_ONQUEUE +inline int BIO_ORDERED = 0x08; +#pragma D binding "1.13" BIO_ORDERED +inline int BIO_UNMAPPED = 0x10; +#pragma D binding "1.13" BIO_UNMAPPED +inline int BIO_TRANSIENT_MAPPING = 0x20; +#pragma D binding "1.13" BIO_TRANSIENT_MAPPING +inline int BIO_VLIST = 0x40; +#pragma D binding "1.13" BIO_VLIST + +/* + * The following inline constants can be used to examine device_type of struct + * devstat or a translated devinfo_t. + */ +inline int DEVSTAT_TYPE_DIRECT = 0x000; +#pragma D binding "1.13" DEVSTAT_TYPE_DIRECT +inline int DEVSTAT_TYPE_SEQUENTIAL = 0x001; +#pragma D binding "1.13" DEVSTAT_TYPE_SEQUENTIAL +inline int DEVSTAT_TYPE_PRINTER = 0x002; +#pragma D binding "1.13" DEVSTAT_TYPE_PRINTER +inline int DEVSTAT_TYPE_PROCESSOR = 0x003; +#pragma D binding "1.13" DEVSTAT_TYPE_PROCESSOR +inline int DEVSTAT_TYPE_WORM = 0x004; +#pragma D binding "1.13" DEVSTAT_TYPE_WORM +inline int DEVSTAT_TYPE_CDROM = 0x005; +#pragma D binding "1.13" DEVSTAT_TYPE_CDROM +inline int DEVSTAT_TYPE_SCANNER = 0x006; +#pragma D binding "1.13" DEVSTAT_TYPE_SCANNER +inline int DEVSTAT_TYPE_OPTICAL = 0x007; +#pragma D binding "1.13" DEVSTAT_TYPE_OPTICAL +inline int DEVSTAT_TYPE_CHANGER = 0x008; +#pragma D binding "1.13" DEVSTAT_TYPE_CHANGER +inline int DEVSTAT_TYPE_COMM = 0x009; +#pragma D binding "1.13" DEVSTAT_TYPE_COMM +inline int DEVSTAT_TYPE_ASC0 = 0x00a; +#pragma D binding "1.13" DEVSTAT_TYPE_ASC0 +inline int DEVSTAT_TYPE_ASC1 = 0x00b; +#pragma D binding "1.13" DEVSTAT_TYPE_ASC1 +inline int DEVSTAT_TYPE_STORARRAY = 0x00c; +#pragma D binding "1.13" DEVSTAT_TYPE_STORARRAY +inline int DEVSTAT_TYPE_ENCLOSURE = 0x00d; +#pragma D binding "1.13" DEVSTAT_TYPE_ENCLOSURE +inline int DEVSTAT_TYPE_FLOPPY = 0x00e; +#pragma D binding "1.13" DEVSTAT_TYPE_FLOPPY +inline int DEVSTAT_TYPE_MASK = 0x00f; +#pragma D binding "1.13" DEVSTAT_TYPE_MASK +inline int DEVSTAT_TYPE_IF_SCSI = 0x010; +#pragma D binding "1.13" DEVSTAT_TYPE_IF_SCSI +inline int DEVSTAT_TYPE_IF_IDE = 0x020; +#pragma D binding "1.13" DEVSTAT_TYPE_IF_IDE +inline int DEVSTAT_TYPE_IF_OTHER = 0x030; +#pragma D binding "1.13" DEVSTAT_TYPE_IF_OTHER +inline int DEVSTAT_TYPE_IF_MASK = 0x0f0; +#pragma D binding "1.13" DEVSTAT_TYPE_IF_MASK +inline int DEVSTAT_TYPE_PASS = 0x100; +#pragma D binding "1.13" DEVSTAT_TYPE_PASS + +#pragma D binding "1.13" device_type_string +inline string device_type_string[int type] = + type == DEVSTAT_TYPE_DIRECT ? "DIRECT" : + type == DEVSTAT_TYPE_SEQUENTIAL ? "SEQUENTIAL" : + type == DEVSTAT_TYPE_PRINTER ? "PRINTER" : + type == DEVSTAT_TYPE_PROCESSOR ? "PROCESSOR" : + type == DEVSTAT_TYPE_WORM ? "WORM" : + type == DEVSTAT_TYPE_CDROM ? "CDROM" : + type == DEVSTAT_TYPE_SCANNER ? "SCANNER" : + type == DEVSTAT_TYPE_OPTICAL ? "OPTICAL" : + type == DEVSTAT_TYPE_CHANGER ? "CHANGER" : + type == DEVSTAT_TYPE_COMM ? "COMM" : + type == DEVSTAT_TYPE_ASC0 ? "ASC0" : + type == DEVSTAT_TYPE_ASC1 ? "ASC1" : + type == DEVSTAT_TYPE_STORARRAY ? "STORARRAY" : + type == DEVSTAT_TYPE_ENCLOSURE ? "ENCLOSURE" : + type == DEVSTAT_TYPE_FLOPPY ? "FLOPPY" : + strjoin("UNKNOWN(", strjoin(lltostr(type), ")")); + +#pragma D binding "1.13" device_type +inline string device_type[int type] = + device_type_string[type & DEVSTAT_TYPE_MASK]; + +#pragma D binding "1.13" device_if_string +inline string device_if_string[int type] = + type == 0 ? "ACCESS" : + type == DEVSTAT_TYPE_IF_SCSI ? "SCSI" : + type == DEVSTAT_TYPE_IF_IDE ? "IDE" : + type == DEVSTAT_TYPE_IF_OTHER ? "OTHER" : + strjoin("UNKNOWN(", strjoin(lltostr(type), ")")); + +#pragma D binding "1.13" device_if +inline string device_if[int type] = + device_if_string[type & DEVSTAT_TYPE_IF_MASK]; + +#pragma D binding "1.13" bio_cmd_string +inline string bio_cmd_string[int cmd] = + cmd == BIO_READ ? "READ" : + cmd == BIO_WRITE ? "WRITE" : + cmd == BIO_DELETE ? "DELETE" : + cmd == BIO_GETATTR ? "GETATTR" : + cmd == BIO_FLUSH ? "FLUSH" : + cmd == BIO_CMD0 ? "CMD0" : + cmd == BIO_CMD1 ? "CMD1" : + cmd == BIO_CMD2 ? "CMD2" : + cmd == BIO_ZONE ? "ZONE" : + strjoin("UNKNOWN(", strjoin(lltostr(cmd), ")")); + +#pragma D binding "1.13" bio_flag_string +inline string bio_flag_string[int flag] = + flag == BIO_ERROR ? "ERROR" : + flag == BIO_DONE ? "DONE" : + flag == BIO_ONQUEUE ? "ONQUEUE" : + flag == BIO_ORDERED ? "ORDERED" : + flag == BIO_UNMAPPED ? "UNMAPPED" : + flag == BIO_TRANSIENT_MAPPING ? "TRANSIENT_MAPPING" : + flag == BIO_VLIST ? "VLIST" : + ""; From owner-svn-src-all@freebsd.org Sat Feb 24 17:29:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DA13F30202; Sat, 24 Feb 2018 17:29:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD12B6DA92; Sat, 24 Feb 2018 17:29:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7E492895F; Sat, 24 Feb 2018 17:29:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OHTTsa088451; Sat, 24 Feb 2018 17:29:29 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OHTTsv088450; Sat, 24 Feb 2018 17:29:29 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802241729.w1OHTTsv088450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 24 Feb 2018 17:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329915 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 17:29:30 -0000 Author: jhibbits Date: Sat Feb 24 17:29:29 2018 New Revision: 329915 URL: https://svnweb.freebsd.org/changeset/base/329915 Log: Unbreak the build after r329891 I was apparently a little too excited with deleting code, and apparently didn't do a final test build before commit. Restore cpu_idle_wakeup(). Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sat Feb 24 17:13:15 2018 (r329914) +++ head/sys/powerpc/powerpc/cpu.c Sat Feb 24 17:29:29 2018 (r329915) @@ -768,3 +768,10 @@ cpu_idle_powerx(sbintime_t sbt) spinlock_exit(); } #endif + +int +cpu_idle_wakeup(int cpu) +{ + + return (0); +} From owner-svn-src-all@freebsd.org Sat Feb 24 17:53:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4A87F31AB3; Sat, 24 Feb 2018 17:53:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6181B6EB99; Sat, 24 Feb 2018 17:53:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C47928E34; Sat, 24 Feb 2018 17:53:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OHrMcX003725; Sat, 24 Feb 2018 17:53:22 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OHrMeB003724; Sat, 24 Feb 2018 17:53:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802241753.w1OHrMeB003724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 24 Feb 2018 17:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329916 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 329916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 17:53:22 -0000 Author: jhibbits Date: Sat Feb 24 17:53:22 2018 New Revision: 329916 URL: https://svnweb.freebsd.org/changeset/base/329916 Log: Change ident for QORIQ64 kernel conf Make it match the conf file name. Modified: head/sys/powerpc/conf/QORIQ64 Modified: head/sys/powerpc/conf/QORIQ64 ============================================================================== --- head/sys/powerpc/conf/QORIQ64 Sat Feb 24 17:29:29 2018 (r329915) +++ head/sys/powerpc/conf/QORIQ64 Sat Feb 24 17:53:22 2018 (r329916) @@ -7,7 +7,7 @@ cpu BOOKE cpu BOOKE_E500 -ident MPC85XX +ident QORIQ64 machine powerpc powerpc64 From owner-svn-src-all@freebsd.org Sat Feb 24 17:54:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ED00F31B6A; Sat, 24 Feb 2018 17:54:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49FC26ECE6; Sat, 24 Feb 2018 17:54:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 448B728E35; Sat, 24 Feb 2018 17:54:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OHsD5K003799; Sat, 24 Feb 2018 17:54:13 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OHsDNR003798; Sat, 24 Feb 2018 17:54:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802241754.w1OHsDNR003798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 24 Feb 2018 17:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329917 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 329917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 17:54:13 -0000 Author: jhibbits Date: Sat Feb 24 17:54:12 2018 New Revision: 329917 URL: https://svnweb.freebsd.org/changeset/base/329917 Log: Make MPC85XXSPE kernel conf ident match the file name Modified: head/sys/powerpc/conf/MPC85XXSPE Modified: head/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- head/sys/powerpc/conf/MPC85XXSPE Sat Feb 24 17:53:22 2018 (r329916) +++ head/sys/powerpc/conf/MPC85XXSPE Sat Feb 24 17:54:12 2018 (r329917) @@ -6,7 +6,7 @@ cpu BOOKE cpu BOOKE_E500 -ident MPC85XX +ident MPC85XXSPE machine powerpc powerpcspe From owner-svn-src-all@freebsd.org Sat Feb 24 18:12:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBDBBF32F64; Sat, 24 Feb 2018 18:12:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7ABA66FB39; Sat, 24 Feb 2018 18:12:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75B6E29173; Sat, 24 Feb 2018 18:12:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OICcHo013678; Sat, 24 Feb 2018 18:12:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OICcc4013677; Sat, 24 Feb 2018 18:12:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802241812.w1OICcc4013677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 24 Feb 2018 18:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329918 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 329918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 18:12:39 -0000 Author: jhibbits Date: Sat Feb 24 18:12:38 2018 New Revision: 329918 URL: https://svnweb.freebsd.org/changeset/base/329918 Log: Unbreak 64-bit Book-E builds post r329712 can_wakeup is defined only in AIM's locore64.S, so conditionalize use of it on AIM in addition to powerpc64. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sat Feb 24 17:54:12 2018 (r329917) +++ head/sys/powerpc/powerpc/cpu.c Sat Feb 24 18:12:38 2018 (r329918) @@ -89,7 +89,7 @@ int powerpc_pow_enabled; void (*cpu_idle_hook)(sbintime_t) = NULL; static void cpu_idle_60x(sbintime_t); static void cpu_idle_booke(sbintime_t); -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) static void cpu_idle_powerx(sbintime_t); #endif @@ -620,7 +620,7 @@ static void cpu_powerx_setup(int cpuid, uint16_t vers) { -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) if ((mfmsr() & PSL_HV) == 0) return; @@ -745,7 +745,7 @@ cpu_idle_booke(sbintime_t sbt) #endif } -#ifdef __powerpc64__ +#if defined(__powerpc64__) && defined(AIM) static void cpu_idle_powerx(sbintime_t sbt) { From owner-svn-src-all@freebsd.org Sat Feb 24 18:16:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E225CF33578; Sat, 24 Feb 2018 18:16:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90FDA6FE1E; Sat, 24 Feb 2018 18:16:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 874CA29175; Sat, 24 Feb 2018 18:16:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OIGS9L013847; Sat, 24 Feb 2018 18:16:28 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OIGSms013845; Sat, 24 Feb 2018 18:16:28 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201802241816.w1OIGSms013845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 24 Feb 2018 18:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329919 - stable/11/lib/libc/string X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/11/lib/libc/string X-SVN-Commit-Revision: 329919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 18:16:29 -0000 Author: cy Date: Sat Feb 24 18:16:28 2018 New Revision: 329919 URL: https://svnweb.freebsd.org/changeset/base/329919 Log: MFC r329361: Document memset_s(3). memset_s(3) is defined in C11 standard (ISO/IEC 9899:2011) K.3.7.4.1 The memset_s function (p: 621-622) Fix memset(3) portion of the man page by replacing the first argument (destination) "b" with "dest", which is more descriptive than "b". This also makes it consistent with the term used in the memset_s() portion of the man page. See also http://en.cppreference.com/w/c/string/byte/memset. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D13682 Modified: stable/11/lib/libc/string/Makefile.inc stable/11/lib/libc/string/memset.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/string/Makefile.inc ============================================================================== --- stable/11/lib/libc/string/Makefile.inc Sat Feb 24 18:12:38 2018 (r329918) +++ stable/11/lib/libc/string/Makefile.inc Sat Feb 24 18:16:28 2018 (r329919) @@ -50,6 +50,7 @@ MLINKS+=ffs.3 ffsl.3 \ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 +MLINKS+=memset.3 memset_s.3 MLINKS+=strcasecmp.3 strncasecmp.3 \ strcasecmp.3 strcasecmp_l.3 \ strcasecmp.3 strncasecmp_l.3 Modified: stable/11/lib/libc/string/memset.3 ============================================================================== --- stable/11/lib/libc/string/memset.3 Sat Feb 24 18:12:38 2018 (r329918) +++ stable/11/lib/libc/string/memset.3 Sat Feb 24 18:16:28 2018 (r329919) @@ -32,7 +32,7 @@ .\" @(#)memset.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd February 15, 2018 .Dt MEMSET 3 .Os .Sh NAME @@ -43,7 +43,9 @@ .Sh SYNOPSIS .In string.h .Ft void * -.Fn memset "void *b" "int c" "size_t len" +.Fn memset "void *dest" "int c" "size_t len" +.Ft errno_t +.Fn memset_s "void *dest" "rsize_t destsz" "int c" "rsize_t len" .Sh DESCRIPTION The .Fn memset @@ -55,13 +57,66 @@ bytes of value (converted to an .Vt "unsigned char" ) to the string -.Fa b . +.Fa dest . +Undefined behaviour from +.Fn memset , +resulting from storage overflow, will occur if +.Fa len +is greater than the the length of buffer +.Fa dest . +The behaviour is also undefined if +.Fa dest +is an invalid pointer. +.Pp +The +.Fn memset_s +function behaves the same as +.Fn memset +except that an error is returned and the currently registered +runtime-constraint handler is called if +.Fa dest +is a null pointer, +.Fa destsz +or +.Fa len +is greater than +.Dv RSIZE_MAX , +or +.Sp +.Fa len +is greater than +.Fa destsz +(buffer overflow would occur). +The runtime-constraint handler is called first and may not return. +If it does return, an error is returned to the caller. +Like +.Xr explicit_bzero 3 , +.Fn memset_s +is not removed through Dead Store Elimination (DSE), making it useful for +clearing sensitve data. +In contrast +.Fn memset +function +may be optimized away if the object modified by the function is not accessed +again. +To clear memory that will not subsequently be accessed it is advised to use +.Fn memset_s +instead of +.Fn memset . +For instance, a buffer containing a password should be cleared with +.Fn memset_s +before +.Xr free 3 . .Sh RETURN VALUES The .Fn memset function returns its first argument. +The +.Fn memset_s +function returns zero on success, non-zero on error. .Sh SEE ALSO .Xr bzero 3 , +.Xr explicit_bzero 3 , .Xr swab 3 , .Xr wmemset 3 .Sh STANDARDS @@ -70,3 +125,7 @@ The function conforms to .St -isoC . +.Fn memset_s +conforms to: +.St -isoC-2011 +K.3.7.4.1. From owner-svn-src-all@freebsd.org Sat Feb 24 19:40:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA01DF09455; Sat, 24 Feb 2018 19:40:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 603B7734A8; Sat, 24 Feb 2018 19:40:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B07E29E6C; Sat, 24 Feb 2018 19:40:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OJeNZS053902; Sat, 24 Feb 2018 19:40:23 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OJeNLs053901; Sat, 24 Feb 2018 19:40:23 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802241940.w1OJeNLs053901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 24 Feb 2018 19:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329921 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 329921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 19:40:23 -0000 Author: cem Date: Sat Feb 24 19:40:23 2018 New Revision: 329921 URL: https://svnweb.freebsd.org/changeset/base/329921 Log: libc: Remove unused definition RANDOMDEV isn't used after r306636. Remove the unneeded definition. No functional change. Sponsored by: Dell EMC Isilon Modified: head/lib/libc/gen/arc4random.c Modified: head/lib/libc/gen/arc4random.c ============================================================================== --- head/lib/libc/gen/arc4random.c Sat Feb 24 19:25:09 2018 (r329920) +++ head/lib/libc/gen/arc4random.c Sat Feb 24 19:40:23 2018 (r329921) @@ -59,7 +59,6 @@ struct arc4_stream { static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; -#define RANDOMDEV "/dev/random" #define KEYSIZE 128 #define _ARC4_LOCK() \ do { \ From owner-svn-src-all@freebsd.org Sat Feb 24 19:51:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4246AF0A103; Sat, 24 Feb 2018 19:51:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7BCA73ABD; Sat, 24 Feb 2018 19:51:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E131B2A03A; Sat, 24 Feb 2018 19:51:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OJpIsp060325; Sat, 24 Feb 2018 19:51:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OJpIou060324; Sat, 24 Feb 2018 19:51:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802241951.w1OJpIou060324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 19:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329922 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 19:51:19 -0000 Author: kevans Date: Sat Feb 24 19:51:18 2018 New Revision: 329922 URL: https://svnweb.freebsd.org/changeset/base/329922 Log: lualoader: Split config file I/O out into a separate function This is step 1 towards revoking config.parse of it I/O privileges. Ideally, all reading would be done before config.parse and config.parse would just take text and parse it rather than being charged with the entire process. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 19:40:23 2018 (r329921) +++ head/stand/lua/config.lua Sat Feb 24 19:51:18 2018 (r329922) @@ -156,6 +156,28 @@ local function check_nextboot() end end +local function read_file(name, silent) + local f = io.open(name) + if f == nil then + if not silent then + print("Failed to open config: '" .. name .. "'") + end + return nil + end + + local text, _ = io.read(f) + -- We might have read in the whole file, this won't be needed any more. + io.close(f) + + if text == nil then + if not silent then + print("Failed to read config: '" .. name .. "'") + end + return nil + end + return text +end + -- Module exports -- Which variables we changed config.env_changed = {} @@ -311,25 +333,11 @@ function config.parse(name, silent, check_and_halt) if silent == nil then silent = false end - local f = io.open(name) - if f == nil then - if not silent then - print("Failed to open config: '" .. name .. "'") - end - return silent - end - local text, _ = io.read(f) - -- We might have read in the whole file, this won't be needed any more. - io.close(f) - + local text = read_file(name, silent) if text == nil then - if not silent then - print("Failed to read config: '" .. name .. "'") - end - return silent + return not silent end - if check_and_halt ~= nil then if not check_and_halt(text) then From owner-svn-src-all@freebsd.org Sat Feb 24 20:00:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FFFBF0ADC9; Sat, 24 Feb 2018 20:00:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAEB174028; Sat, 24 Feb 2018 20:00:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A28C52A1AB; Sat, 24 Feb 2018 20:00:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OK0Vr8063603; Sat, 24 Feb 2018 20:00:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OK0VxW063602; Sat, 24 Feb 2018 20:00:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802242000.w1OK0VxW063602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 20:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329923 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:00:32 -0000 Author: kevans Date: Sat Feb 24 20:00:31 2018 New Revision: 329923 URL: https://svnweb.freebsd.org/changeset/base/329923 Log: lualoader: Strip config.parse of its I/O privileges config.parse is now purely a parser, rather than a whole proccessor. The standard process for loading a config file has been split out into config.processFile. This clears the way for having nextboot read its own config file and decide there whether it should parse the rest of the file. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 19:51:18 2018 (r329922) +++ head/stand/lua/config.lua Sat Feb 24 20:00:31 2018 (r329923) @@ -134,7 +134,8 @@ local function check_nextboot() return text:match("^nextboot_enable=\"NO\"") == nil end - if not config.parse(nextboot_file, true, check_nextboot_enabled) then + if not config.processFile(nextboot_file, true, check_nextboot_enabled) + then -- This only fails if it actually hit a parse error print("Failed to parse nextboot configuration: '" .. nextboot_file .. "'") @@ -326,10 +327,7 @@ function config.loadmod(mod, silent) return status end --- silent runs will not return false if we fail to open the file --- check_and_halt, if it's set, will be executed on the full text of the config --- file. If it returns false, we are to halt immediately. -function config.parse(name, silent, check_and_halt) +function config.processFile(name, silent, check_and_halt) if silent == nil then silent = false end @@ -345,6 +343,14 @@ function config.parse(name, silent, check_and_halt) return true end end + + return config.parse(text) +end + +-- silent runs will not return false if we fail to open the file +-- check_and_halt, if it's set, will be executed on the full text of the config +-- file. If it returns false, we are to halt immediately. +function config.parse(text) local n = 1 local status = true @@ -473,7 +479,7 @@ function config.load(file) file = "/boot/defaults/loader.conf" end - if not config.parse(file) then + if not config.processFile(file) then print("Failed to parse configuration: '" .. file .. "'") end @@ -483,7 +489,7 @@ function config.load(file) -- These may or may not exist, and that's ok. Do a -- silent parse so that we complain on parse errors but -- not for them simply not existing. - if not config.parse(name, true) then + if not config.processFile(name, true) then print("Failed to parse configuration: '" .. name .. "'") end From owner-svn-src-all@freebsd.org Sat Feb 24 20:07:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17278F0B88B; Sat, 24 Feb 2018 20:07:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3DAE7460D; Sat, 24 Feb 2018 20:07:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC64F2A33C; Sat, 24 Feb 2018 20:07:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OK7dOf068543; Sat, 24 Feb 2018 20:07:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OK7dHU068542; Sat, 24 Feb 2018 20:07:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802242007.w1OK7dHU068542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 20:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329924 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:07:40 -0000 Author: kevans Date: Sat Feb 24 20:07:39 2018 New Revision: 329924 URL: https://svnweb.freebsd.org/changeset/base/329924 Log: lualoader: throw out nextboot's usage of standard config processing It should use the common parser, but it should not be processed like a standard file. Rewite check_nextboot to read the file in, check whether it should continue, then parse as needed. This allows us to throw the recently introduced check_and_halt callback swiftly out the window. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 20:00:31 2018 (r329923) +++ head/stand/lua/config.lua Sat Feb 24 20:07:39 2018 (r329924) @@ -124,19 +124,45 @@ pattern_table = { } } +local function read_file(name, silent) + local f = io.open(name) + if f == nil then + if not silent then + print("Failed to open config: '" .. name .. "'") + end + return nil + end + + local text, _ = io.read(f) + -- We might have read in the whole file, this won't be needed any more. + io.close(f) + + if text == nil then + if not silent then + print("Failed to read config: '" .. name .. "'") + end + return nil + end + return text +end + local function check_nextboot() local nextboot_file = loader.getenv("nextboot_file") if nextboot_file == nil then return end - local function check_nextboot_enabled(text) - return text:match("^nextboot_enable=\"NO\"") == nil + local text = read_file(nextboot_file, true) + if text == nil then + return end - if not config.processFile(nextboot_file, true, check_nextboot_enabled) - then - -- This only fails if it actually hit a parse error + if text:match("^nextboot_enable=\"NO\"") ~= nil then + -- We're done; nextboot is not enabled + return + end + + if not config.parse(text) then print("Failed to parse nextboot configuration: '" .. nextboot_file .. "'") end @@ -157,28 +183,6 @@ local function check_nextboot() end end -local function read_file(name, silent) - local f = io.open(name) - if f == nil then - if not silent then - print("Failed to open config: '" .. name .. "'") - end - return nil - end - - local text, _ = io.read(f) - -- We might have read in the whole file, this won't be needed any more. - io.close(f) - - if text == nil then - if not silent then - print("Failed to read config: '" .. name .. "'") - end - return nil - end - return text -end - -- Module exports -- Which variables we changed config.env_changed = {} @@ -327,7 +331,7 @@ function config.loadmod(mod, silent) return status end -function config.processFile(name, silent, check_and_halt) +function config.processFile(name, silent) if silent == nil then silent = false end @@ -335,13 +339,6 @@ function config.processFile(name, silent, check_and_ha local text = read_file(name, silent) if text == nil then return not silent - end - - if check_and_halt ~= nil then - if not check_and_halt(text) then - -- We'll just pretend that everything is fine... - return true - end end return config.parse(text) From owner-svn-src-all@freebsd.org Sat Feb 24 20:19:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52970F11792; Sat, 24 Feb 2018 20:19:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F305E74E5F; Sat, 24 Feb 2018 20:19:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED94F2A4D6; Sat, 24 Feb 2018 20:19:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OKJVo9073752; Sat, 24 Feb 2018 20:19:31 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OKJVBw073750; Sat, 24 Feb 2018 20:19:31 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802242019.w1OKJVBw073750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 24 Feb 2018 20:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329926 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 329926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:19:32 -0000 Author: gonzo Date: Sat Feb 24 20:19:31 2018 New Revision: 329926 URL: https://svnweb.freebsd.org/changeset/base/329926 Log: Add SPDX tags for chvgpio driver sources Also move $FreeBSD$ keyword in header to BSD license MFC after: 2 weeks Modified: head/sys/dev/gpio/chvgpio.c head/sys/dev/gpio/chvgpio_reg.h Modified: head/sys/dev/gpio/chvgpio.c ============================================================================== --- head/sys/dev/gpio/chvgpio.c Sat Feb 24 20:12:01 2018 (r329925) +++ head/sys/dev/gpio/chvgpio.c Sat Feb 24 20:19:31 2018 (r329926) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Tom Jones * All rights reserved. * Modified: head/sys/dev/gpio/chvgpio_reg.h ============================================================================== --- head/sys/dev/gpio/chvgpio_reg.h Sat Feb 24 20:12:01 2018 (r329925) +++ head/sys/dev/gpio/chvgpio_reg.h Sat Feb 24 20:19:31 2018 (r329926) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Tom Jones * All rights reserved. * @@ -23,6 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $FreeBSD$ */ /* @@ -40,7 +43,6 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $FreeBSD$ */ From owner-svn-src-all@freebsd.org Sat Feb 24 20:21:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21DD2F11B11; Sat, 24 Feb 2018 20:21:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8F8075084; Sat, 24 Feb 2018 20:21:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3E8F2A515; Sat, 24 Feb 2018 20:21:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OKLMuS076931; Sat, 24 Feb 2018 20:21:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OKLMvc076925; Sat, 24 Feb 2018 20:21:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802242021.w1OKLMvc076925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 20:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329927 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:21:23 -0000 Author: kevans Date: Sat Feb 24 20:21:21 2018 New Revision: 329927 URL: https://svnweb.freebsd.org/changeset/base/329927 Log: lualoader: Clean up naming conventions a little bit We mostly use camel case for function names, but some local functions got mixed in using internal underscores. Doubles down on camel case. Modified: head/stand/lua/cli.lua head/stand/lua/config.lua head/stand/lua/core.lua head/stand/lua/drawer.lua head/stand/lua/menu.lua head/stand/lua/password.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/cli.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -38,7 +38,7 @@ local cli = {} -- Defaults to nil and "" respectively. -- This will also parse arguments to autoboot, but the with_kernel argument -- will need to be explicitly overwritten to false -local function parse_boot_args(argv, with_kernel) +local function parseBootArgs(argv, with_kernel) if with_kernel == nil then with_kernel = true end @@ -95,17 +95,17 @@ end function cli.boot(...) local _, argv = cli.arguments(...) - local kernel, argstr = parse_boot_args(argv) + local kernel, argstr = parseBootArgs(argv) if kernel ~= nil then loader.perform("unload") - config.selectkernel(kernel) + config.selectKernel(kernel) end core.boot(argstr) end function cli.autoboot(...) local _, argv = cli.arguments(...) - local argstr = parse_boot_args(argv, false) + local argstr = parseBootArgs(argv, false) core.autoboot(argstr) end Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/config.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -124,7 +124,7 @@ pattern_table = { } } -local function read_file(name, silent) +local function readFile(name, silent) local f = io.open(name) if f == nil then if not silent then @@ -146,13 +146,13 @@ local function read_file(name, silent) return text end -local function check_nextboot() +local function checkNextboot() local nextboot_file = loader.getenv("nextboot_file") if nextboot_file == nil then return end - local text = read_file(nextboot_file, true) + local text = readFile(nextboot_file, true) if text == nil then return end @@ -169,7 +169,7 @@ local function check_nextboot() -- Attempt to rewrite the first line and only the first line of the -- nextboot_file. We overwrite it with nextboot_enable="NO", then - -- check for that on load. See: check_nextboot_enabled + -- check for that on load. See: checkNextboot_enabled -- It's worth noting that this won't work on every filesystem, so we -- won't do anything notable if we have any errors in this process. local nfile = io.open(nextboot_file, 'w') @@ -336,7 +336,7 @@ function config.processFile(name, silent) silent = false end - local text = read_file(name, silent) + local text = readFile(name, silent) if text == nil then return not silent end @@ -386,11 +386,11 @@ end -- other_kernel is optionally the name of a kernel to load, if not the default -- or autoloaded default from the module_path -function config.loadkernel(other_kernel) +function config.loadKernel(other_kernel) local flags = loader.getenv("kernel_options") or "" local kernel = other_kernel or loader.getenv("kernel") - local function try_load(names) + local function tryLoad(names) for name in names:gmatch("([^;]+)%s*;?") do local r = loader.perform("load " .. flags .. " " .. name) @@ -401,7 +401,7 @@ function config.loadkernel(other_kernel) return nil end - local function load_bootfile() + local function loadBootfile() local bootfile = loader.getenv("bootfile") -- append default kernel name @@ -411,12 +411,12 @@ function config.loadkernel(other_kernel) bootfile = bootfile .. ";kernel" end - return try_load(bootfile) + return tryLoad(bootfile) end -- kernel not set, try load from default module_path if kernel == nil then - local res = load_bootfile() + local res = loadBootfile() if res ~= nil then -- Default kernel is loaded @@ -441,7 +441,7 @@ function config.loadkernel(other_kernel) for _, v in pairs(paths) do loader.setenv("module_path", v) - res = load_bootfile() + res = loadBootfile() -- succeeded, add path to module_path if res ~= nil then @@ -456,7 +456,7 @@ function config.loadkernel(other_kernel) -- failed to load with ${kernel} as a directory -- try as a file - res = try_load(kernel) + res = tryLoad(kernel) if res ~= nil then config.kernel_loaded = kernel return true @@ -467,7 +467,7 @@ function config.loadkernel(other_kernel) end end -function config.selectkernel(kernel) +function config.selectKernel(kernel) config.kernel_selected = kernel end @@ -493,7 +493,7 @@ function config.load(file) end end - check_nextboot() + checkNextboot() -- Cache the provided module_path at load time for later use config.module_path = loader.getenv("module_path") @@ -511,7 +511,7 @@ function config.loadelf() local loaded print("Loading kernel...") - loaded = config.loadkernel(kernel) + loaded = config.loadKernel(kernel) if not loaded then print("Failed to load any kernel") Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/core.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -33,7 +33,7 @@ local config = require("config") local core = {} -local function compose_loader_cmd(cmd_name, argstr) +local function composeLoaderCmd(cmd_name, argstr) if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr end @@ -238,12 +238,12 @@ end function core.autoboot(argstr) config.loadelf() - loader.perform(compose_loader_cmd("autoboot", argstr)) + loader.perform(composeLoaderCmd("autoboot", argstr)) end function core.boot(argstr) config.loadelf() - loader.perform(compose_loader_cmd("boot", argstr)) + loader.perform(composeLoaderCmd("boot", argstr)) end function core.isSingleUserBoot() Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/drawer.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -45,7 +45,7 @@ local orb local none local none_shifted = false -local function menu_entry_name(drawing_menu, entry) +local function menuEntryName(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type] if name_handler ~= nil then @@ -57,7 +57,7 @@ local function menu_entry_name(drawing_menu, entry) return entry.name end -local function shift_brand_text(shift) +local function shiftBrandText(shift) drawer.brand_position.x = drawer.brand_position.x + shift.x drawer.brand_position.y = drawer.brand_position.y + shift.y drawer.menu_position.x = drawer.menu_position.x + shift.x @@ -288,7 +288,7 @@ function drawer.drawmenu(m) entry_num = entry_num + 1 screen.setcursor(x, y + effective_line_num) - print(entry_num .. ". " .. menu_entry_name(m, e)) + print(entry_num .. ". " .. menuEntryName(m, e)) -- fill the alias table alias_table[tostring(entry_num)] = e @@ -299,7 +299,7 @@ function drawer.drawmenu(m) end else screen.setcursor(x, y + effective_line_num) - print(menu_entry_name(m, e)) + print(menuEntryName(m, e)) end ::continue:: end @@ -379,7 +379,7 @@ function drawer.drawlogo() if logodef ~= nil and logodef.graphic == none then -- centre brand and text if no logo if not none_shifted then - shift_brand_text(logodef.shift) + shiftBrandText(logodef.shift) none_shifted = true end elseif logodef == nil or logodef.graphic == nil or Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/menu.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -315,7 +315,7 @@ menu.welcome = { #all_choices .. ")" end, func = function(_, choice, _) - config.selectkernel(choice) + config.selectKernel(choice) end, alias = {"k", "K"} }, Modified: head/stand/lua/password.lua ============================================================================== --- head/stand/lua/password.lua Sat Feb 24 20:19:31 2018 (r329926) +++ head/stand/lua/password.lua Sat Feb 24 20:21:21 2018 (r329927) @@ -65,7 +65,7 @@ function password.check() screen.clear() screen.defcursor() -- pwd is optionally supplied if we want to check it - local function do_prompt(prompt, pwd) + local function doPrompt(prompt, pwd) while true do loader.printc(prompt) local read_pwd = password.read() @@ -82,7 +82,7 @@ function password.check() if pwd == nil then return end - do_prompt(prompt, pwd) + doPrompt(prompt, pwd) end local boot_pwd = loader.getenv("bootlock_password") @@ -90,7 +90,7 @@ function password.check() local geli_prompt = loader.getenv("geom_eli_passphrase_prompt") if geli_prompt ~= nil and geli_prompt:lower() == "yes" then - local passphrase = do_prompt("GELI Passphrase: ") + local passphrase = doPrompt("GELI Passphrase: ") loader.setenv("kern.geom.eli.passphrase", passphrase) end From owner-svn-src-all@freebsd.org Sat Feb 24 20:24:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45789F11F54; Sat, 24 Feb 2018 20:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA3CB75467; Sat, 24 Feb 2018 20:24:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF9C92A680; Sat, 24 Feb 2018 20:24:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OKOv4K078581; Sat, 24 Feb 2018 20:24:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OKOvbO078580; Sat, 24 Feb 2018 20:24:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802242024.w1OKOvbO078580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Feb 2018 20:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329928 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:24:58 -0000 Author: kevans Date: Sat Feb 24 20:24:57 2018 New Revision: 329928 URL: https://svnweb.freebsd.org/changeset/base/329928 Log: lualoader: Remove inaccurate part of comment Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 24 20:21:21 2018 (r329927) +++ head/stand/lua/config.lua Sat Feb 24 20:24:57 2018 (r329928) @@ -169,7 +169,7 @@ local function checkNextboot() -- Attempt to rewrite the first line and only the first line of the -- nextboot_file. We overwrite it with nextboot_enable="NO", then - -- check for that on load. See: checkNextboot_enabled + -- check for that on load. -- It's worth noting that this won't work on every filesystem, so we -- won't do anything notable if we have any errors in this process. local nfile = io.open(nextboot_file, 'w') From owner-svn-src-all@freebsd.org Sat Feb 24 20:47:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88CF8F20E91; Sat, 24 Feb 2018 20:47:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 561607625D; Sat, 24 Feb 2018 20:47:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 510362A9B6; Sat, 24 Feb 2018 20:47:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OKlMsr088745; Sat, 24 Feb 2018 20:47:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OKlM89088744; Sat, 24 Feb 2018 20:47:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802242047.w1OKlM89088744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 24 Feb 2018 20:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329929 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 329929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 20:47:22 -0000 Author: markj Date: Sat Feb 24 20:47:22 2018 New Revision: 329929 URL: https://svnweb.freebsd.org/changeset/base/329929 Log: Restore the pre-r329882 inactive page shortage computation. With r329882, in the absence of a free page shortage we would only take len(PQ_INACTIVE)+len(PQ_LAUNDRY) into account when deciding whether to aggressively scan PQ_ACTIVE. Previously we would also include the number of free pages in this computation, ensuring that we wouldn't scan PQ_ACTIVE with plenty of free memory available. The change in behaviour was most noticeable immediately after booting, when PQ_INACTIVE and PQ_LAUNDRY are nearly empty. Reviewed by: jeff Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Feb 24 20:24:57 2018 (r329928) +++ head/sys/vm/vm_pageout.c Sat Feb 24 20:47:22 2018 (r329929) @@ -1398,7 +1398,7 @@ drop_page: */ inactq_shortage = vmd->vmd_inactive_target - (pq->pq_cnt + vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt / act_scan_laundry_weight) + - shortage + deficit + addl_page_shortage; + vm_paging_target(vmd) + deficit + addl_page_shortage; inactq_shortage *= act_scan_laundry_weight; pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; From owner-svn-src-all@freebsd.org Sat Feb 24 21:25:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C80FF23BA3; Sat, 24 Feb 2018 21:25:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A65377852; Sat, 24 Feb 2018 21:25:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 453B52B04B; Sat, 24 Feb 2018 21:25:57 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLPvuu008758; Sat, 24 Feb 2018 21:25:57 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLPvia008757; Sat, 24 Feb 2018 21:25:57 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201802242125.w1OLPvia008757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 24 Feb 2018 21:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329930 - head/sbin/route X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sbin/route X-SVN-Commit-Revision: 329930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:25:57 -0000 Author: eugen Date: Sat Feb 24 21:25:56 2018 New Revision: 329930 URL: https://svnweb.freebsd.org/changeset/base/329930 Log: route(8): make it possible to manually delete pinned route Reported by: Andreas Longwitz Approved by: avg (mentor) MFC after: 1 week Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Sat Feb 24 20:47:22 2018 (r329929) +++ head/sbin/route/route.c Sat Feb 24 21:25:56 2018 (r329930) @@ -1519,8 +1519,10 @@ rtmsg(int cmd, int flags, int fib) so[RTAX_IFP].ss_len = sizeof(struct sockaddr_dl); rtm_addrs |= RTA_IFP; } - } else + } else { cmd = RTM_DELETE; + flags |= RTF_PINNED; + } #define rtm m_rtmsg.m_rtm rtm.rtm_type = cmd; rtm.rtm_flags = flags; From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAE92F23E60; Sat, 24 Feb 2018 21:27:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E65E77AAE; Sat, 24 Feb 2018 21:27:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 791202B05E; Sat, 24 Feb 2018 21:27:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRWGD008871; Sat, 24 Feb 2018 21:27:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRUsV008854; Sat, 24 Feb 2018 21:27:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRUsV008854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329931 - in vendor/llvm/dist-release_60: docs include/llvm/Bitcode include/llvm/MC include/llvm/Transforms/Utils lib/Analysis lib/Bitcode/Reader lib/Bitcode/Writer lib/Support lib/Targ... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_60: docs include/llvm/Bitcode include/llvm/MC include/llvm/Transforms/Utils lib/Analysis lib/Bitcode/Reader lib/Bitcode/Writer lib/Support lib/Target/AArch64 lib/Target/AMD... X-SVN-Commit-Revision: 329931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:33 -0000 Author: dim Date: Sat Feb 24 21:27:30 2018 New Revision: 329931 URL: https://svnweb.freebsd.org/changeset/base/329931 Log: Vendor import of llvm release_60 branch r325932: https://llvm.org/svn/llvm-project/llvm/branches/release_60@325932 Added: vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/fp16-copy-gpr.mir vendor/llvm/dist-release_60/test/CodeGen/PowerPC/pr36292.ll vendor/llvm/dist-release_60/test/Transforms/InstCombine/pr36362.ll Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst vendor/llvm/dist-release_60/docs/index.rst vendor/llvm/dist-release_60/include/llvm/Bitcode/LLVMBitCodes.h vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h vendor/llvm/dist-release_60/include/llvm/Transforms/Utils/LoopUtils.h vendor/llvm/dist-release_60/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist-release_60/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist-release_60/lib/Bitcode/Writer/BitcodeWriter.cpp vendor/llvm/dist-release_60/lib/Support/CMakeLists.txt vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCCTRLoops.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86.td vendor/llvm/dist-release_60/lib/Transforms/InstCombine/InstCombineSelect.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/LICM.cpp vendor/llvm/dist-release_60/lib/Transforms/Utils/LoopUtils.cpp vendor/llvm/dist-release_60/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist-release_60/test/Bitcode/compatibility-3.6.ll vendor/llvm/dist-release_60/test/Bitcode/compatibility-3.7.ll vendor/llvm/dist-release_60/test/Bitcode/compatibility-3.8.ll vendor/llvm/dist-release_60/test/Bitcode/compatibility-3.9.ll vendor/llvm/dist-release_60/test/Bitcode/compatibility-4.0.ll vendor/llvm/dist-release_60/test/Bitcode/compatibility-5.0.ll vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/select-insert-extract.mir vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/smrd.ll vendor/llvm/dist-release_60/test/CodeGen/X86/clwb.ll vendor/llvm/dist-release_60/test/Transforms/LICM/sinking.ll vendor/llvm/dist-release_60/test/Transforms/LoopVectorize/pr30654-phiscev-sext-trunc.ll vendor/llvm/dist-release_60/test/Transforms/LoopVectorize/pr35773.ll vendor/llvm/dist-release_60/test/Transforms/LoopVectorize/reduction-small-size.ll vendor/llvm/dist-release_60/test/Transforms/LoopVectorize/vect-phiscev-sext-trunc.ll vendor/llvm/dist-release_60/test/tools/llvm-config/system-libs.windows.test Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:27:30 2018 (r329931) @@ -5,12 +5,6 @@ LLVM 6.0.0 Release Notes .. contents:: :local: -.. warning:: - These are in-progress notes for the upcoming LLVM 6 release. - Release notes for previous releases can be found on - `the Download Page `_. - - Introduction ============ @@ -26,11 +20,6 @@ have questions or comments, the `LLVM Developer's Mail `_ is a good place to send them. -Note that if you are reading this file from a Subversion checkout or the main -LLVM web page, this document applies to the *next* release, not the current -one. To see the release notes for a specific release, please see the `releases -page `_. - Non-comprehensive list of changes in this release ================================================= .. NOTE @@ -56,6 +45,9 @@ Non-comprehensive list of changes in this release * Significantly improved quality of CodeView debug info for Windows. +* Preliminary support for Sanitizers and sibling features on X86(_64) NetBSD + (ASan, UBsan, TSan, MSan, SafeStack, libFuzzer). + * Note.. .. NOTE @@ -71,6 +63,15 @@ Non-comprehensive list of changes in this release Changes to the LLVM IR ---------------------- +* The fast-math-flags (FMF) have been updated. Previously, the 'fast' flag + indicated that floating-point reassociation was allowed and all other flags + were set too. The 'fast' flag still exists, but there is a new flag called + 'reassoc' to indicate specifically that reassociation is allowed. A new bit + called 'afn' was also added to selectively allow approximations for common + mathlib functions like square-root. The new flags provide more flexibility + to enable/disable specific floating-point optimizations. Making the + optimizer respond appropriately to these flags is an ongoing effort. + Changes to the AArch64 Target ----------------------------- @@ -112,9 +113,45 @@ Changes to the Hexagon Target Changes to the MIPS Target -------------------------- - During this release ... +Fixed numerous bugs: +* fpowi on MIPS64 giving incorrect results when used with a negative integer. +* Usage of the asm 'c' constraint with the wrong datatype causing an + assert/crash. +* Fixed a conversion bug when using the DSP ASE. +* Fixed an inconsistency where objects were not marked as using the microMIPS as + when the micromips function attribute or the ".set micromips" directive was + used. +* Reordered the MIPSR6 specific hazard scheduler pass to after the delay slot + filler, fixing a class of rare edge case bugs where the delay slot filler + would violate ISA restrictions. +* Fixed a crash when using a type of unknown size with gp relative addressing. +* Corrected the j macro for microMIPS. +* Corrected the encoding of movep for microMIPS32r6. +* Fixed an issue with the usage of insert instructions having an invalid set of + operands. +* Fixed an issue where TLS symbols where not marked as such. +* Enabled the usage of register scavanging with MSA, due to its' shorter offsets + for loads and stores. +* Corrected the ELF headers when using the DSP ASE. +New features: + +* The long branch pass now generates some R6 specific instructions when + targeting MIPSR6. +* The delay slot filler now performs more branch conversions if delay slots + cannot be filled. +* The MIPS MT ASE is now fully supported. +* Added support for the ``lapc`` pseudo instruction. +* Improved the selection of multiple instructions (``dext``, ``nmadd``, + ``nmsub``). +* Further improved microMIPS codesize reduction. + +Deprecation notices: + +* microMIPS64R6 support was been deprecated since 5.0, and has now been + completely removed. + Changes to the PowerPC Target ----------------------------- @@ -132,10 +169,42 @@ During this release the SystemZ target has: Changes to the X86 Target ------------------------- -During this release ... +During this release the X86 target has: -* Got support for enabling SjLj exception handling on platforms where it +* Added support for enabling SjLj exception handling on platforms where it isn't the default. + +* Added intrinsics for Intel Extensions: VAES, GFNI, VPCLMULQDQ, AVX512VBMI2, AVX512BITALG, AVX512VNNI. + +* Added support for Intel Icelake CPU. + +* Fixed some X87 codegen bugs. + +* Added instruction scheduling information for Intel Sandy Bridge, Ivy Bridge, Haswell, Broadwell, and Skylake CPUs. + +* Improved scheduler model for AMD Jaguar CPUs. + +* Improved llvm-mc's disassembler for some EVEX encoded instructions. + +* Add support for i8 and i16 vector signed/unsigned min/max horizontal reductions. + +* Improved codegen for memory comparisons + +* Improved codegen for i32 vector multiplies + +* Improved codegen for scalar integer absolute values + +* Improved codegen for vector integer rotations (XOP and AVX512) + +* Improved codegen of data being transferred between GPRs and K-registers. + +* Improved codegen for vector truncations. + +* Improved folding of address computations into gather/scatter instructions. + +* Gained initial support recognizing variable shuffles from vector element extracts and inserts. + +* Improved documentation for SSE/AVX intrinsics in *intrin.h header files. Changes to the AMDGPU Target ----------------------------- Modified: vendor/llvm/dist-release_60/docs/index.rst ============================================================================== --- vendor/llvm/dist-release_60/docs/index.rst Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/docs/index.rst Sat Feb 24 21:27:30 2018 (r329931) @@ -1,11 +1,6 @@ Overview ======== -.. warning:: - - If you are using a released version of LLVM, see `the download page - `_ to find your documentation. - The LLVM compiler infrastructure supports a wide range of projects, from industrial strength compilers to specialized JIT applications to small research projects. Modified: vendor/llvm/dist-release_60/include/llvm/Bitcode/LLVMBitCodes.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Bitcode/LLVMBitCodes.h Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/include/llvm/Bitcode/LLVMBitCodes.h Sat Feb 24 21:27:30 2018 (r329931) @@ -395,6 +395,20 @@ enum OverflowingBinaryOperatorOptionalFlags { OBO_NO_SIGNED_WRAP = 1 }; +/// FastMath Flags +/// This is a fixed layout derived from the bitcode emitted by LLVM 5.0 +/// intended to decouple the in-memory representation from the serialization. +enum FastMathMap { + UnsafeAlgebra = (1 << 0), // Legacy + NoNaNs = (1 << 1), + NoInfs = (1 << 2), + NoSignedZeros = (1 << 3), + AllowReciprocal = (1 << 4), + AllowContract = (1 << 5), + ApproxFunc = (1 << 6), + AllowReassoc = (1 << 7) +}; + /// PossiblyExactOperatorOptionalFlags - Flags for serializing /// PossiblyExactOperator's SubclassOptionalData contents. enum PossiblyExactOperatorOptionalFlags { PEO_EXACT = 0 }; Modified: vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/include/llvm/MC/MCAsmMacro.h Sat Feb 24 21:27:30 2018 (r329931) @@ -33,6 +33,6 @@ struct MCAsmMacro { (public) MCAsmMacro(StringRef N, StringRef B, MCAsmMacroParameters P) : Name(N), Body(B), Parameters(std::move(P)) {} }; -}; // namespace llvm +} // namespace llvm #endif Modified: vendor/llvm/dist-release_60/include/llvm/Transforms/Utils/LoopUtils.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Transforms/Utils/LoopUtils.h Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/include/llvm/Transforms/Utils/LoopUtils.h Sat Feb 24 21:27:30 2018 (r329931) @@ -21,6 +21,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/EHPersonalities.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/Dominators.h" @@ -172,15 +173,25 @@ class RecurrenceDescriptor { (public) Value *Left, Value *Right); /// Returns true if Phi is a reduction of type Kind and adds it to the - /// RecurrenceDescriptor. + /// RecurrenceDescriptor. If either \p DB is non-null or \p AC and \p DT are + /// non-null, the minimal bit width needed to compute the reduction will be + /// computed. static bool AddReductionVar(PHINode *Phi, RecurrenceKind Kind, Loop *TheLoop, bool HasFunNoNaNAttr, - RecurrenceDescriptor &RedDes); + RecurrenceDescriptor &RedDes, + DemandedBits *DB = nullptr, + AssumptionCache *AC = nullptr, + DominatorTree *DT = nullptr); - /// Returns true if Phi is a reduction in TheLoop. The RecurrenceDescriptor is - /// returned in RedDes. + /// Returns true if Phi is a reduction in TheLoop. The RecurrenceDescriptor + /// is returned in RedDes. If either \p DB is non-null or \p AC and \p DT are + /// non-null, the minimal bit width needed to compute the reduction will be + /// computed. static bool isReductionPHI(PHINode *Phi, Loop *TheLoop, - RecurrenceDescriptor &RedDes); + RecurrenceDescriptor &RedDes, + DemandedBits *DB = nullptr, + AssumptionCache *AC = nullptr, + DominatorTree *DT = nullptr); /// Returns true if Phi is a first-order recurrence. A first-order recurrence /// is a non-reduction recurrence relation in which the value of the @@ -217,24 +228,6 @@ class RecurrenceDescriptor { (public) /// Returns true if the recurrence kind is an arithmetic kind. static bool isArithmeticRecurrenceKind(RecurrenceKind Kind); - - /// Determines if Phi may have been type-promoted. If Phi has a single user - /// that ANDs the Phi with a type mask, return the user. RT is updated to - /// account for the narrower bit width represented by the mask, and the AND - /// instruction is added to CI. - static Instruction *lookThroughAnd(PHINode *Phi, Type *&RT, - SmallPtrSetImpl &Visited, - SmallPtrSetImpl &CI); - - /// Returns true if all the source operands of a recurrence are either - /// SExtInsts or ZExtInsts. This function is intended to be used with - /// lookThroughAnd to determine if the recurrence has been type-promoted. The - /// source operands are added to CI, and IsSigned is updated to indicate if - /// all source operands are SExtInsts. - static bool getSourceExtensionKind(Instruction *Start, Instruction *Exit, - Type *RT, bool &IsSigned, - SmallPtrSetImpl &Visited, - SmallPtrSetImpl &CI); /// Returns the type of the recurrence. This type can be narrower than the /// actual type of the Phi if the recurrence has been type-promoted. Modified: vendor/llvm/dist-release_60/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Analysis/ScalarEvolution.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Analysis/ScalarEvolution.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -205,6 +205,11 @@ static cl::opt cl::desc("Max coefficients in AddRec during evolving"), cl::init(16)); +static cl::opt VersionUnknown( + "scev-version-unknown", cl::Hidden, + cl::desc("Use predicated scalar evolution to version SCEVUnknowns"), + cl::init(false)); + //===----------------------------------------------------------------------===// // SCEV class definitions //===----------------------------------------------------------------------===// @@ -11467,6 +11472,8 @@ class SCEVPredicateRewriter : public SCEVRewriteVisito // couldn't create an AddRec for it, or couldn't add the predicate), we just // return \p Expr. const SCEV *convertToAddRecWithPreds(const SCEVUnknown *Expr) { + if (!VersionUnknown) + return Expr; if (!isa(Expr->getValue())) return Expr; Optional>> Modified: vendor/llvm/dist-release_60/lib/Bitcode/Reader/BitcodeReader.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Bitcode/Reader/BitcodeReader.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Bitcode/Reader/BitcodeReader.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -1046,19 +1046,21 @@ static Comdat::SelectionKind getDecodedComdatSelection static FastMathFlags getDecodedFastMathFlags(unsigned Val) { FastMathFlags FMF; - if (0 != (Val & FastMathFlags::AllowReassoc)) + if (0 != (Val & bitc::UnsafeAlgebra)) + FMF.setFast(); + if (0 != (Val & bitc::AllowReassoc)) FMF.setAllowReassoc(); - if (0 != (Val & FastMathFlags::NoNaNs)) + if (0 != (Val & bitc::NoNaNs)) FMF.setNoNaNs(); - if (0 != (Val & FastMathFlags::NoInfs)) + if (0 != (Val & bitc::NoInfs)) FMF.setNoInfs(); - if (0 != (Val & FastMathFlags::NoSignedZeros)) + if (0 != (Val & bitc::NoSignedZeros)) FMF.setNoSignedZeros(); - if (0 != (Val & FastMathFlags::AllowReciprocal)) + if (0 != (Val & bitc::AllowReciprocal)) FMF.setAllowReciprocal(); - if (0 != (Val & FastMathFlags::AllowContract)) + if (0 != (Val & bitc::AllowContract)) FMF.setAllowContract(true); - if (0 != (Val & FastMathFlags::ApproxFunc)) + if (0 != (Val & bitc::ApproxFunc)) FMF.setApproxFunc(); return FMF; } Modified: vendor/llvm/dist-release_60/lib/Bitcode/Writer/BitcodeWriter.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Bitcode/Writer/BitcodeWriter.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Bitcode/Writer/BitcodeWriter.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -1330,19 +1330,19 @@ static uint64_t getOptimizationFlags(const Value *V) { Flags |= 1 << bitc::PEO_EXACT; } else if (const auto *FPMO = dyn_cast(V)) { if (FPMO->hasAllowReassoc()) - Flags |= FastMathFlags::AllowReassoc; + Flags |= bitc::AllowReassoc; if (FPMO->hasNoNaNs()) - Flags |= FastMathFlags::NoNaNs; + Flags |= bitc::NoNaNs; if (FPMO->hasNoInfs()) - Flags |= FastMathFlags::NoInfs; + Flags |= bitc::NoInfs; if (FPMO->hasNoSignedZeros()) - Flags |= FastMathFlags::NoSignedZeros; + Flags |= bitc::NoSignedZeros; if (FPMO->hasAllowReciprocal()) - Flags |= FastMathFlags::AllowReciprocal; + Flags |= bitc::AllowReciprocal; if (FPMO->hasAllowContract()) - Flags |= FastMathFlags::AllowContract; + Flags |= bitc::AllowContract; if (FPMO->hasApproxFunc()) - Flags |= FastMathFlags::ApproxFunc; + Flags |= bitc::ApproxFunc; } return Flags; @@ -3183,7 +3183,7 @@ void ModuleBitcodeWriter::writeBlockInfo() { Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); // flags + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); // flags if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) != FUNCTION_INST_BINOP_FLAGS_ABBREV) llvm_unreachable("Unexpected abbrev ordering!"); Modified: vendor/llvm/dist-release_60/lib/Support/CMakeLists.txt ============================================================================== --- vendor/llvm/dist-release_60/lib/Support/CMakeLists.txt Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Support/CMakeLists.txt Sat Feb 24 21:27:30 2018 (r329931) @@ -4,7 +4,8 @@ if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ ) endif() if( MSVC OR MINGW ) # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc. - set(system_libs ${system_libs} psapi shell32 ole32 uuid) + # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc. + set(system_libs ${system_libs} psapi shell32 ole32 uuid advapi32) elseif( CMAKE_HOST_UNIX ) if( HAVE_LIBRT ) set(system_libs ${system_libs} rt) Modified: vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -133,16 +133,21 @@ AArch64InstructionSelector::AArch64InstructionSelector // for each class in the bank. static const TargetRegisterClass * getRegClassForTypeOnBank(LLT Ty, const RegisterBank &RB, - const RegisterBankInfo &RBI) { + const RegisterBankInfo &RBI, + bool GetAllRegSet = false) { if (RB.getID() == AArch64::GPRRegBankID) { if (Ty.getSizeInBits() <= 32) - return &AArch64::GPR32RegClass; + return GetAllRegSet ? &AArch64::GPR32allRegClass + : &AArch64::GPR32RegClass; if (Ty.getSizeInBits() == 64) - return &AArch64::GPR64RegClass; + return GetAllRegSet ? &AArch64::GPR64allRegClass + : &AArch64::GPR64RegClass; return nullptr; } if (RB.getID() == AArch64::FPRRegBankID) { + if (Ty.getSizeInBits() <= 16) + return &AArch64::FPR16RegClass; if (Ty.getSizeInBits() == 32) return &AArch64::FPR32RegClass; if (Ty.getSizeInBits() == 64) @@ -310,19 +315,46 @@ static unsigned selectLoadStoreUIOp(unsigned GenericOp return GenericOpc; } +static bool selectFP16CopyFromGPR32(MachineInstr &I, const TargetInstrInfo &TII, + MachineRegisterInfo &MRI, unsigned SrcReg) { + // Copies from gpr32 to fpr16 need to use a sub-register copy. + unsigned CopyReg = MRI.createVirtualRegister(&AArch64::FPR32RegClass); + BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(AArch64::COPY)) + .addDef(CopyReg) + .addUse(SrcReg); + unsigned SubRegCopy = MRI.createVirtualRegister(&AArch64::FPR16RegClass); + BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(TargetOpcode::COPY)) + .addDef(SubRegCopy) + .addUse(CopyReg, 0, AArch64::hsub); + + MachineOperand &RegOp = I.getOperand(1); + RegOp.setReg(SubRegCopy); + return true; +} + static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII, MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI) { unsigned DstReg = I.getOperand(0).getReg(); + unsigned SrcReg = I.getOperand(1).getReg(); + if (TargetRegisterInfo::isPhysicalRegister(DstReg)) { + if (TRI.getRegClass(AArch64::FPR16RegClassID)->contains(DstReg) && + !TargetRegisterInfo::isPhysicalRegister(SrcReg)) { + const RegisterBank &RegBank = *RBI.getRegBank(SrcReg, MRI, TRI); + const TargetRegisterClass *SrcRC = getRegClassForTypeOnBank( + MRI.getType(SrcReg), RegBank, RBI, /* GetAllRegSet */ true); + if (SrcRC == &AArch64::GPR32allRegClass) + return selectFP16CopyFromGPR32(I, TII, MRI, SrcReg); + } assert(I.isCopy() && "Generic operators do not allow physical registers"); return true; } const RegisterBank &RegBank = *RBI.getRegBank(DstReg, MRI, TRI); const unsigned DstSize = MRI.getType(DstReg).getSizeInBits(); - unsigned SrcReg = I.getOperand(1).getReg(); + (void)DstSize; const unsigned SrcSize = RBI.getSizeInBits(SrcReg, MRI, TRI); (void)SrcSize; assert((!TargetRegisterInfo::isPhysicalRegister(SrcReg) || I.isCopy()) && @@ -340,26 +372,38 @@ static bool selectCopy(MachineInstr &I, const TargetIn "Copy with different width?!"); assert((DstSize <= 64 || RegBank.getID() == AArch64::FPRRegBankID) && "GPRs cannot get more than 64-bit width values"); - const TargetRegisterClass *RC = nullptr; - if (RegBank.getID() == AArch64::FPRRegBankID) { - if (DstSize <= 16) - RC = &AArch64::FPR16RegClass; - else if (DstSize <= 32) - RC = &AArch64::FPR32RegClass; - else if (DstSize <= 64) - RC = &AArch64::FPR64RegClass; - else if (DstSize <= 128) - RC = &AArch64::FPR128RegClass; - else { - DEBUG(dbgs() << "Unexpected bitcast size " << DstSize << '\n'); - return false; + const TargetRegisterClass *RC = getRegClassForTypeOnBank( + MRI.getType(DstReg), RegBank, RBI, /* GetAllRegSet */ true); + if (!RC) { + DEBUG(dbgs() << "Unexpected bitcast size " << DstSize << '\n'); + return false; + } + + if (!TargetRegisterInfo::isPhysicalRegister(SrcReg)) { + const RegClassOrRegBank &RegClassOrBank = MRI.getRegClassOrRegBank(SrcReg); + const TargetRegisterClass *SrcRC = + RegClassOrBank.dyn_cast(); + const RegisterBank *RB = nullptr; + if (!SrcRC) { + RB = RegClassOrBank.get(); + SrcRC = getRegClassForTypeOnBank(MRI.getType(SrcReg), *RB, RBI, true); } - } else { - assert(RegBank.getID() == AArch64::GPRRegBankID && - "Bitcast for the flags?"); - RC = - DstSize <= 32 ? &AArch64::GPR32allRegClass : &AArch64::GPR64allRegClass; + // Copies from fpr16 to gpr32 need to use SUBREG_TO_REG. + if (RC == &AArch64::GPR32allRegClass && SrcRC == &AArch64::FPR16RegClass) { + unsigned PromoteReg = MRI.createVirtualRegister(&AArch64::FPR32RegClass); + BuildMI(*I.getParent(), I, I.getDebugLoc(), + TII.get(AArch64::SUBREG_TO_REG)) + .addDef(PromoteReg) + .addImm(0) + .addUse(SrcReg) + .addImm(AArch64::hsub); + MachineOperand &RegOp = I.getOperand(1); + RegOp.setReg(PromoteReg); + } else if (RC == &AArch64::FPR16RegClass && + SrcRC == &AArch64::GPR32allRegClass) { + selectFP16CopyFromGPR32(I, TII, MRI, SrcReg); + } } // No need to constrain SrcReg. It will get constrained when @@ -795,15 +839,23 @@ bool AArch64InstructionSelector::select(MachineInstr & } case TargetOpcode::G_EXTRACT: { LLT SrcTy = MRI.getType(I.getOperand(1).getReg()); + LLT DstTy = MRI.getType(I.getOperand(0).getReg()); + unsigned SrcSize = SrcTy.getSizeInBits(); // Larger extracts are vectors, same-size extracts should be something else // by now (either split up or simplified to a COPY). if (SrcTy.getSizeInBits() > 64 || Ty.getSizeInBits() > 32) return false; - I.setDesc(TII.get(AArch64::UBFMXri)); + I.setDesc(TII.get(SrcSize == 64 ? AArch64::UBFMXri : AArch64::UBFMWri)); MachineInstrBuilder(MF, I).addImm(I.getOperand(2).getImm() + Ty.getSizeInBits() - 1); + if (SrcSize < 64) { + assert(SrcSize == 32 && DstTy.getSizeInBits() == 16 && + "unexpected G_EXTRACT types"); + return constrainSelectedInstRegOperands(I, TII, TRI, RBI); + } + unsigned DstReg = MRI.createGenericVirtualRegister(LLT::scalar(64)); BuildMI(MBB, std::next(I.getIterator()), I.getDebugLoc(), TII.get(AArch64::COPY)) @@ -818,16 +870,25 @@ bool AArch64InstructionSelector::select(MachineInstr & case TargetOpcode::G_INSERT: { LLT SrcTy = MRI.getType(I.getOperand(2).getReg()); + LLT DstTy = MRI.getType(I.getOperand(0).getReg()); + unsigned DstSize = DstTy.getSizeInBits(); + (void)DstSize; // Larger inserts are vectors, same-size ones should be something else by // now (split up or turned into COPYs). if (Ty.getSizeInBits() > 64 || SrcTy.getSizeInBits() > 32) return false; - I.setDesc(TII.get(AArch64::BFMXri)); + I.setDesc(TII.get(DstSize == 64 ? AArch64::BFMXri : AArch64::BFMWri)); unsigned LSB = I.getOperand(3).getImm(); unsigned Width = MRI.getType(I.getOperand(2).getReg()).getSizeInBits(); - I.getOperand(3).setImm((64 - LSB) % 64); + I.getOperand(3).setImm((DstSize - LSB) % DstSize); MachineInstrBuilder(MF, I).addImm(Width - 1); + + if (DstSize < 64) { + assert(DstSize == 32 && SrcTy.getSizeInBits() == 16 && + "unexpected G_INSERT types"); + return constrainSelectedInstRegOperands(I, TII, TRI, RBI); + } unsigned SrcReg = MRI.createGenericVirtualRegister(LLT::scalar(64)); BuildMI(MBB, I.getIterator(), I.getDebugLoc(), Modified: vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Target/AMDGPU/SIInstrInfo.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -3797,7 +3797,8 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) co } } - BuildMI(*MBB, Inst, Inst.getDebugLoc(), + MachineInstr *NewInstr = + BuildMI(*MBB, Inst, Inst.getDebugLoc(), get(AMDGPU::BUFFER_LOAD_DWORD_OFFEN), VDst) .add(*VAddr) // vaddr .add(*getNamedOperand(Inst, AMDGPU::OpName::sbase)) // srsrc @@ -3806,12 +3807,17 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) co .addImm(getNamedOperand(Inst, AMDGPU::OpName::glc)->getImm()) .addImm(0) // slc .addImm(0) // tfe - .setMemRefs(Inst.memoperands_begin(), Inst.memoperands_end()); + .setMemRefs(Inst.memoperands_begin(), Inst.memoperands_end()) + .getInstr(); MRI.replaceRegWith(getNamedOperand(Inst, AMDGPU::OpName::sdst)->getReg(), VDst); addUsersToMoveToVALUWorklist(VDst, MRI, Worklist); Inst.eraseFromParent(); + + // Legalize all operands other than the offset. Notably, convert the srsrc + // into SGPRs using v_readfirstlane if needed. + legalizeOperands(*NewInstr); continue; } } Modified: vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCCTRLoops.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCCTRLoops.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCCTRLoops.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -454,13 +454,16 @@ bool PPCCTRLoops::mightUseCTR(BasicBlock *BB) { return true; } + // FREM is always a call. + if (J->getOpcode() == Instruction::FRem) + return true; + if (STI->useSoftFloat()) { switch(J->getOpcode()) { case Instruction::FAdd: case Instruction::FSub: case Instruction::FMul: case Instruction::FDiv: - case Instruction::FRem: case Instruction::FPTrunc: case Instruction::FPExt: case Instruction::FPToUI: Modified: vendor/llvm/dist-release_60/lib/Target/X86/X86.td ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/X86/X86.td Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Target/X86/X86.td Sat Feb 24 21:27:30 2018 (r329931) @@ -740,7 +740,13 @@ class SkylakeServerProc : ProcModel; def : SkylakeServerProc<"skx">; // Legacy alias. -def CNLFeatures : ProcessorFeaturesgetOpcode()) { + default: + return true; + case Instruction::SRem: + case Instruction::URem: + case Instruction::SDiv: + case Instruction::UDiv: + return false; + } + }; + // Try to simplify a binop sandwiched between 2 selects with the same // condition. // select(C, binop(select(C, X, Y), W), Z) -> select(C, binop(X, W), Z) BinaryOperator *TrueBO; - if (match(TrueVal, m_OneUse(m_BinOp(TrueBO)))) { + if (match(TrueVal, m_OneUse(m_BinOp(TrueBO))) && + canMergeSelectThroughBinop(TrueBO)) { if (auto *TrueBOSI = dyn_cast(TrueBO->getOperand(0))) { if (TrueBOSI->getCondition() == CondVal) { TrueBO->setOperand(0, TrueBOSI->getTrueValue()); @@ -1666,7 +1680,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst // select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z, binop(Y, W)) BinaryOperator *FalseBO; - if (match(FalseVal, m_OneUse(m_BinOp(FalseBO)))) { + if (match(FalseVal, m_OneUse(m_BinOp(FalseBO))) && + canMergeSelectThroughBinop(FalseBO)) { if (auto *FalseBOSI = dyn_cast(FalseBO->getOperand(0))) { if (FalseBOSI->getCondition() == CondVal) { FalseBO->setOperand(0, FalseBOSI->getFalseValue()); Modified: vendor/llvm/dist-release_60/lib/Transforms/Scalar/LICM.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Transforms/Scalar/LICM.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Transforms/Scalar/LICM.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -97,7 +97,7 @@ static bool hoist(Instruction &I, const DominatorTree const LoopSafetyInfo *SafetyInfo, OptimizationRemarkEmitter *ORE); static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT, - const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo, + const Loop *CurLoop, LoopSafetyInfo *SafetyInfo, OptimizationRemarkEmitter *ORE, bool FreeInLoop); static bool isSafeToExecuteUnconditionally(Instruction &Inst, const DominatorTree *DT, @@ -855,10 +855,16 @@ static Instruction *sinkThroughTriviallyReplacablePHI( return New; } -static bool canSplitPredecessors(PHINode *PN) { +static bool canSplitPredecessors(PHINode *PN, LoopSafetyInfo *SafetyInfo) { BasicBlock *BB = PN->getParent(); if (!BB->canSplitPredecessors()) return false; + // It's not impossible to split EHPad blocks, but if BlockColors already exist + // it require updating BlockColors for all offspring blocks accordingly. By + // skipping such corner case, we can make updating BlockColors after splitting + // predecessor fairly simple. + if (!SafetyInfo->BlockColors.empty() && BB->getFirstNonPHI()->isEHPad()) + return false; for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { BasicBlock *BBPred = *PI; if (isa(BBPred->getTerminator())) @@ -868,7 +874,8 @@ static bool canSplitPredecessors(PHINode *PN) { } static void splitPredecessorsOfLoopExit(PHINode *PN, DominatorTree *DT, - LoopInfo *LI, const Loop *CurLoop) { + LoopInfo *LI, const Loop *CurLoop, + LoopSafetyInfo *SafetyInfo) { #ifndef NDEBUG SmallVector ExitBlocks; CurLoop->getUniqueExitBlocks(ExitBlocks); @@ -910,13 +917,21 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, D // LE: // %p = phi [%p1, %LE.split], [%p2, %LE.split2] // + auto &BlockColors = SafetyInfo->BlockColors; SmallSetVector PredBBs(pred_begin(ExitBB), pred_end(ExitBB)); while (!PredBBs.empty()) { BasicBlock *PredBB = *PredBBs.begin(); assert(CurLoop->contains(PredBB) && "Expect all predecessors are in the loop"); - if (PN->getBasicBlockIndex(PredBB) >= 0) - SplitBlockPredecessors(ExitBB, PredBB, ".split.loop.exit", DT, LI, true); + if (PN->getBasicBlockIndex(PredBB) >= 0) { + BasicBlock *NewPred = SplitBlockPredecessors( + ExitBB, PredBB, ".split.loop.exit", DT, LI, true); + // Since we do not allow splitting EH-block with BlockColors in + // canSplitPredecessors(), we can simply assign predecessor's color to + // the new block. + if (!BlockColors.empty()) + BlockColors[NewPred] = BlockColors[PredBB]; + } PredBBs.remove(PredBB); } } @@ -927,7 +942,7 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, D /// position, and may either delete it or move it to outside of the loop. /// static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT, - const Loop *CurLoop, const LoopSafetyInfo *SafetyInfo, + const Loop *CurLoop, LoopSafetyInfo *SafetyInfo, OptimizationRemarkEmitter *ORE, bool FreeInLoop) { DEBUG(dbgs() << "LICM sinking instruction: " << I << "\n"); ORE->emit([&]() { @@ -975,12 +990,12 @@ static bool sink(Instruction &I, LoopInfo *LI, Dominat if (isTriviallyReplacablePHI(*PN, I)) continue; - if (!canSplitPredecessors(PN)) + if (!canSplitPredecessors(PN, SafetyInfo)) return Changed; // Split predecessors of the PHI so that we can make users trivially // replacable. - splitPredecessorsOfLoopExit(PN, DT, LI, CurLoop); + splitPredecessorsOfLoopExit(PN, DT, LI, CurLoop, SafetyInfo); // Should rebuild the iterators, as they may be invalidated by // splitPredecessorsOfLoopExit(). Modified: vendor/llvm/dist-release_60/lib/Transforms/Utils/LoopUtils.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Transforms/Utils/LoopUtils.cpp Sat Feb 24 21:25:56 2018 (r329930) +++ vendor/llvm/dist-release_60/lib/Transforms/Utils/LoopUtils.cpp Sat Feb 24 21:27:30 2018 (r329931) @@ -23,6 +23,7 @@ #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" @@ -30,6 +31,7 @@ #include "llvm/IR/ValueHandle.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/KnownBits.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" using namespace llvm; @@ -77,10 +79,13 @@ bool RecurrenceDescriptor::isArithmeticRecurrenceKind( return false; } -Instruction * -RecurrenceDescriptor::lookThroughAnd(PHINode *Phi, Type *&RT, - SmallPtrSetImpl &Visited, - SmallPtrSetImpl &CI) { +/// Determines if Phi may have been type-promoted. If Phi has a single user +/// that ANDs the Phi with a type mask, return the user. RT is updated to +/// account for the narrower bit width represented by the mask, and the AND +/// instruction is added to CI. +static Instruction *lookThroughAnd(PHINode *Phi, Type *&RT, + SmallPtrSetImpl &Visited, + SmallPtrSetImpl &CI) { if (!Phi->hasOneUse()) return Phi; @@ -101,70 +106,92 @@ RecurrenceDescriptor::lookThroughAnd(PHINode *Phi, Typ return Phi; } -bool RecurrenceDescriptor::getSourceExtensionKind( - Instruction *Start, Instruction *Exit, Type *RT, bool &IsSigned, - SmallPtrSetImpl &Visited, - SmallPtrSetImpl &CI) { +/// Compute the minimal bit width needed to represent a reduction whose exit +/// instruction is given by Exit. +static std::pair computeRecurrenceType(Instruction *Exit, + DemandedBits *DB, + AssumptionCache *AC, + DominatorTree *DT) { + bool IsSigned = false; + const DataLayout &DL = Exit->getModule()->getDataLayout(); + uint64_t MaxBitWidth = DL.getTypeSizeInBits(Exit->getType()); + if (DB) { + // Use the demanded bits analysis to determine the bits that are live out + // of the exit instruction, rounding up to the nearest power of two. If the + // use of demanded bits results in a smaller bit width, we know the value + // must be positive (i.e., IsSigned = false), because if this were not the + // case, the sign bit would have been demanded. + auto Mask = DB->getDemandedBits(Exit); + MaxBitWidth = Mask.getBitWidth() - Mask.countLeadingZeros(); + } + + if (MaxBitWidth == DL.getTypeSizeInBits(Exit->getType()) && AC && DT) { + // If demanded bits wasn't able to limit the bit width, we can try to use + // value tracking instead. This can be the case, for example, if the value + // may be negative. + auto NumSignBits = ComputeNumSignBits(Exit, DL, 0, AC, nullptr, DT); + auto NumTypeBits = DL.getTypeSizeInBits(Exit->getType()); + MaxBitWidth = NumTypeBits - NumSignBits; + KnownBits Bits = computeKnownBits(Exit, DL); + if (!Bits.isNonNegative()) { + // If the value is not known to be non-negative, we set IsSigned to true, + // meaning that we will use sext instructions instead of zext + // instructions to restore the original type. + IsSigned = true; + if (!Bits.isNegative()) + // If the value is not known to be negative, we don't known what the + // upper bit is, and therefore, we don't know what kind of extend we + // will need. In this case, just increase the bit width by one bit and + // use sext. + ++MaxBitWidth; + } + } + if (!isPowerOf2_64(MaxBitWidth)) + MaxBitWidth = NextPowerOf2(MaxBitWidth); + + return std::make_pair(Type::getIntNTy(Exit->getContext(), MaxBitWidth), + IsSigned); +} + +/// Collect cast instructions that can be ignored in the vectorizer's cost +/// model, given a reduction exit value and the minimal type in which the +/// reduction can be represented. +static void collectCastsToIgnore(Loop *TheLoop, Instruction *Exit, + Type *RecurrenceType, + SmallPtrSetImpl &Casts) { + SmallVector Worklist; - bool FoundOneOperand = false; - unsigned DstSize = RT->getPrimitiveSizeInBits(); + SmallPtrSet Visited; Worklist.push_back(Exit); - // Traverse the instructions in the reduction expression, beginning with the - // exit value. while (!Worklist.empty()) { - Instruction *I = Worklist.pop_back_val(); - for (Use &U : I->operands()) { - - // Terminate the traversal if the operand is not an instruction, or we - // reach the starting value. - Instruction *J = dyn_cast(U.get()); - if (!J || J == Start) + Instruction *Val = Worklist.pop_back_val(); + Visited.insert(Val); + if (auto *Cast = dyn_cast(Val)) + if (Cast->getSrcTy() == RecurrenceType) { + // If the source type of a cast instruction is equal to the recurrence + // type, it will be eliminated, and should be ignored in the vectorizer + // cost model. + Casts.insert(Cast); continue; - - // Otherwise, investigate the operation if it is also in the expression. - if (Visited.count(J)) { - Worklist.push_back(J); - continue; } - // If the operand is not in Visited, it is not a reduction operation, but - // it does feed into one. Make sure it is either a single-use sign- or - // zero-extend instruction. - CastInst *Cast = dyn_cast(J); - bool IsSExtInst = isa(J); - if (!Cast || !Cast->hasOneUse() || !(isa(J) || IsSExtInst)) - return false; - - // Ensure the source type of the extend is no larger than the reduction - // type. It is not necessary for the types to be identical. - unsigned SrcSize = Cast->getSrcTy()->getPrimitiveSizeInBits(); - if (SrcSize > DstSize) - return false; - - // Furthermore, ensure that all such extends are of the same kind. - if (FoundOneOperand) { - if (IsSigned != IsSExtInst) - return false; - } else { - FoundOneOperand = true; - IsSigned = IsSExtInst; - } - - // Lastly, if the source type of the extend matches the reduction type, - // add the extend to CI so that we can avoid accounting for it in the - // cost model. - if (SrcSize == DstSize) - CI.insert(Cast); - } + // Add all operands to the work list if they are loop-varying values that + // we haven't yet visited. + for (Value *O : cast(Val)->operands()) + if (auto *I = dyn_cast(O)) + if (TheLoop->contains(I) && !Visited.count(I)) + Worklist.push_back(I); } - return true; } bool RecurrenceDescriptor::AddReductionVar(PHINode *Phi, RecurrenceKind Kind, Loop *TheLoop, bool HasFunNoNaNAttr, - RecurrenceDescriptor &RedDes) { + RecurrenceDescriptor &RedDes, + DemandedBits *DB, + AssumptionCache *AC, + DominatorTree *DT) { if (Phi->getNumIncomingValues() != 2) return false; @@ -353,14 +380,49 @@ bool RecurrenceDescriptor::AddReductionVar(PHINode *Ph if (!FoundStartPHI || !FoundReduxOp || !ExitInstruction) return false; - // If we think Phi may have been type-promoted, we also need to ensure that - // all source operands of the reduction are either SExtInsts or ZEstInsts. If - // so, we will be able to evaluate the reduction in the narrower bit width. - if (Start != Phi) - if (!getSourceExtensionKind(Start, ExitInstruction, RecurrenceType, - IsSigned, VisitedInsts, CastInsts)) + if (Start != Phi) { + // If the starting value is not the same as the phi node, we speculatively + // looked through an 'and' instruction when evaluating a potential + // arithmetic reduction to determine if it may have been type-promoted. + // + // We now compute the minimal bit width that is required to represent the + // reduction. If this is the same width that was indicated by the 'and', we + // can represent the reduction in the smaller type. The 'and' instruction + // will be eliminated since it will essentially be a cast instruction that + // can be ignore in the cost model. If we compute a different type than we + // did when evaluating the 'and', the 'and' will not be eliminated, and we + // will end up with different kinds of operations in the recurrence + // expression (e.g., RK_IntegerAND, RK_IntegerADD). We give up if this is + // the case. + // + // The vectorizer relies on InstCombine to perform the actual + // type-shrinking. It does this by inserting instructions to truncate the + // exit value of the reduction to the width indicated by RecurrenceType and + // then extend this value back to the original width. If IsSigned is false, + // a 'zext' instruction will be generated; otherwise, a 'sext' will be + // used. + // + // TODO: We should not rely on InstCombine to rewrite the reduction in the + // smaller type. We should just generate a correctly typed expression + // to begin with. + Type *ComputedType; + std::tie(ComputedType, IsSigned) = + computeRecurrenceType(ExitInstruction, DB, AC, DT); + if (ComputedType != RecurrenceType) return false; + // The recurrence expression will be represented in a narrower type. If + // there are any cast instructions that will be unnecessary, collect them + // in CastInsts. Note that the 'and' instruction was already included in + // this list. + // + // TODO: A better way to represent this may be to tag in some way all the + // instructions that are a part of the reduction. The vectorizer cost + // model could then apply the recurrence type to these instructions, + // without needing a white list of instructions to ignore. + collectCastsToIgnore(TheLoop, ExitInstruction, RecurrenceType, CastInsts); + } + // We found a reduction var if we have reached the original phi node and we // only have a single instruction with out-of-loop users. @@ -480,47 +542,57 @@ bool RecurrenceDescriptor::hasMultipleUsesOf( return false; } bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop, - RecurrenceDescriptor &RedDes) { + RecurrenceDescriptor &RedDes, + DemandedBits *DB, AssumptionCache *AC, + DominatorTree *DT) { BasicBlock *Header = TheLoop->getHeader(); Function &F = *Header->getParent(); bool HasFunNoNaNAttr = F.getFnAttribute("no-nans-fp-math").getValueAsString() == "true"; - if (AddReductionVar(Phi, RK_IntegerAdd, TheLoop, HasFunNoNaNAttr, RedDes)) { + if (AddReductionVar(Phi, RK_IntegerAdd, TheLoop, HasFunNoNaNAttr, RedDes, DB, + AC, DT)) { DEBUG(dbgs() << "Found an ADD reduction PHI." << *Phi << "\n"); return true; } - if (AddReductionVar(Phi, RK_IntegerMult, TheLoop, HasFunNoNaNAttr, RedDes)) { + if (AddReductionVar(Phi, RK_IntegerMult, TheLoop, HasFunNoNaNAttr, RedDes, DB, + AC, DT)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE9F1F23E9B; Sat, 24 Feb 2018 21:27:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0584477AFA; Sat, 24 Feb 2018 21:27:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57E692B05F; Sat, 24 Feb 2018 21:27:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRagA008919; Sat, 24 Feb 2018 21:27:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRaGt008918; Sat, 24 Feb 2018 21:27:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRaGt008918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329932 - vendor/llvm/llvm-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_60-r325932 X-SVN-Commit-Revision: 329932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:39 -0000 Author: dim Date: Sat Feb 24 21:27:35 2018 New Revision: 329932 URL: https://svnweb.freebsd.org/changeset/base/329932 Log: Tag llvm release_60 branch r325932. Added: vendor/llvm/llvm-release_60-r325932/ - copied from r329931, vendor/llvm/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4472CF23EAD; Sat, 24 Feb 2018 21:27:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED4E677B90; Sat, 24 Feb 2018 21:27:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7FF12B060; Sat, 24 Feb 2018 21:27:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLReCZ008973; Sat, 24 Feb 2018 21:27:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRe0D008966; Sat, 24 Feb 2018 21:27:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRe0D008966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329933 - in vendor/clang/dist-release_60: docs lib/Basic/Targets lib/Sema test/Preprocessor test/SemaCXX X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_60: docs lib/Basic/Targets lib/Sema test/Preprocessor test/SemaCXX X-SVN-Commit-Revision: 329933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:41 -0000 Author: dim Date: Sat Feb 24 21:27:39 2018 New Revision: 329933 URL: https://svnweb.freebsd.org/changeset/base/329933 Log: Vendor import of clang release_60 branch r325932: https://llvm.org/svn/llvm-project/cfe/branches/release_60@325932 Modified: vendor/clang/dist-release_60/docs/ClangCommandLineReference.rst vendor/clang/dist-release_60/docs/DiagnosticsReference.rst vendor/clang/dist-release_60/docs/ReleaseNotes.rst vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp vendor/clang/dist-release_60/lib/Sema/SemaExpr.cpp vendor/clang/dist-release_60/test/Preprocessor/predefined-arch-macros.c vendor/clang/dist-release_60/test/SemaCXX/lambda-expressions.cpp Modified: vendor/clang/dist-release_60/docs/ClangCommandLineReference.rst ============================================================================== --- vendor/clang/dist-release_60/docs/ClangCommandLineReference.rst Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/docs/ClangCommandLineReference.rst Sat Feb 24 21:27:39 2018 (r329933) @@ -706,6 +706,10 @@ Print source range spans in numeric form .. option:: -fdiagnostics-show-category= +.. option:: -fexperimental-isel, -fno-experimental-isel + +Enables the experimental global instruction selector + .. option:: -fexperimental-new-pass-manager, -fno-experimental-new-pass-manager Enables an experimental new pass manager in LLVM. @@ -2413,6 +2417,10 @@ X86 .. option:: -mrdrnd, -mno-rdrnd .. option:: -mrdseed, -mno-rdseed + +.. option:: -mretpoline, -mno-retpoline + +.. option:: -mretpoline-external-thunk, -mno-retpoline-external-thunk .. option:: -mrtm, -mno-rtm Modified: vendor/clang/dist-release_60/docs/DiagnosticsReference.rst ============================================================================== --- vendor/clang/dist-release_60/docs/DiagnosticsReference.rst Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/docs/DiagnosticsReference.rst Sat Feb 24 21:27:39 2018 (r329933) @@ -806,6 +806,17 @@ Also controls `-Wc++98-compat-bind-to-temporary-copy`_ +--------------------------------------------------------------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+ +-Wbinding-in-condition +---------------------- +This diagnostic is enabled by default. + +**Diagnostic text:** + ++--------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`ISO C++17 does not permit structured binding declaration in a condition`| ++--------------------------------------------------------------------------------------------------------------+ + + -Wbitfield-constant-conversion ------------------------------ This diagnostic is enabled by default. @@ -1402,6 +1413,10 @@ Some of the diagnostics controlled by this flag are en **Diagnostic text:** ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`ISO C++ standards before C++17 do not allow new expression for type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`to use list-initialization`| ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +------------------------------------------------------------------------+ |:warning:`warning:` |nbsp| :diagtext:`constexpr if is a C++17 extension`| +------------------------------------------------------------------------+ @@ -1501,8 +1516,14 @@ Synonym for `-Wc++17-extensions`_. -Wc++2a-compat -------------- +Some of the diagnostics controlled by this flag are enabled by default. + **Diagnostic text:** ++------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`'<=>' is a single token in C++2a; add a space to avoid a change in behavior`| ++------------------------------------------------------------------------------------------------------------------+ + +-------------------------------------------------------------------------------------------+ |:warning:`warning:` |nbsp| :diagtext:`'`:placeholder:`A`:diagtext:`' is a keyword in C++2a`| +-------------------------------------------------------------------------------------------+ @@ -1544,7 +1565,11 @@ Some of the diagnostics controlled by this flag are en |:warning:`warning:` |nbsp| :diagtext:`explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++2a`| +-----------------------------------------------------------------------------------------------------------------------------------------------+ ++-----------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`'<=>' operator is incompatible with C++ standards before C++2a`| ++-----------------------------------------------------------------------------------------------------+ + -Wc++98-c++11-c++14-c++17-compat-pedantic ----------------------------------------- Also controls `-Wc++98-c++11-c++14-c++17-compat`_. @@ -3540,6 +3565,21 @@ Some of the diagnostics controlled by this flag are en +-------------------------------------------------------------------------------------------------+ +-Wexperimental-isel +------------------- +This diagnostic is enabled by default. + +**Diagnostic text:** + ++------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`-fexperimental-isel support for the '`:placeholder:`A`:diagtext:`' architecture is incomplete`| ++------------------------------------------------------------------------------------------------------------------------------------+ + ++----------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`-fexperimental-isel support is incomplete for this architecture at the current optimization level`| ++----------------------------------------------------------------------------------------------------------------------------------------+ + + -Wexplicit-initialize-call -------------------------- This diagnostic is enabled by default. @@ -3564,15 +3604,6 @@ This diagnostic is enabled by default. +-------------------------------------------------------------------------------------------------------------------------------------+ --Wextended-offsetof -------------------- -**Diagnostic text:** - -+--------------------------------------------------------------------------------------+ -|:warning:`warning:` |nbsp| :diagtext:`using extended field designator is an extension`| -+--------------------------------------------------------------------------------------+ - - -Wextern-c-compat ----------------- This diagnostic is enabled by default. @@ -4565,96 +4596,34 @@ This diagnostic is enabled by default. | |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables and functions` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions and global variables` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, variables, and Objective-C interfaces` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`functions and methods` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`parameters` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`functions, methods and blocks` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, methods, and classes` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`functions, methods, and parameters` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, methods, and global variables` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`classes` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`enums` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`methods` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`fields and global variables` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`structs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`parameters and typedefs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`variables and typedefs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`thread-local variables` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables and fields` || | |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables, data members and tag types` || | |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`types and namespaces` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`Objective-C interfaces` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`methods and properties` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, methods, and properties` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`struct or union` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`struct, union or class` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`types` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`Objective-C instance methods` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`init methods of interface or class extension declarations` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables, functions and classes` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, variables, classes, and Objective-C interfaces` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`Objective-C protocols` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`variables with static or thread storage duration` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, methods, properties, and global variables` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`structs, unions, and typedefs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`structs and typedefs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`interface or protocol declarations` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`kernel functions` || | |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`non-K&R-style functions` || | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`variables, enums, fields and typedefs` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`functions, methods, enums, and classes` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`structs, classes, variables, functions, and inline namespaces` || -| |+----------------------------------------------------------------------------------------------------------------+| | ||:diagtext:`variables, functions, methods, types, enumerations, enumerators, labels, and non-static data members`|| | |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`classes and enumerations` || -| |+----------------------------------------------------------------------------------------------------------------+| -| ||:diagtext:`named declarations` || -| |+----------------------------------------------------------------------------------------------------------------+| +------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :placeholder:`A` |nbsp| :diagtext:`attribute only applies to` |nbsp| :placeholder:`B`| ++----------------------------------------------------------------------------------------------------------------+ + +--------------------------------------------------------------------------------------------------------------------------------------------------------+ |:warning:`warning:` |nbsp| :diagtext:`attribute` |nbsp| :placeholder:`A` |nbsp| :diagtext:`ignored, because it cannot be applied to omitted return type`| +--------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -6333,6 +6302,17 @@ This diagnostic is enabled by default. +----------------------------------------------------------------------------------------------------------+ +-Wmicrosoft-inaccessible-base +----------------------------- +This diagnostic is enabled by default. + +**Diagnostic text:** + ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`accessing inaccessible direct base` |nbsp| :placeholder:`A` |nbsp| :diagtext:`of` |nbsp| :placeholder:`B` |nbsp| :diagtext:`is a Microsoft extension`| ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + + -Wmicrosoft-include ------------------- This diagnostic is enabled by default. @@ -8075,7 +8055,7 @@ This diagnostic is enabled by default. -Wpedantic ---------- -Also controls `-Wc++11-extra-semi`_, `-Wc++11-long-long`_, `-Wc++14-binary-literal`_, `-Wc11-extensions`_, `-Wcomplex-component-init`_, `-Wdeclaration-after-statement`_, `-Wdollar-in-identifier-extension`_, `-Wembedded-directive`_, `-Wempty-translation-unit`_, `-Wextended-offsetof`_, `-Wflexible-array-extensions`_, `-Wformat-pedantic`_, `-Wfour-char-constants`_, `-Wgnu-anonymous-struct`_, `-Wgnu-auto-type`_, `-Wgnu-binary-literal`_, `-Wgnu-case-range`_, `-Wgnu-complex-integer`_, `-Wgnu-compound-literal-initializer`_, `-Wgnu-conditional-omitted-operand`_, `-Wgnu-empty-initializer`_, `-Wgnu-empty-struct`_, `-Wgnu-flexible-array-initializer`_, `-Wgnu-flexible-array-union-member`_, `-Wgnu-folding-constant`_, `-Wgnu-imaginary-constant`_, `-Wgnu-include-next`_, `-Wgnu-label-as-value`_, `-Wgnu-redeclared-enum`_, `-Wgnu-statement-expression`_, `-Wgnu-union-cast`_, `-Wgnu-zero-line-directive`_, `-Wgnu-zero-variadic-macro-arguments`_, `-Wimport-preprocessor-directive-pedantic`_, `-Wkeyword-ma cro`_, `-Wlanguage-extension-token`_, `-Wlong-long`_, `-Wmicrosoft-charize`_, `-Wmicrosoft-comment-paste`_, `-Wmicrosoft-cpp-macro`_, `-Wmicrosoft-end-of-file`_, `-Wmicrosoft-enum-value`_, `-Wmicrosoft-fixed-enum`_, `-Wmicrosoft-flexible-array`_, `-Wmicrosoft-redeclare-static`_, `-Wnested-anon-types`_, `-Wnullability-extension`_, `-Woverlength-strings`_, `-Wretained-language-linkage`_, `-Wundefined-internal-type`_, `-Wvla-extension`_, `-Wzero-length-array`_. +Also controls `-Wc++11-extra-semi`_, `-Wc++11-long-long`_, `-Wc++14-binary-literal`_, `-Wc11-extensions`_, `-Wcomplex-component-init`_, `-Wdeclaration-after-statement`_, `-Wdollar-in-identifier-extension`_, `-Wembedded-directive`_, `-Wempty-translation-unit`_, `-Wflexible-array-extensions`_, `-Wformat-pedantic`_, `-Wfour-char-constants`_, `-Wgnu-anonymous-struct`_, `-Wgnu-auto-type`_, `-Wgnu-binary-literal`_, `-Wgnu-case-range`_, `-Wgnu-complex-integer`_, `-Wgnu-compound-literal-initializer`_, `-Wgnu-conditional-omitted-operand`_, `-Wgnu-empty-initializer`_, `-Wgnu-empty-struct`_, `-Wgnu-flexible-array-initializer`_, `-Wgnu-flexible-array-union-member`_, `-Wgnu-folding-constant`_, `-Wgnu-imaginary-constant`_, `-Wgnu-include-next`_, `-Wgnu-label-as-value`_, `-Wgnu-redeclared-enum`_, `-Wgnu-statement-expression`_, `-Wgnu-union-cast`_, `-Wgnu-zero-line-directive`_, `-Wgnu-zero-variadic-macro-arguments`_, `-Wimport-preprocessor-directive-pedantic`_, `-Wkeyword-macro`_, `-Wlanguage-exten sion-token`_, `-Wlong-long`_, `-Wmicrosoft-charize`_, `-Wmicrosoft-comment-paste`_, `-Wmicrosoft-cpp-macro`_, `-Wmicrosoft-end-of-file`_, `-Wmicrosoft-enum-value`_, `-Wmicrosoft-fixed-enum`_, `-Wmicrosoft-flexible-array`_, `-Wmicrosoft-redeclare-static`_, `-Wnested-anon-types`_, `-Wnullability-extension`_, `-Woverlength-strings`_, `-Wretained-language-linkage`_, `-Wundefined-internal-type`_, `-Wvla-extension`_, `-Wzero-length-array`_. **Diagnostic text:** @@ -8137,6 +8117,10 @@ Also controls `-Wc++11-extra-semi`_, `-Wc++11-long-lon | |+---------------------------------------+| | +--------------------------------------------------------------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+ ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`ISO C++ standards before C++17 do not allow new expression for type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`to use list-initialization`| ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +--------------------------------------------------------------------------------------------------------------------------------------+ |:warning:`warning:` |nbsp| :diagtext:`parameter` |nbsp| :placeholder:`A` |nbsp| :diagtext:`was not declared, defaulting to type 'int'`| +--------------------------------------------------------------------------------------------------------------------------------------+ @@ -8722,15 +8706,23 @@ This diagnostic is enabled by default. **Diagnostic text:** -+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -|:warning:`warning:` |nbsp| :diagtext:`top-level module '`:placeholder:`A`:diagtext:`' in private module map, expected a submodule of '`:placeholder:`B`:diagtext:`'`| -+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`expected canonical name for private module '`:placeholder:`A`:diagtext:`'`| ++----------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`private submodule '`:placeholder:`A`:diagtext:`' in private module map, expected top-level module`| ++----------------------------------------------------------------------------------------------------------------------------------------+ + +----------------------------------------------------------------------------------------------------------------------------------+ |:warning:`warning:` |nbsp| :diagtext:`module '`:placeholder:`A`:diagtext:`' already re-exported as '`:placeholder:`B`:diagtext:`'`| +----------------------------------------------------------------------------------------------------------------------------------+ ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`no submodule named` |nbsp| :placeholder:`A` |nbsp| :diagtext:`in module '`:placeholder:`B`:diagtext:`'; using top level '`:placeholder:`C`:diagtext:`'`| ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + -Wprofile-instr-missing ----------------------- **Diagnostic text:** @@ -10013,36 +10005,45 @@ Also controls `-Wtautological-constant-compare`_, `-Wt ------------------------------- This diagnostic is enabled by default. -Also controls `-Wtautological-constant-out-of-range-compare`_, `-Wtautological-unsigned-enum-zero-compare`_, `-Wtautological-unsigned-zero-compare`_. +Also controls `-Wtautological-constant-out-of-range-compare`_. **Diagnostic text:** -+---------------------------------------------------------+------------------+--------------------------------+------------------+-------------------------------------+-------------------+ -|:warning:`warning:` |nbsp| :diagtext:`comparison` |nbsp| |+----------------+| |nbsp| :placeholder:`C` |nbsp| |+----------------+| |nbsp| :diagtext:`is always` |nbsp| |+-----------------+| -| ||:placeholder:`D`|| ||:placeholder:`B`|| ||:diagtext:`false`|| -| |+----------------+| |+----------------+| |+-----------------+| -| ||:placeholder:`B`|| ||:placeholder:`D`|| ||:diagtext:`true` || -| |+----------------+| |+----------------+| |+-----------------+| -+---------------------------------------------------------+------------------+--------------------------------+------------------+-------------------------------------+-------------------+ ++----------------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-----------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`result of comparison of` |nbsp| |+----------------------------------------------+| |nbsp| :diagtext:`with` |nbsp| |+--------------------------------------------------------+| |nbsp| :diagtext:`is always` |nbsp| :placeholder:`E`| +| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| | +| |||:diagtext:`constant` |nbsp| :placeholder:`A`||| |||:diagtext:`expression of type` |nbsp| :placeholder:`C`||| | +| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| | +| |+----------------------------------------------+| |+--------------------------------------------------------+| | +| ||:diagtext:`true` || ||:diagtext:`boolean expression` || | +| |+----------------------------------------------+| |+--------------------------------------------------------+| | +| ||:diagtext:`false` || | | | +| |+----------------------------------------------+| | | | ++----------------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-----------------------------------------------------+ +-Wtautological-constant-in-range-compare +---------------------------------------- +Controls `-Wtautological-type-limit-compare`_, `-Wtautological-unsigned-enum-zero-compare`_, `-Wtautological-unsigned-zero-compare`_. + + -Wtautological-constant-out-of-range-compare -------------------------------------------- This diagnostic is enabled by default. **Diagnostic text:** -+------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-------------------------------------+-------------------+ -|:warning:`warning:` |nbsp| :diagtext:`comparison of` |nbsp| |+----------------------------------------------+| |nbsp| :diagtext:`with` |nbsp| |+--------------------------------------------------------+| |nbsp| :diagtext:`is always` |nbsp| |+-----------------+| -| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| ||:diagtext:`false`|| -| |||:diagtext:`constant` |nbsp| :placeholder:`A`||| |||:diagtext:`expression of type` |nbsp| :placeholder:`C`||| |+-----------------+| -| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| ||:diagtext:`true` || -| |+----------------------------------------------+| |+--------------------------------------------------------+| |+-----------------+| -| ||:diagtext:`true` || ||:diagtext:`boolean expression` || | | -| |+----------------------------------------------+| |+--------------------------------------------------------+| | | -| ||:diagtext:`false` || | | | | -| |+----------------------------------------------+| | | | | -+------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-------------------------------------+-------------------+ ++----------------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-----------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`result of comparison of` |nbsp| |+----------------------------------------------+| |nbsp| :diagtext:`with` |nbsp| |+--------------------------------------------------------+| |nbsp| :diagtext:`is always` |nbsp| :placeholder:`E`| +| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| | +| |||:diagtext:`constant` |nbsp| :placeholder:`A`||| |||:diagtext:`expression of type` |nbsp| :placeholder:`C`||| | +| ||+--------------------------------------------+|| ||+------------------------------------------------------+|| | +| |+----------------------------------------------+| |+--------------------------------------------------------+| | +| ||:diagtext:`true` || ||:diagtext:`boolean expression` || | +| |+----------------------------------------------+| |+--------------------------------------------------------+| | +| ||:diagtext:`false` || | | | +| |+----------------------------------------------+| | | | ++----------------------------------------------------------------------+------------------------------------------------+--------------------------------+----------------------------------------------------------+-----------------------------------------------------+ -Wtautological-overlap-compare @@ -10083,6 +10084,19 @@ This diagnostic is enabled by default. +------------------------------------------------------------+------------------------+----------------------------------------------------------+-------------------------+-----------------------------------------------------+-------------------+ +-Wtautological-type-limit-compare +--------------------------------- +**Diagnostic text:** + ++-------------------------------------------------------------------+------------------+--------------------------------+------------------+-----------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`result of comparison` |nbsp| |+----------------+| |nbsp| :placeholder:`C` |nbsp| |+----------------+| |nbsp| :diagtext:`is always` |nbsp| :placeholder:`E`| +| ||:placeholder:`D`|| ||:placeholder:`B`|| | +| |+----------------+| |+----------------+| | +| ||:placeholder:`B`|| ||:placeholder:`D`|| | +| |+----------------+| |+----------------+| | ++-------------------------------------------------------------------+------------------+--------------------------------+------------------+-----------------------------------------------------+ + + -Wtautological-undefined-compare -------------------------------- This diagnostic is enabled by default. @@ -10108,32 +10122,28 @@ This diagnostic is enabled by default. -Wtautological-unsigned-enum-zero-compare ----------------------------------------- -This diagnostic is enabled by default. - **Diagnostic text:** -+------------------------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+-------------------------------------+-------------------+ -|:warning:`warning:` |nbsp| :diagtext:`comparison of` |nbsp| |+------------------------------------+| |nbsp| :placeholder:`C` |nbsp| |+------------------------------------+| |nbsp| :diagtext:`is always` |nbsp| |+-----------------+| -| ||:placeholder:`D` || ||:diagtext:`unsigned enum expression`|| ||:diagtext:`false`|| -| |+------------------------------------+| |+------------------------------------+| |+-----------------+| -| ||:diagtext:`unsigned enum expression`|| ||:placeholder:`D` || ||:diagtext:`true` || -| |+------------------------------------+| |+------------------------------------+| |+-----------------+| -+------------------------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+-------------------------------------+-------------------+ ++----------------------------------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+-----------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`result of comparison of` |nbsp| |+------------------------------------+| |nbsp| :placeholder:`C` |nbsp| |+------------------------------------+| |nbsp| :diagtext:`is always` |nbsp| :placeholder:`E`| +| ||:placeholder:`D` || ||:diagtext:`unsigned enum expression`|| | +| |+------------------------------------+| |+------------------------------------+| | +| ||:diagtext:`unsigned enum expression`|| ||:placeholder:`D` || | +| |+------------------------------------+| |+------------------------------------+| | ++----------------------------------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+-----------------------------------------------------+ -Wtautological-unsigned-zero-compare ------------------------------------ -This diagnostic is enabled by default. - **Diagnostic text:** -+------------------------------------------------------------+---------------------------------+--------------------------------+---------------------------------+-------------------------------------+-------------------+ -|:warning:`warning:` |nbsp| :diagtext:`comparison of` |nbsp| |+-------------------------------+| |nbsp| :placeholder:`C` |nbsp| |+-------------------------------+| |nbsp| :diagtext:`is always` |nbsp| |+-----------------+| -| ||:placeholder:`D` || ||:diagtext:`unsigned expression`|| ||:diagtext:`false`|| -| |+-------------------------------+| |+-------------------------------+| |+-----------------+| -| ||:diagtext:`unsigned expression`|| ||:placeholder:`D` || ||:diagtext:`true` || -| |+-------------------------------+| |+-------------------------------+| |+-----------------+| -+------------------------------------------------------------+---------------------------------+--------------------------------+---------------------------------+-------------------------------------+-------------------+ ++----------------------------------------------------------------------+---------------------------------+--------------------------------+---------------------------------+-----------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`result of comparison of` |nbsp| |+-------------------------------+| |nbsp| :placeholder:`C` |nbsp| |+-------------------------------+| |nbsp| :diagtext:`is always` |nbsp| :placeholder:`E`| +| ||:placeholder:`D` || ||:diagtext:`unsigned expression`|| | +| |+-------------------------------+| |+-------------------------------+| | +| ||:diagtext:`unsigned expression`|| ||:placeholder:`D` || | +| |+-------------------------------+| |+-------------------------------+| | ++----------------------------------------------------------------------+---------------------------------+--------------------------------+---------------------------------+-----------------------------------------------------+ -Wtentative-definition-incomplete-type @@ -10652,6 +10662,17 @@ This diagnostic is enabled by default. +---------------------------------------------------------------------------------------------+ +-Wunicode-homoglyph +------------------- +This diagnostic is enabled by default. + +**Diagnostic text:** + ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|:warning:`warning:` |nbsp| :diagtext:`treating Unicode character as identifier character rather than as '`:placeholder:`B`:diagtext:`' symbol`| ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + + -Wunicode-whitespace -------------------- This diagnostic is enabled by default. @@ -11134,19 +11155,17 @@ This diagnostic is enabled by default. **Diagnostic text:** -+---------------------------+-----------------------------------------+--------------------------------------------+ -|:warning:`warning:` |nbsp| |+---------------------------------------+| |nbsp| :diagtext:`comparison result unused`| -| ||+----------------+--------------------+|| | -| |||+--------------+|:diagtext:`equality`||| | -| |||| || ||| | -| |||+--------------+| ||| | -| ||||:diagtext:`in`|| ||| | -| |||+--------------+| ||| | -| ||+----------------+--------------------+|| | -| |+---------------------------------------+| | -| ||:diagtext:`relational` || | -| |+---------------------------------------+| | -+---------------------------+-----------------------------------------+--------------------------------------------+ ++---------------------------+------------------------+--------------------------------------------+ +|:warning:`warning:` |nbsp| |+----------------------+| |nbsp| :diagtext:`comparison result unused`| +| ||:diagtext:`equality` || | +| |+----------------------+| | +| ||:diagtext:`inequality`|| | +| |+----------------------+| | +| ||:diagtext:`relational`|| | +| |+----------------------+| | +| ||:diagtext:`three-way` || | +| |+----------------------+| | ++---------------------------+------------------------+--------------------------------------------+ -Wunused-const-variable Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:27:39 2018 (r329933) @@ -1,6 +1,6 @@ -======================================= -Clang 6.0.0 (In-Progress) Release Notes -======================================= +========================= +Clang 6.0.0 Release Notes +========================= .. contents:: :local: @@ -8,12 +8,6 @@ Clang 6.0.0 (In-Progress) Release Notes Written by the `LLVM Team `_ -.. warning:: - - These are in-progress notes for the upcoming Clang 6 release. - Release notes for previous releases can be found on - `the Download Page `_. - Introduction ============ @@ -30,11 +24,6 @@ For more information about Clang or LLVM, including in latest release, please see the `Clang Web Site `_ or the `LLVM Web Site `_. -Note that if you are reading this file from a Subversion checkout or the -main Clang web page, this document applies to the *next* release, not -the current one. To see the release notes for a specific release, please -see the `releases page `_. - What's New in Clang 6.0.0? ========================== @@ -95,6 +84,12 @@ Improvements to Clang's diagnostics - ``-Wzero-as-null-pointer-constant`` was adjusted not to warn on null pointer constants that originate from system macros, except ``NULL`` macro. +- ``-Wdelete-non-virtual-dtor`` can now fire in system headers, so that + ``std::unique_ptr<>`` deleting through a non-virtual dtor is now diagnosed. + +- ``-Wunreachable-code`` can now reason about ``__try``, ``__except`` and + ``__leave``. + Non-comprehensive list of changes in this release ------------------------------------------------- @@ -137,6 +132,9 @@ New Compiler Flags feature is enabled by default for AArch64 at the ``-O0`` optimization level. Support for other targets or optimization levels is currently incomplete. +- New ``-nostdlib++`` flag to disable linking the C++ standard library. Similar + to using ``clang`` instead of ``clang++`` but doesn't disable ``-lm``. + Deprecated Compiler Flags ------------------------- @@ -184,6 +182,8 @@ Windows Support - Clang now has initial, preliminary support for targeting Windows on ARM64. + +- clang-cl now exposes the ``--version`` flag. C Language Changes in Clang --------------------------- Modified: vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/lib/Basic/Targets/X86.cpp Sat Feb 24 21:27:39 2018 (r329933) @@ -152,7 +152,8 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "avx512bw", true); setFeatureEnabledImpl(Features, "avx512vl", true); setFeatureEnabledImpl(Features, "pku", true); - setFeatureEnabledImpl(Features, "clwb", true); + if (Kind != CK_Cannonlake) // CNL inherits all SKX features, except CLWB + setFeatureEnabledImpl(Features, "clwb", true); LLVM_FALLTHROUGH; case CK_SkylakeClient: setFeatureEnabledImpl(Features, "xsavec", true); Modified: vendor/clang/dist-release_60/lib/Sema/SemaExpr.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Sema/SemaExpr.cpp Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/lib/Sema/SemaExpr.cpp Sat Feb 24 21:27:39 2018 (r329933) @@ -14926,7 +14926,8 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, Sou if (RefersToEnclosingScope) { LambdaScopeInfo *const LSI = SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope=*/true); - if (LSI && !LSI->CallOperator->Encloses(Var->getDeclContext())) { + if (LSI && (!LSI->CallOperator || + !LSI->CallOperator->Encloses(Var->getDeclContext()))) { // If a variable could potentially be odr-used, defer marking it so // until we finish analyzing the full expression for any // lvalue-to-rvalue Modified: vendor/clang/dist-release_60/test/Preprocessor/predefined-arch-macros.c ============================================================================== --- vendor/clang/dist-release_60/test/Preprocessor/predefined-arch-macros.c Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/test/Preprocessor/predefined-arch-macros.c Sat Feb 24 21:27:39 2018 (r329933) @@ -972,7 +972,7 @@ // CHECK_CNL_M32: #define __BMI2__ 1 // CHECK_CNL_M32: #define __BMI__ 1 // CHECK_CNL_M32: #define __CLFLUSHOPT__ 1 -// CHECK_CNL_M32: #define __CLWB__ 1 +// CHECK_CNL_M32-NOT: #define __CLWB__ 1 // CHECK_CNL_M32: #define __F16C__ 1 // CHECK_CNL_M32: #define __FMA__ 1 // CHECK_CNL_M32: #define __LZCNT__ 1 @@ -1019,7 +1019,7 @@ // CHECK_CNL_M64: #define __BMI2__ 1 // CHECK_CNL_M64: #define __BMI__ 1 // CHECK_CNL_M64: #define __CLFLUSHOPT__ 1 -// CHECK_CNL_M64: #define __CLWB__ 1 +// CHECK_CNL_M64-NOT: #define __CLWB__ 1 // CHECK_CNL_M64: #define __F16C__ 1 // CHECK_CNL_M64: #define __FMA__ 1 // CHECK_CNL_M64: #define __LZCNT__ 1 Modified: vendor/clang/dist-release_60/test/SemaCXX/lambda-expressions.cpp ============================================================================== --- vendor/clang/dist-release_60/test/SemaCXX/lambda-expressions.cpp Sat Feb 24 21:27:35 2018 (r329932) +++ vendor/clang/dist-release_60/test/SemaCXX/lambda-expressions.cpp Sat Feb 24 21:27:39 2018 (r329933) @@ -608,3 +608,18 @@ namespace ConversionOperatorDoesNotHaveDeducedReturnTy // This used to crash in return type deduction for the conversion opreator. struct A { int n; void f() { +[](decltype(n)) {}; } }; } + +namespace TypoCorrection { +template struct X {}; +// expected-note@-1 {{template parameter is declared here}} + +template +void Run(const int& points) { +// expected-note@-1 {{'points' declared here}} + auto outer_lambda = []() { + auto inner_lambda = [](const X&) {}; + // expected-error@-1 {{use of undeclared identifier 'Points'; did you mean 'points'?}} + // expected-error@-2 {{template argument for template type parameter must be a type}} + }; +} +} From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C392F23EFD; Sat, 24 Feb 2018 21:27:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95C9B77C81; Sat, 24 Feb 2018 21:27:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB80C2B061; Sat, 24 Feb 2018 21:27:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRjjg009021; Sat, 24 Feb 2018 21:27:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRjt2009020; Sat, 24 Feb 2018 21:27:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRjt2009020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329934 - vendor/clang/clang-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_60-r325932 X-SVN-Commit-Revision: 329934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:47 -0000 Author: dim Date: Sat Feb 24 21:27:45 2018 New Revision: 329934 URL: https://svnweb.freebsd.org/changeset/base/329934 Log: Tag clang release_60 branch r325932. Added: vendor/clang/clang-release_60-r325932/ - copied from r329933, vendor/clang/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74415F23F62; Sat, 24 Feb 2018 21:27:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C53DB77D1B; Sat, 24 Feb 2018 21:27:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 801FC2B062; Sat, 24 Feb 2018 21:27:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRm3U009068; Sat, 24 Feb 2018 21:27:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRm5F009067; Sat, 24 Feb 2018 21:27:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRm5F009067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329935 - vendor/compiler-rt/compiler-rt-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_60-r325932 X-SVN-Commit-Revision: 329935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:51 -0000 Author: dim Date: Sat Feb 24 21:27:48 2018 New Revision: 329935 URL: https://svnweb.freebsd.org/changeset/base/329935 Log: Tag compiler-rt release_60 branch r325932. Added: vendor/compiler-rt/compiler-rt-release_60-r325932/ - copied from r329934, vendor/compiler-rt/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B240F23FB7; Sat, 24 Feb 2018 21:27:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0540A77DF2; Sat, 24 Feb 2018 21:27:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E56F52B063; Sat, 24 Feb 2018 21:27:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRqmN009116; Sat, 24 Feb 2018 21:27:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRqjJ009115; Sat, 24 Feb 2018 21:27:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRqjJ009115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329936 - vendor/libc++/libc++-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_60-r325932 X-SVN-Commit-Revision: 329936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:56 -0000 Author: dim Date: Sat Feb 24 21:27:52 2018 New Revision: 329936 URL: https://svnweb.freebsd.org/changeset/base/329936 Log: Tag libc++ release_60 branch r325932. Added: vendor/libc++/libc++-release_60-r325932/ - copied from r329935, vendor/libc++/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:27:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6C3BF23FB8; Sat, 24 Feb 2018 21:27:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBBFC77E22; Sat, 24 Feb 2018 21:27:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A172F2B064; Sat, 24 Feb 2018 21:27:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRteY009167; Sat, 24 Feb 2018 21:27:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRtXQ009162; Sat, 24 Feb 2018 21:27:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRtXQ009162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329937 - in vendor/lld/dist-release_60: ELF docs test/ELF X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_60: ELF docs test/ELF X-SVN-Commit-Revision: 329937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:27:57 -0000 Author: dim Date: Sat Feb 24 21:27:54 2018 New Revision: 329937 URL: https://svnweb.freebsd.org/changeset/base/329937 Log: Vendor import of lld release_60 branch r325932: https://llvm.org/svn/llvm-project/lld/branches/release_60@325932 Added: vendor/lld/dist-release_60/test/ELF/relocatable-versioned.s (contents, props changed) Modified: vendor/lld/dist-release_60/ELF/Driver.cpp vendor/lld/dist-release_60/ELF/Options.td vendor/lld/dist-release_60/docs/ReleaseNotes.rst vendor/lld/dist-release_60/test/ELF/pie.s Modified: vendor/lld/dist-release_60/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Driver.cpp Sat Feb 24 21:27:52 2018 (r329936) +++ vendor/lld/dist-release_60/ELF/Driver.cpp Sat Feb 24 21:27:54 2018 (r329937) @@ -638,7 +638,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args Config->Optimize = args::getInteger(Args, OPT_O, 1); Config->OrphanHandling = getOrphanHandling(Args); Config->OutputFile = Args.getLastArgValue(OPT_o); - Config->Pie = Args.hasFlag(OPT_pie, OPT_no_pie, false); + Config->Pie = Args.hasFlag(OPT_pie, OPT_nopie, false); Config->PrintGcSections = Args.hasFlag(OPT_print_gc_sections, OPT_no_print_gc_sections, false); Config->Rpath = getRpath(Args); @@ -1061,7 +1061,12 @@ template void LinkerDriver::link(opt::Inp addReservedSymbols(); // Apply version scripts. - Symtab->scanVersionScript(); + // + // For a relocatable output, version scripts don't make sense, and + // parsing a symbol version string (e.g. dropping "@ver1" from a symbol + // name "foo@ver1") rather do harm, so we don't call this if -r is given. + if (!Config->Relocatable) + Symtab->scanVersionScript(); // Create wrapped symbols for -wrap option. for (auto *Arg : Args.filtered(OPT_wrap)) Modified: vendor/lld/dist-release_60/ELF/Options.td ============================================================================== --- vendor/lld/dist-release_60/ELF/Options.td Sat Feb 24 21:27:52 2018 (r329936) +++ vendor/lld/dist-release_60/ELF/Options.td Sat Feb 24 21:27:54 2018 (r329937) @@ -202,8 +202,6 @@ def no_gnu_unique: F<"no-gnu-unique">, def no_merge_exidx_entries: F<"no-merge-exidx-entries">, HelpText<"Disable merging .ARM.exidx entries">; -def no_pie: F<"no-pie">, HelpText<"Do not create a position independent executable">; - def no_threads: F<"no-threads">, HelpText<"Do not run the linker multi-threaded">; @@ -212,6 +210,8 @@ def no_whole_archive: F<"no-whole-archive">, def noinhibit_exec: F<"noinhibit-exec">, HelpText<"Retain the executable output file whenever it is still usable">; + +def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">; def no_omagic: Flag<["--"], "no-omagic">, MetaVarName<"">, HelpText<"Do not set the text data sections to be writable">; Modified: vendor/lld/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/lld/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:27:52 2018 (r329936) +++ vendor/lld/dist-release_60/docs/ReleaseNotes.rst Sat Feb 24 21:27:54 2018 (r329937) @@ -5,17 +5,12 @@ LLD 6.0.0 Release Notes .. contents:: :local: -.. warning:: - These are in-progress notes for the upcoming LLVM 6.0.0 release. - Release notes for previous releases can be found on - `the Download Page `_. - Introduction ============ -This document contains the release notes for the LLD linker, release 6.0.0. -Here we describe the status of LLD, including major improvements -from the previous release. All LLD releases may be downloaded +This document contains the release notes for the lld linker, release 6.0.0. +Here we describe the status of lld, including major improvements +from the previous release. All lld releases may be downloaded from the `LLVM releases web site `_. Non-comprehensive list of changes in this release @@ -24,20 +19,81 @@ Non-comprehensive list of changes in this release ELF Improvements ---------------- -* Item 1. +* A lot of bugs and compatibility issues have been identified and fixed as a + result of people using lld 5.0 as a standard system linker. In particular, + linker script and version script support has significantly improved that + it should be able to handle almost all scripts. +* A mitigation for Spectre v2 has been implemented. If you pass ``-z + retpolineplt``, lld uses RET instruction instead of JMP instruction in PLT. + The option is available for x86 and x86-64. + +* Identical Code Folding (ICF) now de-duplicates .eh_frame entries, so lld now + generates slightly smaller outputs than before when you pass ``--icf=all``. + +* Analysis for ``--as-needed`` is now done after garbage collection. If garbage + collector eliminates all sections that use some library, that library is + eliminated from DT_NEEDED tags. Previously, the analysis ran before garbage + collection. + +* Size of code segment is now always rounded up to page size to make sure that + unused bytes at end of code segment is filled with trap instructions (such + as INT3) instead of zeros. + +* lld is now able to generate Android-style compact dynamic relocation table. + You can turn on the feature by passing ``--pack-dyn-relocs=android``. + +* Debug information is used in more cases when reporting errors. + +* ``--gdb-index`` gets faster than before. + +* String merging is now multi-threaded, which makes ``-O2`` faster. + +* ``--hash-style=both`` is now default instead of ``--hash-style=sysv`` to + match the behavior of recent versions of GNU linkers. + +* ARM PLT entries automatically use short or long variants. + +* lld can now identify and patch a code sequence that triggers AArch64 errata 843419. + Add ``--fix-cortex-a53-843419`` to enable the feature. + +* lld can now generate thunks for out of range thunks. + +* MIPS port now generates all output dynamic relocations using Elf_Rel format only. + +* Added handling of the R_MIPS_26 relocation in case of N32/N64 ABIs and + generating proper PLT entries. + +* The following options have been added: ``--icf=none`` ``-z muldefs`` + ``--plugin-opt`` ``--no-eh-frame-hdr`` ``--no-gdb-index`` + ``--orphan-handling={place,discard,warn,error}`` + ``--pack-dyn-relocs={none,android}`` ``--no-omagic`` + ``--no-print-gc-sections`` ``--ignore-function-address-equality`` ``-z + retpolineplt`` ``--print-icf-sections`` ``--no-pie`` + COFF Improvements ----------------- * A GNU ld style frontend for the COFF linker has been added for MinGW. In MinGW environments, the linker is invoked with GNU ld style parameters; - which LLD previously only supported when used as an ELF linker. When + which lld previously only supported when used as an ELF linker. When a PE/COFF target is chosen, those parameters are rewritten into the lld-link style parameters and the COFF linker is invoked instead. * Initial support for the ARM64 architecture has been added. -MachO Improvements ------------------- +* New ``--version`` flag. -* Item 1. +* Significantly improved support for writing PDB Files. + +* New ``--rsp-quoting`` flag, like ``clang-cl``. + +* ``/manifestuac:no`` no longer incorrectly disables ``/manifestdependency:``. + +* Only write ``.manifest`` files if ``/manifest`` is passed. + +WebAssembly Improvements +------------------------ + +* Initial version of WebAssembly support has landed. You can invoke the + WebAssembly linker by ``wasm-ld``. Modified: vendor/lld/dist-release_60/test/ELF/pie.s ============================================================================== --- vendor/lld/dist-release_60/test/ELF/pie.s Sat Feb 24 21:27:52 2018 (r329936) +++ vendor/lld/dist-release_60/test/ELF/pie.s Sat Feb 24 21:27:54 2018 (r329937) @@ -48,7 +48,7 @@ # CHECK: Type: PT_DYNAMIC ## Check -nopie -# RUN: ld.lld -no-pie %t1.o -o %t2 +# RUN: ld.lld -nopie %t1.o -o %t2 # RUN: llvm-readobj -file-headers -r %t2 | FileCheck %s --check-prefix=NOPIE # NOPIE-NOT: Type: SharedObject Added: vendor/lld/dist-release_60/test/ELF/relocatable-versioned.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/relocatable-versioned.s Sat Feb 24 21:27:54 2018 (r329937) @@ -0,0 +1,9 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o +# RUN: ld.lld -o %t2.o -r %t1.o +# RUN: llvm-nm %t2.o | FileCheck %s +# CHECK: foo@VERSION + +.global "foo@VERSION" +"foo@VERSION": + ret From owner-svn-src-all@freebsd.org Sat Feb 24 21:28:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 118B0F24015; Sat, 24 Feb 2018 21:28:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B365C77F0E; Sat, 24 Feb 2018 21:28:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D9132B065; Sat, 24 Feb 2018 21:28:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLRxJQ009216; Sat, 24 Feb 2018 21:27:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLRx5B009215; Sat, 24 Feb 2018 21:27:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242127.w1OLRx5B009215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329938 - vendor/lld/lld-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_60-r325932 X-SVN-Commit-Revision: 329938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:28:08 -0000 Author: dim Date: Sat Feb 24 21:27:59 2018 New Revision: 329938 URL: https://svnweb.freebsd.org/changeset/base/329938 Log: Tag lld release_60 branch r325932. Added: vendor/lld/lld-release_60-r325932/ - copied from r329937, vendor/lld/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:28:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E771F24018; Sat, 24 Feb 2018 21:28:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68E6677F62; Sat, 24 Feb 2018 21:28:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F07472B068; Sat, 24 Feb 2018 21:28:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLS2RN009271; Sat, 24 Feb 2018 21:28:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLS2QO009266; Sat, 24 Feb 2018 21:28:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242128.w1OLS2QO009266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329939 - vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests X-SVN-Commit-Revision: 329939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:28:08 -0000 Author: dim Date: Sat Feb 24 21:28:02 2018 New Revision: 329939 URL: https://svnweb.freebsd.org/changeset/base/329939 Log: Vendor import of lldb release_60 branch r325932: https://llvm.org/svn/llvm-project/lldb/branches/release_60@325932 Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.cpp vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.h vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.cpp vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.h vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.cpp ============================================================================== --- vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.cpp Sat Feb 24 21:27:59 2018 (r329938) +++ vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.cpp Sat Feb 24 21:28:02 2018 (r329939) @@ -8,16 +8,17 @@ //===----------------------------------------------------------------------===// #include "MessageObjects.h" -#include "lldb/Utility/StructuredData.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/StringExtractor.h" #include "llvm/ADT/StringExtras.h" #include "gtest/gtest.h" using namespace lldb_private; +using namespace lldb; using namespace llvm; -using namespace llvm::support; namespace llgs_tests { -Expected ProcessInfo::Create(StringRef response) { +Expected ProcessInfo::create(StringRef response) { ProcessInfo process_info; auto elements_or_error = SplitUniquePairList("ProcessInfo", response); if (!elements_or_error) @@ -53,36 +54,50 @@ Expected ProcessInfo::Create(StringRef re lldb::pid_t ProcessInfo::GetPid() const { return m_pid; } -endianness ProcessInfo::GetEndian() const { return m_endian; } +support::endianness ProcessInfo::GetEndian() const { return m_endian; } //====== ThreadInfo ============================================================ -ThreadInfo::ThreadInfo(StringRef name, StringRef reason, - const RegisterMap ®isters, unsigned int signal) - : m_name(name.str()), m_reason(reason.str()), m_registers(registers), - m_signal(signal) {} +ThreadInfo::ThreadInfo(StringRef name, StringRef reason, RegisterMap registers, + unsigned int signal) + : m_name(name.str()), m_reason(reason.str()), + m_registers(std::move(registers)), m_signal(signal) {} -StringRef ThreadInfo::ReadRegister(unsigned int register_id) const { - return m_registers.lookup(register_id); +const RegisterValue *ThreadInfo::ReadRegister(unsigned int Id) const { + auto Iter = m_registers.find(Id); + return Iter == m_registers.end() ? nullptr : &Iter->getSecond(); } -Expected -ThreadInfo::ReadRegisterAsUint64(unsigned int register_id) const { - uint64_t value; - std::string value_str(m_registers.lookup(register_id)); - if (!llvm::to_integer(value_str, value, 16)) - return make_parsing_error("ThreadInfo value for register {0}: {1}", - register_id, value_str); +//====== JThreadsInfo ========================================================== - sys::swapByteOrder(value); - return value; +Expected +JThreadsInfo::parseRegisters(const StructuredData::Dictionary &Dict, + ArrayRef RegInfos) { + RegisterMap Result; + + auto KeysObj = Dict.GetKeys(); + auto Keys = KeysObj->GetAsArray(); + for (size_t i = 0; i < Keys->GetSize(); i++) { + StringRef KeyStr, ValueStr; + Keys->GetItemAtIndexAsString(i, KeyStr); + Dict.GetValueForKeyAsString(KeyStr, ValueStr); + unsigned int Register; + if (!llvm::to_integer(KeyStr, Register, 10)) + return make_parsing_error("JThreadsInfo: register key[{0}]", i); + + auto RegValOr = + parseRegisterValue(RegInfos[Register], ValueStr, support::big); + if (!RegValOr) + return RegValOr.takeError(); + Result[Register] = std::move(*RegValOr); + } + return std::move(Result); } -//====== JThreadsInfo ========================================================== -Expected JThreadsInfo::Create(StringRef response, - endianness endian) { +Expected JThreadsInfo::create(StringRef Response, + ArrayRef RegInfos) { JThreadsInfo jthreads_info; - StructuredData::ObjectSP json = StructuredData::ParseJSON(response); + StructuredData::ObjectSP json = StructuredData::ParseJSON(Response); StructuredData::Array *array = json->GetAsArray(); if (!array) return make_parsing_error("JThreadsInfo: JSON array"); @@ -106,23 +121,11 @@ Expected JThreadsInfo::Create(StringRef if (!register_dict) return make_parsing_error("JThreadsInfo: registers JSON obj"); - RegisterMap registers; - - auto keys_obj = register_dict->GetKeys(); - auto keys = keys_obj->GetAsArray(); - for (size_t i = 0; i < keys->GetSize(); i++) { - StringRef key_str, value_str; - keys->GetItemAtIndexAsString(i, key_str); - register_dict->GetValueForKeyAsString(key_str, value_str); - unsigned int register_id; - if (key_str.getAsInteger(10, register_id)) - return make_parsing_error("JThreadsInfo: register key[{0}]", i); - - registers[register_id] = value_str.str(); - } - + auto RegsOr = parseRegisters(*register_dict, RegInfos); + if (!RegsOr) + return RegsOr.takeError(); jthreads_info.m_thread_infos[tid] = - ThreadInfo(name, reason, registers, signal); + ThreadInfo(name, reason, std::move(*RegsOr), signal); } return jthreads_info; @@ -132,20 +135,130 @@ const ThreadInfoMap &JThreadsInfo::GetThreadInfos() co return m_thread_infos; } +Expected RegisterInfoParser::create(StringRef Response) { + auto ElementsOr = SplitUniquePairList("RegisterInfoParser", Response); + if (!ElementsOr) + return ElementsOr.takeError(); + auto &Elements = *ElementsOr; + + RegisterInfo Info = { + nullptr, // Name + nullptr, // Alt name + 0, // byte size + 0, // offset + eEncodingUint, // encoding + eFormatHex, // format + { + LLDB_INVALID_REGNUM, // eh_frame reg num + LLDB_INVALID_REGNUM, // DWARF reg num + LLDB_INVALID_REGNUM, // generic reg num + LLDB_INVALID_REGNUM, // process plugin reg num + LLDB_INVALID_REGNUM // native register number + }, + NULL, + NULL, + NULL, // Dwarf expression opcode bytes pointer + 0 // Dwarf expression opcode bytes length + }; + Info.name = ConstString(Elements["name"]).GetCString(); + if (!Info.name) + return make_parsing_error("qRegisterInfo: name"); + + Info.alt_name = ConstString(Elements["alt-name"]).GetCString(); + + if (!to_integer(Elements["bitsize"], Info.byte_size, 10)) + return make_parsing_error("qRegisterInfo: bit-size"); + Info.byte_size /= CHAR_BIT; + + if (!to_integer(Elements["offset"], Info.byte_offset, 10)) + return make_parsing_error("qRegisterInfo: offset"); + + Info.encoding = Args::StringToEncoding(Elements["encoding"]); + if (Info.encoding == eEncodingInvalid) + return make_parsing_error("qRegisterInfo: encoding"); + + Info.format = StringSwitch(Elements["format"]) + .Case("binary", eFormatBinary) + .Case("decimal", eFormatDecimal) + .Case("hex", eFormatHex) + .Case("float", eFormatFloat) + .Case("vector-sint8", eFormatVectorOfSInt8) + .Case("vector-uint8", eFormatVectorOfUInt8) + .Case("vector-sint16", eFormatVectorOfSInt16) + .Case("vector-uint16", eFormatVectorOfUInt16) + .Case("vector-sint32", eFormatVectorOfSInt32) + .Case("vector-uint32", eFormatVectorOfUInt32) + .Case("vector-float32", eFormatVectorOfFloat32) + .Case("vector-uint64", eFormatVectorOfUInt64) + .Case("vector-uint128", eFormatVectorOfUInt128) + .Default(eFormatInvalid); + if (Info.format == eFormatInvalid) + return make_parsing_error("qRegisterInfo: format"); + + Info.kinds[eRegisterKindGeneric] = + Args::StringToGenericRegister(Elements["generic"]); + + return std::move(Info); +} + +Expected parseRegisterValue(const RegisterInfo &Info, + StringRef HexValue, + llvm::support::endianness Endian) { + SmallVector Bytes(HexValue.size() / 2); + StringExtractor(HexValue).GetHexBytes(Bytes, '\xcc'); + RegisterValue Value; + Status ST; + Value.SetFromMemoryData( + &Info, Bytes.data(), Bytes.size(), + Endian == support::little ? eByteOrderLittle : eByteOrderBig, ST); + if (ST.Fail()) + return ST.ToError(); + return Value; +} + //====== StopReply ============================================================= Expected> -StopReply::create(StringRef Response, llvm::support::endianness Endian) { +StopReply::create(StringRef Response, llvm::support::endianness Endian, + ArrayRef RegInfos) { if (Response.size() < 3) return make_parsing_error("StopReply: Invalid packet"); if (Response.consume_front("T")) - return StopReplyStop::create(Response, Endian); + return StopReplyStop::create(Response, Endian, RegInfos); if (Response.consume_front("W")) return StopReplyExit::create(Response); return make_parsing_error("StopReply: Invalid packet"); } +Expected StopReplyStop::parseRegisters( + const StringMap> &Elements, + support::endianness Endian, ArrayRef RegInfos) { + + RegisterMap Result; + for (const auto &E : Elements) { + StringRef Key = E.getKey(); + const auto &Val = E.getValue(); + if (Key.size() != 2) + continue; + + unsigned int Reg; + if (!to_integer(Key, Reg, 16)) + continue; + + if (Val.size() != 1) + return make_parsing_error( + "StopReplyStop: multiple entries for register field [{0:x}]", Reg); + + auto RegValOr = parseRegisterValue(RegInfos[Reg], Val[0], Endian); + if (!RegValOr) + return RegValOr.takeError(); + Result[Reg] = std::move(*RegValOr); + } + return std::move(Result); +} + Expected> -StopReplyStop::create(StringRef Response, llvm::support::endianness Endian) { +StopReplyStop::create(StringRef Response, support::endianness Endian, + ArrayRef RegInfos) { unsigned int Signal; StringRef SignalStr = Response.take_front(2); Response = Response.drop_front(2); @@ -176,40 +289,31 @@ StopReplyStop::create(StringRef Response, llvm::suppor if (Threads.size() != Pcs.size()) return make_parsing_error("StopReply: thread/PC count mismatch"); - U64Map ThreadPcs; + RegisterMap ThreadPcs; + const RegisterInfo *PcInfo = find_if(RegInfos, [](const RegisterInfo &Info) { + return Info.kinds[eRegisterKindGeneric] == LLDB_REGNUM_GENERIC_PC; + }); + assert(PcInfo); + for (auto ThreadPc : zip(Threads, Pcs)) { lldb::tid_t Id; - uint64_t Pc; if (!to_integer(std::get<0>(ThreadPc), Id, 16)) return make_parsing_error("StopReply: Thread id '{0}'", std::get<0>(ThreadPc)); - if (!to_integer(std::get<1>(ThreadPc), Pc, 16)) - return make_parsing_error("StopReply Thread Pc '{0}'", - std::get<1>(ThreadPc)); - ThreadPcs[Id] = Pc; + auto PcOr = parseRegisterValue(*PcInfo, std::get<1>(ThreadPc), Endian); + if (!PcOr) + return PcOr.takeError(); + ThreadPcs[Id] = std::move(*PcOr); } - RegisterMap Registers; - for (const auto &E : Elements) { - StringRef Key = E.getKey(); - const auto &Val = E.getValue(); - if (Key.size() != 2) - continue; + auto RegistersOr = parseRegisters(Elements, Endian, RegInfos); + if (!RegistersOr) + return RegistersOr.takeError(); - unsigned int Reg; - if (!to_integer(Key, Reg, 16)) - continue; - - if (Val.size() != 1) - return make_parsing_error( - "StopReply: multiple entries for register field [{0:x}]", Reg); - - Registers[Reg] = Val[0].str(); - } - - return llvm::make_unique(Signal, Thread, Name, ThreadPcs, - Registers, Reason); + return llvm::make_unique(Signal, Thread, Name, + std::move(ThreadPcs), + std::move(*RegistersOr), Reason); } Expected> @@ -251,3 +355,12 @@ StringMap> SplitPairList(Str return pairs; } } // namespace llgs_tests + +std::ostream &lldb_private::operator<<(std::ostream &OS, + const RegisterValue &RegVal) { + ArrayRef Bytes(static_cast(RegVal.GetBytes()), + RegVal.GetByteSize()); + return OS << formatv("RegisterValue[{0}]: {1:@[x-2]}", RegVal.GetByteSize(), + make_range(Bytes.begin(), Bytes.end())) + .str(); +} Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.h ============================================================================== --- vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.h Sat Feb 24 21:27:59 2018 (r329938) +++ vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/MessageObjects.h Sat Feb 24 21:28:02 2018 (r329939) @@ -10,7 +10,9 @@ #ifndef LLDB_SERVER_TESTS_MESSAGEOBJECTS_H #define LLDB_SERVER_TESTS_MESSAGEOBJECTS_H +#include "lldb/Core/RegisterValue.h" #include "lldb/Host/Host.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-types.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallString.h" @@ -22,12 +24,13 @@ namespace llgs_tests { class ThreadInfo; typedef llvm::DenseMap ThreadInfoMap; -typedef llvm::DenseMap U64Map; -typedef llvm::DenseMap RegisterMap; +typedef llvm::DenseMap RegisterMap; -class ProcessInfo { +template struct Parser { using result_type = T; }; + +class ProcessInfo : public Parser { public: - static llvm::Expected Create(llvm::StringRef response); + static llvm::Expected create(llvm::StringRef response); lldb::pid_t GetPid() const; llvm::support::endianness GetEndian() const; @@ -49,10 +52,9 @@ class ThreadInfo { public: ThreadInfo() = default; ThreadInfo(llvm::StringRef name, llvm::StringRef reason, - const RegisterMap ®isters, unsigned int signal); + RegisterMap registers, unsigned int signal); - llvm::StringRef ReadRegister(unsigned int register_id) const; - llvm::Expected ReadRegisterAsUint64(unsigned int register_id) const; + const lldb_private::RegisterValue *ReadRegister(unsigned int Id) const; private: std::string m_name; @@ -61,25 +63,40 @@ class ThreadInfo { unsigned int m_signal; }; -class JThreadsInfo { +class JThreadsInfo : public Parser { public: - static llvm::Expected Create(llvm::StringRef response, - llvm::support::endianness endian); + static llvm::Expected + create(llvm::StringRef Response, + llvm::ArrayRef RegInfos); const ThreadInfoMap &GetThreadInfos() const; private: + static llvm::Expected + parseRegisters(const lldb_private::StructuredData::Dictionary &Dict, + llvm::ArrayRef RegInfos); + JThreadsInfo() = default; ThreadInfoMap m_thread_infos; }; +struct RegisterInfoParser : public Parser { + static llvm::Expected + create(llvm::StringRef Response); +}; + +llvm::Expected +parseRegisterValue(const lldb_private::RegisterInfo &Info, + llvm::StringRef HexValue, llvm::support::endianness Endian); + class StopReply { public: StopReply() = default; virtual ~StopReply() = default; static llvm::Expected> - create(llvm::StringRef response, llvm::support::endianness endian); + create(llvm::StringRef Response, llvm::support::endianness Endian, + llvm::ArrayRef RegInfos); // for llvm::cast<> virtual lldb_private::WaitStatus getKind() const = 0; @@ -91,15 +108,17 @@ class StopReply { (public) class StopReplyStop : public StopReply { public: StopReplyStop(uint8_t Signal, lldb::tid_t ThreadId, llvm::StringRef Name, - U64Map ThreadPcs, RegisterMap Registers, llvm::StringRef Reason) + RegisterMap ThreadPcs, RegisterMap Registers, + llvm::StringRef Reason) : Signal(Signal), ThreadId(ThreadId), Name(Name), ThreadPcs(std::move(ThreadPcs)), Registers(std::move(Registers)), Reason(Reason) {} static llvm::Expected> - create(llvm::StringRef response, llvm::support::endianness endian); + create(llvm::StringRef Response, llvm::support::endianness Endian, + llvm::ArrayRef RegInfos); - const U64Map &getThreadPcs() const { return ThreadPcs; } + const RegisterMap &getThreadPcs() const { return ThreadPcs; } lldb::tid_t getThreadId() const { return ThreadId; } // for llvm::cast<> @@ -111,10 +130,15 @@ class StopReplyStop : public StopReply { (public) } private: + static llvm::Expected parseRegisters( + const llvm::StringMap> &Elements, + llvm::support::endianness Endian, + llvm::ArrayRef RegInfos); + uint8_t Signal; lldb::tid_t ThreadId; std::string Name; - U64Map ThreadPcs; + RegisterMap ThreadPcs; RegisterMap Registers; std::string Reason; }; @@ -155,5 +179,9 @@ llvm::Error make_parsing_error(llvm::StringRef format, } } // namespace llgs_tests + +namespace lldb_private { +std::ostream &operator<<(std::ostream &OS, const RegisterValue &RegVal); +} #endif // LLDB_SERVER_TESTS_MESSAGEOBJECTS_H Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.cpp ============================================================================== --- vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.cpp Sat Feb 24 21:27:59 2018 (r329938) +++ vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.cpp Sat Feb 24 21:28:02 2018 (r329939) @@ -25,9 +25,8 @@ using namespace lldb; using namespace lldb_private; using namespace llvm; +using namespace llgs_tests; -namespace llgs_tests { - TestClient::TestClient(std::unique_ptr Conn) { SetConnection(Conn.release()); @@ -106,7 +105,7 @@ Expected> TestClient::laun auto Client = std::unique_ptr(new TestClient(std::move(Conn))); if (!InferiorArgs.empty()) { - if (Error E = Client->QueryProcessInfo()) + if (Error E = Client->queryProcess()) return std::move(E); } @@ -136,7 +135,7 @@ Error TestClient::SetInferior(llvm::ArrayRef TestClient::GetJThreadsInfo() { - std::string response; - if (SendMessage("jThreadsInfo", response)) - return llvm::None; - auto creation = JThreadsInfo::Create(response, m_process_info->GetEndian()); - if (auto create_error = creation.takeError()) { - GTEST_LOG_(ERROR) << toString(std::move(create_error)); - return llvm::None; - } - - return std::move(*creation); +Expected TestClient::GetJThreadsInfo() { + return SendMessage("jThreadsInfo", m_register_infos); } const StopReply &TestClient::GetLatestStopReply() { @@ -209,42 +201,42 @@ Error TestClient::SendMessage(StringRef message, std:: } unsigned int TestClient::GetPcRegisterId() { - if (m_pc_register != UINT_MAX) - return m_pc_register; + assert(m_pc_register != LLDB_INVALID_REGNUM); + return m_pc_register; +} - for (unsigned int register_id = 0;; register_id++) { - std::string message = formatv("qRegisterInfo{0:x-}", register_id).str(); - std::string response; - if (SendMessage(message, response)) { - GTEST_LOG_(ERROR) << "Unable to query register ID for PC register."; - return UINT_MAX; - } +Error TestClient::qProcessInfo() { + m_process_info = None; + auto InfoOr = SendMessage("qProcessInfo"); + if (!InfoOr) + return InfoOr.takeError(); + m_process_info = std::move(*InfoOr); + return Error::success(); +} - auto elements_or_error = SplitUniquePairList("GetPcRegisterId", response); - if (auto split_error = elements_or_error.takeError()) { - GTEST_LOG_(ERROR) << "GetPcRegisterId: Error splitting response: " - << response; - return UINT_MAX; - } - - auto elements = *elements_or_error; - if (elements["alt-name"] == "pc" || elements["generic"] == "pc") { - m_pc_register = register_id; +Error TestClient::qRegisterInfos() { + for (unsigned int Reg = 0;; ++Reg) { + std::string Message = formatv("qRegisterInfo{0:x-}", Reg).str(); + Expected InfoOr = SendMessage(Message); + if (!InfoOr) { + consumeError(InfoOr.takeError()); break; } + m_register_infos.emplace_back(std::move(*InfoOr)); + if (m_register_infos[Reg].kinds[eRegisterKindGeneric] == + LLDB_REGNUM_GENERIC_PC) + m_pc_register = Reg; } - - return m_pc_register; + if (m_pc_register == LLDB_INVALID_REGNUM) + return make_parsing_error("qRegisterInfo: generic"); + return Error::success(); } -llvm::Error TestClient::QueryProcessInfo() { - std::string response; - if (Error E = SendMessage("qProcessInfo", response)) +Error TestClient::queryProcess() { + if (Error E = qProcessInfo()) return E; - auto create_or_error = ProcessInfo::Create(response); - if (!create_or_error) - return create_or_error.takeError(); - m_process_info = *create_or_error; + if (Error E = qRegisterInfos()) + return E; return Error::success(); } @@ -254,7 +246,8 @@ Error TestClient::Continue(StringRef message) { std::string response; if (Error E = SendMessage(message, response)) return E; - auto creation = StopReply::create(response, m_process_info->GetEndian()); + auto creation = StopReply::create(response, m_process_info->GetEndian(), + m_register_infos); if (Error E = creation.takeError()) return E; @@ -273,5 +266,3 @@ Error TestClient::Continue(StringRef message) { } return Error::success(); } - -} // namespace llgs_tests Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.h ============================================================================== --- vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.h Sat Feb 24 21:27:59 2018 (r329938) +++ vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/TestClient.h Sat Feb 24 21:28:02 2018 (r329939) @@ -59,7 +59,7 @@ class TestClient (public) llvm::Error ContinueAll(); llvm::Error ContinueThread(unsigned long thread_id); const ProcessInfo &GetProcessInfo(); - llvm::Optional GetJThreadsInfo(); + llvm::Expected GetJThreadsInfo(); const StopReply &GetLatestStopReply(); template llvm::Expected GetLatestStopReplyAs() { assert(m_stop_reply); @@ -74,12 +74,18 @@ class TestClient (public) std::string &response_string); llvm::Error SendMessage(llvm::StringRef message, std::string &response_string, PacketResult expected_result); + + template + llvm::Expected SendMessage(llvm::StringRef Message, + CreateArgs &&... Args); unsigned int GetPcRegisterId(); private: TestClient(std::unique_ptr Conn); - llvm::Error QueryProcessInfo(); + llvm::Error qProcessInfo(); + llvm::Error qRegisterInfos(); + llvm::Error queryProcess(); llvm::Error Continue(llvm::StringRef message); std::string FormatFailedResult( const std::string &message, @@ -88,8 +94,18 @@ class TestClient (public) llvm::Optional m_process_info; std::unique_ptr m_stop_reply; - unsigned int m_pc_register = UINT_MAX; + std::vector m_register_infos; + unsigned int m_pc_register = LLDB_INVALID_REGNUM; }; + +template +llvm::Expected +TestClient::SendMessage(llvm::StringRef Message, CreateArgs &&... Args) { + std::string ResponseText; + if (llvm::Error E = SendMessage(Message, ResponseText)) + return std::move(E); + return P::create(ResponseText, std::forward(Args)...); +} } // namespace llgs_tests Modified: vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp ============================================================================== --- vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp Sat Feb 24 21:27:59 2018 (r329938) +++ vendor/lldb/dist-release_60/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp Sat Feb 24 21:28:02 2018 (r329939) @@ -9,13 +9,19 @@ #include "TestBase.h" #include "TestClient.h" +#include "lldb/Utility/DataExtractor.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Testing/Support/Error.h" +#include "gmock/gmock.h" #include "gtest/gtest.h" #include using namespace llgs_tests; +using namespace lldb_private; using namespace llvm; +using namespace lldb; +using namespace testing; TEST_F(StandardStartupTest, TestStopReplyContainsThreadPcs) { // This inferior spawns 4 threads, then forces a break. @@ -29,7 +35,7 @@ TEST_F(StandardStartupTest, TestStopReplyContainsThrea ASSERT_NE(pc_reg, UINT_MAX); auto jthreads_info = Client->GetJThreadsInfo(); - ASSERT_TRUE(jthreads_info); + ASSERT_THAT_EXPECTED(jthreads_info, Succeeded()); auto stop_reply = Client->GetLatestStopReplyAs(); ASSERT_THAT_EXPECTED(stop_reply, Succeeded()); @@ -42,9 +48,7 @@ TEST_F(StandardStartupTest, TestStopReplyContainsThrea unsigned long tid = stop_reply_pc.first; ASSERT_TRUE(thread_infos.find(tid) != thread_infos.end()) << "Thread ID: " << tid << " not in JThreadsInfo."; - auto pc_value = thread_infos[tid].ReadRegisterAsUint64(pc_reg); - ASSERT_THAT_EXPECTED(pc_value, Succeeded()); - ASSERT_EQ(stop_reply_pcs[tid], *pc_value) - << "Mismatched PC for thread: " << tid; + EXPECT_THAT(thread_infos[tid].ReadRegister(pc_reg), + Pointee(Eq(stop_reply_pc.second))); } } From owner-svn-src-all@freebsd.org Sat Feb 24 21:28:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86322F24029; Sat, 24 Feb 2018 21:28:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4134377FAD; Sat, 24 Feb 2018 21:28:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7EB52B069; Sat, 24 Feb 2018 21:28:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OLS5eK009319; Sat, 24 Feb 2018 21:28:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OLS510009318; Sat, 24 Feb 2018 21:28:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201802242128.w1OLS510009318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 24 Feb 2018 21:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r329940 - vendor/lldb/lldb-release_60-r325932 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_60-r325932 X-SVN-Commit-Revision: 329940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:28:09 -0000 Author: dim Date: Sat Feb 24 21:28:05 2018 New Revision: 329940 URL: https://svnweb.freebsd.org/changeset/base/329940 Log: Tag lldb release_60 branch r325932. Added: vendor/lldb/lldb-release_60-r325932/ - copied from r329939, vendor/lldb/dist-release_60/ From owner-svn-src-all@freebsd.org Sat Feb 24 21:56:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D812F26595; Sat, 24 Feb 2018 21:56:07 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 162B27993C; Sat, 24 Feb 2018 21:56:06 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1OLu262002676; Sat, 24 Feb 2018 13:56:02 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1OLu1gT002675; Sat, 24 Feb 2018 13:56:01 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201802242156.w1OLu1gT002675@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r329930 - head/sbin/route In-Reply-To: <201802242125.w1OLPvia008757@repo.freebsd.org> To: Eugene Grosbein Date: Sat, 24 Feb 2018 13:56:01 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 21:56:07 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: eugen > Date: Sat Feb 24 21:25:56 2018 > New Revision: 329930 > URL: https://svnweb.freebsd.org/changeset/base/329930 > > Log: > route(8): make it possible to manually delete pinned route > > Reported by: Andreas Longwitz > Approved by: avg (mentor) > MFC after: 1 week > > Modified: > head/sbin/route/route.c > > Modified: head/sbin/route/route.c > ============================================================================== > --- head/sbin/route/route.c Sat Feb 24 20:47:22 2018 (r329929) > +++ head/sbin/route/route.c Sat Feb 24 21:25:56 2018 (r329930) > @@ -1519,8 +1519,10 @@ rtmsg(int cmd, int flags, int fib) > so[RTAX_IFP].ss_len = sizeof(struct sockaddr_dl); > rtm_addrs |= RTA_IFP; > } > - } else > + } else { > cmd = RTM_DELETE; > + flags |= RTF_PINNED; > + } That pretty much defeats the purpose of a PINNED route if by default route delete is going to delete them. > #define rtm m_rtmsg.m_rtm > rtm.rtm_type = cmd; > rtm.rtm_flags = flags; > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Feb 24 22:09:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41F7CF274FE; Sat, 24 Feb 2018 22:09:02 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BBC3A7A2A1; Sat, 24 Feb 2018 22:09:01 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w1OM8rwP029775 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Feb 2018 23:08:54 +0100 (CET) (envelope-from eugen@freebsd.org) X-Envelope-From: eugen@freebsd.org X-Envelope-To: rgrimes@freebsd.org Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w1OM8nUG010355 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 25 Feb 2018 05:08:49 +0700 (+07) (envelope-from eugen@freebsd.org) Subject: Re: svn commit: r329930 - head/sbin/route To: rgrimes@freebsd.org References: <201802242156.w1OLu1gT002675@pdx.rh.CN85.dnsmgr.net> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Eugene Grosbein Message-ID: <5A91E26C.40808@freebsd.org> Date: Sun, 25 Feb 2018 05:08:44 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <201802242156.w1OLu1gT002675@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 22:09:02 -0000 25.02.2018 4:56, Rodney W. Grimes wrote: > That pretty much defeats the purpose of a PINNED route if by default > route delete is going to delete them. Not exactly. According to rtentry(9): RTF_PINNED Indicates that this route is immutable to a routing protocol. That is, routing daemons should not be allowed to modify such route but /sbin/route is system administrator's tool, not routing protocol one. It should be able to remove any route that it could before "pinned" changes. Hence, this commit. From owner-svn-src-all@freebsd.org Sat Feb 24 22:34:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E3D3F29110; Sat, 24 Feb 2018 22:34:57 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1E277B3AE; Sat, 24 Feb 2018 22:34:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECDC12BBE6; Sat, 24 Feb 2018 22:34:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1OMYuZx047404; Sat, 24 Feb 2018 22:34:56 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1OMYupx047403; Sat, 24 Feb 2018 22:34:56 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201802242234.w1OMYupx047403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 24 Feb 2018 22:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329941 - head/sys/powerpc/ps3 X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/ps3 X-SVN-Commit-Revision: 329941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 22:34:57 -0000 Author: nwhitehorn Date: Sat Feb 24 22:34:56 2018 New Revision: 329941 URL: https://svnweb.freebsd.org/changeset/base/329941 Log: Avoid dereferencing random memory when kickstarting DMA. MFC after: 1 week Modified: head/sys/powerpc/ps3/if_glc.c Modified: head/sys/powerpc/ps3/if_glc.c ============================================================================== --- head/sys/powerpc/ps3/if_glc.c Sat Feb 24 21:28:05 2018 (r329940) +++ head/sys/powerpc/ps3/if_glc.c Sat Feb 24 22:34:56 2018 (r329941) @@ -832,7 +832,8 @@ glc_txintr(struct glc_softc *sc) /* Speculatively (or necessarily) start the TX queue again */ error = lv1_net_start_tx_dma(sc->sc_bus, sc->sc_dev, sc->sc_txdmadesc_phys + - txs->txs_firstdesc*sizeof(struct glc_dmadesc), 0); + ((txs == NULL) ? 0 : txs->txs_firstdesc)* + sizeof(struct glc_dmadesc), 0); if (error != 0) device_printf(sc->sc_self, "lv1_net_start_tx_dma error: %d\n", error);