From patchwork Thu Jan 5 22:01:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 45874 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C1FDD27BBE9; Thu, 5 Jan 2023 22:02:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 87A8E27BBEB for ; Thu, 5 Jan 2023 22:02:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDYJJ-0002Hd-9u; Thu, 05 Jan 2023 17:02:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDYJH-0002Gn-0n for guix-patches@gnu.org; Thu, 05 Jan 2023 17:02:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDYJG-0003oV-OO for guix-patches@gnu.org; Thu, 05 Jan 2023 17:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pDYJG-0002fZ-7C for guix-patches@gnu.org; Thu, 05 Jan 2023 17:02:02 -0500 Subject: bug#59746: [DOCUMENTATION] [PATCH] doc: Introduce using Swap Space for hibernation, with an example. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Thu, 05 Jan 2023 22:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 59746 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ivan Vilata i Balaguer Cc: 59746-done@debbugs.gnu.org Mail-Followup-To: 59746@debbugs.gnu.org, ludo@gnu.org, ivan@selidor.net Received: via spool by 59746-done@debbugs.gnu.org id=D59746.167295607910202 (code D ref 59746); Thu, 05 Jan 2023 22:02:01 +0000 Received: (at 59746-done) by debbugs.gnu.org; 5 Jan 2023 22:01:19 +0000 Received: from localhost ([127.0.0.1]:53183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDYIY-0002eS-IA for submit@debbugs.gnu.org; Thu, 05 Jan 2023 17:01:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDYIW-0002eE-T2 for 59746-done@debbugs.gnu.org; Thu, 05 Jan 2023 17:01:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDYIQ-0003gO-Tp; Thu, 05 Jan 2023 17:01:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=9VlP98MVIEPjyxdZ+X75AeLM6YXjjQCQkpSrV1IWrzc=; b=d/ZTreev6wbt2dXEDyhD ZgOWrZVjtw5JE22VaTZc5Re2FPE9PnJ9v1Ctn4x8Su58K+fDcIDwLQRg4lM0PriXSbW9Gp61S+rR9 SRCE7OROBF0D8ULLtq61L/veXQalcS/3CLG9vRosqEisDvhz1cdkwokti67tcnW1hBogT6yAB4Siv N1IRtKglsdhsbF0T/2H4q7xljqy+IYFBvO5XhYZqKKWRdTKFyT4P0+4UFt4Eg6vmTGG5pLM3qWYqE 5q29rkYJbsGylBapgE6eUf+Eepd/YHMucczughiV4JjDQsJKrah37Q9WRUskmEsnWGkZ+6L8ELAKw BJ2Mylg4fOjhdw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDYIQ-0008BJ-Hj; Thu, 05 Jan 2023 17:01:10 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= References: Date: Thu, 05 Jan 2023 23:01:07 +0100 In-Reply-To: (Ivan Vilata i. Balaguer's message of "Wed, 21 Dec 2022 13:16:59 +0100") Message-ID: <87tu141w0s.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi, Ivan Vilata i Balaguer skribis: > This patch replaces the previous one and enhances it with several minor fixes > and the missing information related to computing the swap file offset, as > discussed [in the guix-devel thread][1]. > > [1]: https://lists.gnu.org/archive/html/guix-devel/2022-12/msg00028.html > > Thanks and cheers! > > -- > Ivan Vilata i Balaguer -- https://elvil.net/ > > From e95d79ef8c466e495c730f722b7aefc4d2d5969f Mon Sep 17 00:00:00 2001 > From: Ivan Vilata-i-Balaguer > Date: Wed, 21 Dec 2022 13:08:48 +0100 > Subject: [PATCH] doc: Introduce using swap space for hibernation, with > examples. > > * doc/guix.texi (Swap Space): Add a concise introduction to hibernation and > specifying a swap space to the kernel to make resume work. Mention space > requirements and the need of an offset for swap files. Include a trivial > example on how to set up a mapped swap volume for hibernation and another one > for a swap file, including how to compute the file offset. Very nice! Applied with the tweaks below. Thanks, Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 9a74ae64d6..293c3016aa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17109,14 +17109,18 @@ should consider ease of use when deciding between them. Partitions are allocated at disk formatting time (logical volumes notwithstanding), whereas files can be allocated and deallocated at any time. -A swap space is also required in order to hibernate a system using the -Linux kernel. Hibernation (also called suspend to disk) uses at most -half the size of the RAM in the configured swap space. The kernel needs -to know about the swap space to be used to resume from hibernation on -boot (via a kernel argument). When using a swap file, its offset in the -device holding it also needs to be given to the kernel, but that value -has to be updated if the file is initialized again as swap (e.g. because -its size was changed). +@cindex hibernation +@cindex suspend to disk +Swap space is also required to put the system into @dfn{hibernation} +(also called @dfn{suspend to disk}), whereby memory is dumped to swap +before shutdown so it can be restored when the machine is eventually +restarted. Hibernation uses at most half the size of the RAM in the +configured swap space. The Linux kernel needs to know about the swap +space to be used to resume from hibernation on boot (@i{via} a kernel +argument). When using a swap file, its offset in the device holding it +also needs to be given to the kernel; that value has to be updated if +the file is initialized again as swap---e.g., because its size was +changed. Note that swap space is not zeroed on shutdown, so sensitive data (such as passwords) may linger on it if it was paged out. As such, you should @@ -17215,7 +17219,7 @@ select the file system in an elegant fashion! %default-kernel-arguments)) @end lisp -The previous snippet of an @code{operating-system} declaration enables +The above snippet of an @code{operating-system} declaration enables the mapped device @file{/dev/mapper/my-swap} (which may be part of an encrypted device) as swap space, and tells the kernel to use it for hibernation via the @code{resume} kernel argument