From owner-svn-src-head@freebsd.org Sun Feb 18 00:02:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 00:44:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 00:56:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:01:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:13:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:15:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:16:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:31:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:35:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 01:42:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 02:01:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 02:48:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 02:48:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 02:53:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 03:04:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 04:00:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 08:05:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 08:40:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 08:29:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 09:10:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 08:47:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 09:31:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 08:58:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 09:52:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 11:17:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 12:54:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 15:27:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 16:03:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 16:41:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 17:37:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 18:46:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 19:19:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 19:33:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 20:04:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 20:08:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 20:46:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 21:07:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 21:08:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 22:54:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 22:57:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 23:01:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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-head@freebsd.org Sun Feb 18 23:08:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org 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.or