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 mCx3Mk+GA18PQQAA0tVLHw (envelope-from ) for ; Mon, 06 Jul 2020 20:15:11 +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 GCBdLk+GA1/lKgAA1q6Kng (envelope-from ) for ; Mon, 06 Jul 2020 20:15:11 +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 55D159401D0 for ; Mon, 6 Jul 2020 20:15:11 +0000 (UTC) Received: from localhost ([::1]:41322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsXWA-00025Y-7L for larch@yhetil.org; Mon, 06 Jul 2020 16:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsXW2-000249-Tq for guix-patches@gnu.org; Mon, 06 Jul 2020 16:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jsXW2-0006DB-J9 for guix-patches@gnu.org; Mon, 06 Jul 2020 16:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jsXW2-0008LG-CA for guix-patches@gnu.org; Mon, 06 Jul 2020 16:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42123] [PATCH] linux-libre: Enable module compression. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 06 Jul 2020 20:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42123 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 42123@debbugs.gnu.org Received: via spool by 42123-submit@debbugs.gnu.org id=B42123.159406644331985 (code B ref 42123); Mon, 06 Jul 2020 20:15:02 +0000 Received: (at 42123) by debbugs.gnu.org; 6 Jul 2020 20:14:03 +0000 Received: from localhost ([127.0.0.1]:34919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsXV5-0008Jp-9Q for submit@debbugs.gnu.org; Mon, 06 Jul 2020 16:14:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jsXV1-0008IH-EG for 42123@debbugs.gnu.org; Mon, 06 Jul 2020 16:14:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33235) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsXUw-000661-6C for 42123@debbugs.gnu.org; Mon, 06 Jul 2020 16:13:54 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55076 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jsXUu-0000yk-Ul; Mon, 06 Jul 2020 16:13:53 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200629142434.21308-1-othacehe@gnu.org> <87366atdve.fsf@gnu.org> <87lfjx6nb9.fsf@gnu.org> <873664ltqt.fsf@gnu.org> <878sfw7mec.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Messidor an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 06 Jul 2020 22:13:50 +0200 In-Reply-To: <878sfw7mec.fsf@gnu.org> (Mathieu Othacehe's message of "Mon, 06 Jul 2020 16:23:23 +0200") Message-ID: <871rloiept.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 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-Spam-Score: -1.01 X-TUID: hnhX+h/VjUmV Hi, Mathieu Othacehe skribis: >> I don=E2=80=99t have other ideas, but both solutions sound good to me. = Using >> (guix zlib) is slightly more =E2=80=9Celegant=E2=80=9D IMO, but no big d= eal. I don=E2=80=99t >> expect any significant difference from the use of in-process >> decompression, unless we really have to go and decompress many modules >> in a row. > > Creating the initrd implies to create the module name database, and it > ends-up decompressing every single module. Using the in-process method > it takes 2 seconds, using the second method 30 seconds. Woow, interesting. > So, I opted for the first solution as you suggested. Here's an attached > patch that fixes the situation. [...] > From 8bbf343510091fad4a08758e0115a70410c1c8d7 Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Mon, 6 Jul 2020 16:04:21 +0200 > Subject: [PATCH] self: Add with-imported-modules+config and use it. > > Introduce "with-imported-modules+config" and use it to replace every call= to > "with-imported-modules" that would trigger an import of (guix config) mod= ule. > > * guix/self.scm (not-config?): New procedure, > (with-imported-modules+config): new macro. > * guix/profiles.scm (linux-module-database): Replace with-imported-module= s by > with-imported-modules+config. > * gnu/system/shadow.scm (account-shepherd-service): Ditto. > * gnu/system/linux-initrd.scm (raw-initrd): Ditto. > * gnu/services/base.scm (default-serial-port): Ditto, > (file-system-shepherd-service): ditto, > (udev-shepherd-service): ditto. > * gnu/services.scm (activation-script): Ditto. > * gnu/machine/ssh.scm (machine-check-initrd-modules): Ditto. [...] > diff --git a/guix/self.scm b/guix/self.scm > index e1350a7403..82bb55f8e7 100644 > --- a/guix/self.scm > +++ b/guix/self.scm > @@ -33,6 +33,8 @@ > #:use-module (srfi srfi-35) > #:use-module (ice-9 match) > #:export (make-config.scm > + not-config? > + with-imported-modules+config > whole-package ;for internal use in 'guix= pull' > compiled-guix > guix-derivation)) > @@ -1063,6 +1065,24 @@ Info manual." > ;; made relative to a nonexistent anonymous module. > #:splice? #t)) >=20=20 > +(define not-config? > + ;; Select (guix =E2=80=A6) and (gnu =E2=80=A6) modules, except (guix c= onfig). > + (match-lambda > + (('guix 'config) #f) > + (('guix rest ...) #t) > + (('gnu rest ...) #t) > + (rest #f))) > + > +(define-syntax-rule (with-imported-modules+config modules exp ...) > + "Import the closure of MODULES and evaluate EXP within this context. = If the > +(guix config) module is part of the closure, it is not selected. This m= odule > +is always replaced by a mocked-one, created by MAKE-CONFIG.SCM pocedure." > + (with-imported-modules `(,@(source-module-closure > + modules > + #:select? not-config?) > + ((guix config) =3D> ,(make-config.scm))) > + exp ...)) Two remarks: I feel that this is not the best place for it, and I think we should add (guix config) if and only if it=E2=80=99s actually part of the closure. For the name I=E2=80=99m tempted by a simpler but less descriptive option. That would give us: (define-syntax-rule (with-imported-modules* modules exp ...) (let ((closure (source-module-closure modules #:select? not-config?))) (with-imported-modules (map (match-lambda (('guix 'config) =E2=80=A6) (module module)) closure) exp ...))) WDYT? As for the location=E2=80=A6 I think the reason things are like this is to = avoid having everything depend on (guix self), but maybe that=E2=80=99s OK after = all? If the zlib bindings were an external package, things would be easier because we wouldn=E2=80=99t have to do this (guix config) dance. More generally, we should look at all the uses of (guix config) and see whether/how we can get rid of them. But I digress=E2=80=A6 Thoughts? Thank you, Ludo=E2=80=99.