From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eAt/JZQS9l/PKQAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 19:42:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IKR5IZQS9l9uTwAA1q6Kng (envelope-from ) for ; Wed, 06 Jan 2021 19:42:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 28E409402D4 for ; Wed, 6 Jan 2021 19:42:12 +0000 (UTC) Received: from localhost ([::1]:48016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxEh8-0005e5-3B for larch@yhetil.org; Wed, 06 Jan 2021 14:42:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxEh0-0005dp-Hn for guix-patches@gnu.org; Wed, 06 Jan 2021 14:42:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxEh0-0006vh-AD for guix-patches@gnu.org; Wed, 06 Jan 2021 14:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kxEh0-0001JN-7G for guix-patches@gnu.org; Wed, 06 Jan 2021 14:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45703] kernel-module-configuration-service for configuring kernel parameters Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Jan 2021 19:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45703 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: X-Debbugs-Original-Cc: raid5atemyhomework , ludo@gnu.org, raid5atemyhomework via Guix-patches via , "45692@debbugs.gnu.org" <45692@debbugs.gnu.org> Received: via spool by submit@debbugs.gnu.org id=B.16099621125021 (code B ref -1); Wed, 06 Jan 2021 19:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jan 2021 19:41:52 +0000 Received: from localhost ([127.0.0.1]:45622 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxEgp-0001Iv-FD for submit@debbugs.gnu.org; Wed, 06 Jan 2021 14:41:51 -0500 Received: from lists.gnu.org ([209.51.188.17]:42166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxEgo-0001Io-13 for submit@debbugs.gnu.org; Wed, 06 Jan 2021 14:41:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxEgn-0005de-Pm for guix-patches@gnu.org; Wed, 06 Jan 2021 14:41:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:35380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxEgi-0006pb-Pe; Wed, 06 Jan 2021 14:41:46 -0500 Received: from localhost (80-110-127-104.cgn.dynamic.surfer.at [80.110.127.104]) by dd26836.kasserver.com (Postfix) with ESMTPSA id B8C183365398; Wed, 6 Jan 2021 20:41:39 +0100 (CET) Date: Wed, 6 Jan 2021 20:41:34 +0100 From: Danny Milosavljevic Message-ID: <20210106204134.38e83db4@scratchpost.org> In-Reply-To: <6wemXB-PfHUqbuVr5-XRf0-tY4cKGGtKiUqrZPrIZYXoBw17L3xRuZrGOJQfTo5PKfFNCM8KyRTllidoc7asPE2x98BTiJSPVR7OSjxCuw8=@protonmail.com> References: <6wemXB-PfHUqbuVr5-XRf0-tY4cKGGtKiUqrZPrIZYXoBw17L3xRuZrGOJQfTo5PKfFNCM8KyRTllidoc7asPE2x98BTiJSPVR7OSjxCuw8=@protonmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/xXlbAOfUGZoWGj8WvcLyYPd"; protocol="application/pgp-signature"; micalg=pgp-sha512 Received-SPF: none client-ip=85.13.145.193; envelope-from=dannym@scratchpost.org; helo=dd26836.kasserver.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, MISSING_HEADERS=1.021, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: raid5atemyhomework@protonmail.com, 45703@debbugs.gnu.org, 45692@debbugs.gnu.org Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -0.44 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 28E409402D4 X-Spam-Score: -0.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: D7rxZXgOu848 --Sig_/xXlbAOfUGZoWGj8WvcLyYPd Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi raid5atemyhomework, Hi everyone, @raid5atemyhomework, thanks for all the patches! On Wed, 06 Jan 2021 15:57:19 +0000 raid5atemyhomework via Guix-patches via wrote: > +@item @code{options} (default: @code{'()}) > +A list of string options to pass as options to the ZFS module. > +These will be put in a @file{/etc/modprobe.d/zfs.conf} file, > +for example setting this to @code{'("zfs_admin_snapshot=3D1" > +"zfs_trim_extent_bytes_min=3D0")} will create the following file: Sure, but it would be better to create a way to configure those module para= meters in Guix in a declarative way, first. Your new kernel-loadable-module-service-type would be a good template to write a kernel-module-configuration-service that can be extended by other services. The latter should allow users to parametrize the kernel in general via the operating-system form, and also allow services to extend such configuration (with merging, and conflict detection). It would be used: (1) To declaratively specify the contents of something like /etc/modprobe.d= . It shouldn't even be called "/etc/modprobe.d"--it should also be in the sto= re instead. This directory is only useful for non-Linux-builtins. (2) If the "module" is built-in then the kernel command line must get the options instead. (in fact, it works as a kernel command line option also if it's a loadable module--so not sure we need /etc/modprobe.d at all--at least at first. But there's probably a maximal length for the kernel comma= nd line that we could exceed if we did that long term) I know it's annoying that Guix doesn't have this facility already, but the time to introduce an interface for /etc/modprobe.d and the kernel command line for builtin modules is before other services introduce their own ad hoc way to create /etc/modprobe.d--like this tries to do here. See also https://issues.guix.info/issue/42193 for an earlier attempt (which is already very far--but it has a bug somewhere). There's also already a kernel profile thing like you wrote in that patchset. (Note that I would prefer there not to be a "LOAD?" in there because it confuses loading the module (which is usually NOT started by user space but by the kernel on its own) and confguring the module (which has to be done by user space because it's specifying policy, not mechanism)) Also, because the kernel usually loads loadable modules on its own (potenti= ally really early), /etc/modprobe.d has to be preset and known to the modprobe executable VERY EARLY (via environment variable MODPROBE_OPTIONS--see=20 gnu/services.scm %modprobe-wrapper). It is totally possible that some modules in the initrd need options, too (see load-linux-modules-from-directory for where this would need to go). load-linux-module/fd already accepts options and flags--but both are not gi= ven on the call. For this, part of future kernel-module-configuration entries (the ones needed for modules in the initrd) should be copied into the initr= d, too. Then there's the handoff between initrd and main system. It would be bad if the kernel tried and succeeded to load a module that is not in the initrd just before the modprobe.d directory is set up (because it would be loaded without passing the options the user configured)--so that needs to be avoid= ed. @ludo: Could you help here? > +@example > +options zfs zfs_admin_snapshot=3D1 zfs_trim_extent_bytes_min=3D0 Note: This can be usefully put in a modprobe.d-like directory if zfs is a module,= but not if it's built into the kernel. But it can be put into the kernel comma= nd line in both cases. But I guess the ZFS Linux kernel module can't be built-in into the kernel anyway. But that's a special case--in general, it's very much possible to make modu= les built-in. > + ;; You'd think we could've used kernel-module-loade= r-service-type, Definitely. > + ;; but the kernel-module-loader shepherd service is= dependent on > + ;; file-systems,=20 Yes--but why is that dependent on 'file-systems ? Is it because it needs /p= roc ? Or is it an oversight ? I would prefer to get rid of this dependency and t= hen use kernel-module-loader-service-type. Also, this manual loading of kernel modules is not supposed to be the way to do things in Linux. That a kernel module was compiled as a module is an *implementation detail*--so Linux should (and usually does) automatically load kernel modules the first time a device for them is accessed (after all, how would user space know whether something is compiled as a module or built-in--that would be too much to ask). Linux is not a microkernel, so the kind of modularily modprobe.d suggests exists does not in fact exist in kernel space--even though Linux does a good job faking it: modprobe.d contains: * "alias": a feature to configure aliases, with wildcards (only one level of aliases allowed!) * "options" per module (also works for aliases with wildcards! That will be "fun" to map to Guix) * "install" in order to run some custom executable instead of loading the module. * "remove" in order to run some custom executable instead of unloading the module. * "blacklist" to ignore specific internal aliases of a module (that does not do what one would intuitively think!). If the file name of the regular file under /etc/modprobe.d is not used for anything, then we can just have one file /gnu/store/*modprobe.d/guix.conf in total in there. Then there are sysctl kernel parameters--but those Guix already exposes via sysctl-service-type. But those should also be made able to be extended by other services, and merge conflicts should be handled. For example, use= rs often set net.ipv4.ip_forward=3D1 (for example via sysctl). Thank you for all your effort to make ZFS work nicely in Guix. --Sig_/xXlbAOfUGZoWGj8WvcLyYPd Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl/2Em4ACgkQ5xo1VCww uqX7VQf/bHxCWBZt0FXRb5E0zvb0AZVwMPajkYvOBjfXJC+XcMbgjP3FKNW7VLGK FakRsyWnVX6gtFPxUDImjnCIGcY5LGYuaHxnDR4CTqzDBb06LRAMeJ1YTIyr+j+S ZO17TG4hZa+xWLqM6MUpfEwuc1I/b5o9oN39XJJLJAWJOdXMi2ZGwOKY8dpYhaDw zDPoOb3xHj9oDyXyWjOfb/8VK8bF8+L9Fzy3Bjt2WiG58j5jXpkYz9ZQe3zA1hbH zwFmmKqkFbL2gFhTxGWuQrp6x29T60lzBwUcjG58waCQee23TVFR9K/v7fvjrBal kHMS+9/Dc8FBIdzlHAbxj8/74qYkUQ== =nYdc -----END PGP SIGNATURE----- --Sig_/xXlbAOfUGZoWGj8WvcLyYPd--