From owner-freebsd-current@freebsd.org Thu Aug 3 06:58:15 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 190C7DCD512; Thu, 3 Aug 2017 06:58:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 004FC69D0E; Thu, 3 Aug 2017 06:58:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA23332; Thu, 03 Aug 2017 09:58:11 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1ddA5D-00011X-Mc; Thu, 03 Aug 2017 09:58:11 +0300 Subject: Re: order of executing MOD_LOAD and registering module sysctl-s To: John Baldwin , freebsd-current@FreeBSD.org Cc: Hans Petter Selasky , FreeBSD Hackers References: <62e7ab4d-8956-545e-b204-4fb63cfe5fbf@FreeBSD.org> <2718016.8bPh6cqhGc@ralph.baldwin.cx> From: Andriy Gapon Message-ID: <158cf433-f2c8-9006-b091-15fe3095c759@FreeBSD.org> Date: Thu, 3 Aug 2017 09:57:15 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <2718016.8bPh6cqhGc@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 06:58:15 -0000 On 02/08/2017 18:49, John Baldwin wrote: > sysctl nodes are created explicitly via linker_file_register_sysctls, not via > SYSINITs, so you can't order them with respect to other init functions. > > I think Andriy's suggestion of doing sysctls "inside" sysinits (so they are > registered last and unregistered first) is probably better than the current > state and is a simpler fix than changing all sysctls to use SYSINITs. Kostik (kib) suggested a possible valid use-case that depends on the current order: adding dynamic sysctl-s under static sysctl-s via the module load handler. He also offered an idea for a possible solution: holding the modules lock in the shared mode (MOD_SLOCK) around calls to sysctl-s registered from modules. -- Andriy Gapon