From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH] gnu: Add powertop-service-type. Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sun, 07 Jan 2024 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68309@debbugs.gnu.org Cc: Ian Eure , ( , Christopher Baines , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Raghav Gururajan , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice , jgart X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( , Christopher Baines , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Raghav Gururajan , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice , jgart Received: via spool by submit@debbugs.gnu.org id=B.170466252318750 (code B ref -1); Sun, 07 Jan 2024 21:23:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jan 2024 21:22:03 +0000 Received: from localhost ([127.0.0.1]:34031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMaao-0004sL-VS for submit@debbugs.gnu.org; Sun, 07 Jan 2024 16:22:03 -0500 Received: from lists.gnu.org ([2001:470:142::17]:38210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMaan-0004rs-Bo for submit@debbugs.gnu.org; Sun, 07 Jan 2024 16:22:01 -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 1rMaac-0002iV-9Z for guix-patches@gnu.org; Sun, 07 Jan 2024 16:21:50 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMaaa-0000Xh-25 for guix-patches@gnu.org; Sun, 07 Jan 2024 16:21:50 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 38DF65C122F; Sun, 7 Jan 2024 16:21:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 07 Jan 2024 16:21:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1704662505; x=1704748905; bh=Lk BAkNAoPU8qGkNgRcp5oABL3L3fpCu+Zc7z3MxBMrw=; b=SYg+tPkHKkAJ+FWOYE WPB+A3bWsOAUQMEQ6SksK0FN7qeRU8xCpakhaAPc8tfpqyt96hP2XXtc6pPFj1Sk yjsG5Yp1pG4W2eJfnJGgg3aBFW/irb19sKF7Y0t3LBUhst06x2iAssBLS/yOPplm 1+Y8u5ZYFAuJbOBMgX6ivpFJDq0Kbosmc8OBNYXjPSt9egGJqyqHJkPtUs8AIL3+ gSVm/CA0t/nGfQNMT4nybxTh/1/+HuwPMLZ1J0sFIjCEVbMkNMP6g1CPn1r8I/wU x3NsJuGYW3VCXtaFSVWIMKCBRWPxG0KIjbBfPVITzJmRKDChhQ+RsIUFOZe/Ql59 jEUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1704662505; x=1704748905; bh=LkBAkNAoPU8qG kNgRcp5oABL3L3fpCu+Zc7z3MxBMrw=; b=xnKkGtsQnVkLeeBrdTgGMy6iBz67y PTqV65eF8SIej/THu+zgqHojkCiM0jIqbk3JfI8IrLdVPA17+nyeBOE+Xq1uY0y/ Ku5+fRwdcuz/LY/Z2EkH2skWh2XLgqMiUHvpSV6ovpkpw1G3hW+abn1Ajy4p0O0X v29uUK5TnJiWHaFQ3bSZIEDliuk3trZ/gyV0wq7zNVbh0QIOtB+NlydjUMlcc04w /Z6Zm+PnRfqhgHmkQmKU4+7JaSL27mBRxk3fAv4fxPgQWIfS4N0MM/lVlBQ8QnC9 HR6oLS/YWrBYpYNyuE1R3u3FpAGtDBRrdHV1XpRYO0sA4i4D59xaruH2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehgedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffogggtgfesthekre dtredtjeenucfhrhhomhepkfgrnhcugfhurhgvuceoihgrnhesrhgvthhrohhsphgvtgdr thhvqeenucggtffrrghtthgvrhhnpeelhffgteelveejjeelffekhfehgfehtdefgfduvd duieffjedugedvhfevjeetteenucffohhmrghinheptddurdhorhhgpdhgnhhurdhorhhg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnh esrhgvthhrohhsphgvtgdrthhv X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 7 Jan 2024 16:21:44 -0500 (EST) From: Ian Eure Date: Sun, 7 Jan 2024 13:21:21 -0800 Message-ID: <20240107212122.21810-1-ian@retrospec.tv> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=66.111.4.25; envelope-from=ian@retrospec.tv; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) * gnu/services/pm.scm (powertop-shepherd-service): New variable. * gnu/services/pm.scm (powertop-service-type): New variable. * gnu/services/pm.scm (powertop-configuration): New variable. * gnu/packages/linux.scm (powertop): Correct package description. * doc/guix.texi (Power Management Services): Document powertop-service-type. Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a --- doc/guix.texi | 24 +++++++++++++++++++++++ gnu/packages/linux.scm | 2 +- gnu/services/pm.scm | 43 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a648a106b3..e95ae140f2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34755,6 +34755,30 @@ Ignore cpuid check for supported CPU models. @item @code{thermald} (default: @var{thermald}) Package object of thermald. +@cindex powertop +@cindex Power tuning with PowerTOP +@subsubheading PowerTOP + +The @code{(gnu services pm)} module provides a Guix service definition +for PowerTOP. When started, it tunes kernel settings to reduce power +consumption. + +@defvar powertop-service-type +The service type for PowerTOP. No configuration is necessary. When the +service starts, it executes @code{powertop --auto-tune}. + +@lisp +(service powertop-service-type) + +@end defvar + +Available @code{powertop-configuration} fields are: + +@deftypevr {@code{powertop-configuration} parameter} package powertop +The PowerTOP package. Defaults to @code{powertop}. + +@end deftypevr + @end table @end deftp diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0fe64bacf3..c53d8f82bd 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -3634,7 +3634,7 @@ (define-public powertop (inputs (list kmod libnl ncurses pciutils zlib)) (home-page "https://01.org/powertop/") - (synopsis "Analyze power consumption on Intel-based laptops") + (synopsis "Analyze power consumption on x86-based laptops") (description "PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index 3daf484cc1..13a153ab1d 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2024 Ian Eure ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,6 +18,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services pm) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) @@ -31,7 +34,10 @@ (define-module (gnu services pm) tlp-configuration thermald-configuration - thermald-service-type)) + thermald-service-type + + powertop-configuration + powertop-service-type)) (define (uglify-field-name field-name) (let ((str (symbol->string field-name))) @@ -466,3 +472,38 @@ (define thermald-service-type (default-value (thermald-configuration)) (description "Run thermald, a CPU frequency scaling service that helps prevent overheating."))) + + + +;;; +;;; powertop +;;; +;;; Calls `powertop --auto-tune' to reduce energy consumption. + + + +(define-configuration powertop-configuration + (powertop (package powertop) "PowerTOP package to use.")) + +(define powertop-shepherd-service + (match-lambda + (($ powertop) + (shepherd-service + (documentation "Tune kernel power settings at boot.") + (provision '(powertop powertop-auto-tune)) + (requirement '(user-processes)) + (one-shot? #t) + (start #~(lambda _ + (zero? (system* #$(file-append powertop "/sbin/powertop") + "--auto-tune")))))))) + +(define powertop-service-type + (service-type + (name 'powertop) + (extensions + (list + (service-extension shepherd-root-service-type + (compose list powertop-shepherd-service)))) + (compose concatenate) + (default-value (powertop-configuration)) + (description "Tune power-related kernel parameters to reduce energy consumption."))) -- 2.41.0 From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH] gnu: Add powertop-service-type. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Jan 2024 09:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ian Eure Cc: Simon Tournier , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Ricardo Wurmus , Raghav Gururajan , 68309@debbugs.gnu.org, jgart , Christopher Baines Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.170470507613145 (code B ref 68309); Mon, 08 Jan 2024 09:12:01 +0000 Received: (at 68309) by debbugs.gnu.org; 8 Jan 2024 09:11:16 +0000 Received: from localhost ([127.0.0.1]:35188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMlfA-0003Pw-Ax for submit@debbugs.gnu.org; Mon, 08 Jan 2024 04:11:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMlf9-0003Pj-4Z for 68309@debbugs.gnu.org; Mon, 08 Jan 2024 04:11:15 -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 1rMlet-00070L-DZ; Mon, 08 Jan 2024 04:11:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=5cbRmk45qgg7woOJF2QoCzUpOlzulvhzUtclsHIKxCs=; b=MSUsiGZzKMK00xpr7FmX zJ2ZRwZTTR77t+FAkYnJMdyph0kvNKPlCFv1utCPxxADhIcJqmeAmtWws1oskRvNNBKkC1ACK5cFk PsqOPsnmI9EdeVDTs910gzJDBktc+8izeRx3jSmaOnXluBv2Pw5GjJANpKQgVGOKNNa+cvjuuSQS4 O6hJVIyV8KMXIsgBew6wCGQvyhEioSxxz0zJEDCUJknrUgvMD7b6YbNOotmHBRq2w3ncBkQfPQtE2 0oLNaK/U/nGgW9aOPJ4Q4AyKqmaDivAeqRa+HzXuy2BgJQcnwf5c3QmeSS3ebz6wWlPvuH41h4m3u qvb/ACTCCyupNQ==; From: Mathieu Othacehe In-Reply-To: <20240107212122.21810-1-ian@retrospec.tv> (Ian Eure's message of "Sun, 7 Jan 2024 13:21:21 -0800") References: <20240107212122.21810-1-ian@retrospec.tv> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 08 Jan 2024 10:10:55 +0100 Message-ID: <87zfxg8a1s.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Looks good, > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm > index 0fe64bacf3..c53d8f82bd 100644 > --- a/gnu/packages/linux.scm > +++ b/gnu/packages/linux.scm > @@ -3634,7 +3634,7 @@ (define-public powertop > (inputs > (list kmod libnl ncurses pciutils zlib)) > (home-page "https://01.org/powertop/") > - (synopsis "Analyze power consumption on Intel-based laptops") > + (synopsis "Analyze power consumption on x86-based laptops") This should be part of a separate commit. > + (zero? (system* #$(file-append powertop "/sbin/powertop") > + "--auto-tune")))))))) If the laptop booted with power cord plugged, but then goes on battery, does this need to be run again? Thanks, Mathieu From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH] gnu: Add powertop-service-type. Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Jan 2024 21:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: Simon Tournier , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Ricardo Wurmus , Raghav Gururajan , 68309@debbugs.gnu.org, jgart , Christopher Baines Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.170518111510814 (code B ref 68309); Sat, 13 Jan 2024 21:26:02 +0000 Received: (at 68309) by debbugs.gnu.org; 13 Jan 2024 21:25:15 +0000 Received: from localhost ([127.0.0.1]:41236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOlVD-0002oM-E4 for submit@debbugs.gnu.org; Sat, 13 Jan 2024 16:25:15 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:57517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOlVB-0002o6-GQ for 68309@debbugs.gnu.org; Sat, 13 Jan 2024 16:25:14 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 0F21E3200AD6; Sat, 13 Jan 2024 16:25:07 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 13 Jan 2024 16:25:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1705181107; x=1705267507; bh=+x/cTiqdb30OX7CGM4rTxY//fVn9KP6izGbSDGPk5S4=; b= WCSEgFg2W9kSRfexXAvYMaO1ecCFJkkdVnIHdrZdt+E4P7unuOLaNsDaEaFsIZMH MLk9t3xFA/ypz+VgW9gqxhNmHegVNzpb20rhZi5ZqD7C/Rakh2mhdJJK7QGpJTqY nTT78jdr6/16pYFwL6prPCY/UaQeT9Ihwse5vUlsYUdXaZL5CaCzQUxJ58rC3QJc zd4KfhwSq4Hhk1XiLJF7h5lp5UtcU9vvUY+g0GjTvl0vCEQNNvsIoMiPlewPYFjO UPitg0MaIeCp9MxzES3orv4vP7Lvs/RWbLKe05irui5ynM4KShD0VFvwQRwQQkdS rKX2dWBOOwTklwqj0yIvUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1705181107; x= 1705267507; bh=+x/cTiqdb30OX7CGM4rTxY//fVn9KP6izGbSDGPk5S4=; b=F 90G+JxVwDnwt4jX2uDcMJ7MOU1Zrvuk74ZYPyp+XK2ykhFj23DZug/mIoNk3dDpu P8/+SrwZ3+uJNM9HE5fU/7XW16YRUONBrRXrgDGJKL9RcK2g8mfj6q0bbzIHDYBz 2TnCai38kYfctrC011fPCjKA/PU5+CUAwH5yT2GUcEmtkT8Jvv1tMcvgvch7XNE+ eveBq4/W0oiCGHj8GTq094sjmMTjpzqOGIBJzxYR/1DOtBNESArYoysGr7r5/uk0 s/gjGpvm/kttjg5QgCHPK+ogIcIq3Y3At8/7ICGGgDQN3Mjcr/0yaxx8yWLHioXK c07RG0M7NjO90sQg6EFzA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeijedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepkfgr nhcugfhurhgvuceoihgrnhesrhgvthhrohhsphgvtgdrthhvqeenucggtffrrghtthgvrh hnpeelhfeuudejieejgefhgfeuieeggeeitdejieevjeffteeutddvuedtgfehueevhfen ucffohhmrghinheptddurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepihgrnhesrhgvthhrohhsphgvtgdrthhv X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 13 Jan 2024 16:25:05 -0500 (EST) References: <20240107212122.21810-1-ian@retrospec.tv> <87zfxg8a1s.fsf@gnu.org> User-agent: mu4e 1.10.8; emacs 29.1 From: Ian Eure Date: Sat, 13 Jan 2024 13:23:56 -0800 In-reply-to: <87zfxg8a1s.fsf@gnu.org> Message-ID: <87y1ctorin.fsf@retrospec.tv> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Mathieu Othacehe writes: > Hello, > > Looks good, > >> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm >> index 0fe64bacf3..c53d8f82bd 100644 >> --- a/gnu/packages/linux.scm >> +++ b/gnu/packages/linux.scm >> @@ -3634,7 +3634,7 @@ (define-public powertop >> (inputs >> (list kmod libnl ncurses pciutils zlib)) >> (home-page "https://01.org/powertop/") >> - (synopsis "Analyze power consumption on Intel-based=20 >> laptops") >> + (synopsis "Analyze power consumption on x86-based=20 >> laptops") > > This should be part of a separate commit. > Okay, I=E2=80=99ll send a patch series in a bit. I was hoping it could be= =20 one commit, because it=E2=80=99s related, and sending a patch series is=20 very annoying. >> + (zero? (system* #$(file-append powertop=20 >> "/sbin/powertop") >> + "--auto-tune")))))))) > > If the laptop booted with power cord plugged, but then goes on=20 > battery, > does this need to be run again? > No, the settings persist across power plug/unplug events. From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH 1/2] gnu: Add powertop-service-type. References: <20240107212122.21810-1-ian@retrospec.tv> In-Reply-To: <20240107212122.21810-1-ian@retrospec.tv> Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 14 Jan 2024 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68309@debbugs.gnu.org Cc: Ian Eure Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.17051928373339 (code B ref 68309); Sun, 14 Jan 2024 00:41:02 +0000 Received: (at 68309) by debbugs.gnu.org; 14 Jan 2024 00:40:37 +0000 Received: from localhost ([127.0.0.1]:41359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOoYH-0000rm-90 for submit@debbugs.gnu.org; Sat, 13 Jan 2024 19:40:37 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:40803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOoYF-0000rV-Ek for 68309@debbugs.gnu.org; Sat, 13 Jan 2024 19:40:36 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6F4CD5C007C; Sat, 13 Jan 2024 19:40:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 13 Jan 2024 19:40:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1705192830; x=1705279230; bh=xr wr6lWSvmvdPfw1YGL0Z4/QEXJtHhFuf8u5XXoyxKc=; b=mJZVI9Z7I/I4khrAwr YkmV1w5Q0BQz9nJAD6V/XEa8UlLtdq2yHiWQisft5SubnwFUcOs/O3xD+4/5syTH mgBd0ljkBDfAwYhEpNLfOKPlzbF5dFIVR32qiZG5rX6ASFu9PhJ9Vd4BgZPPyqOV ytGVP4hE37AeEyMoGloOopMaTKqK+0Qa83Th8enj0kMNx7XSL8Ie27zdMZpt8SIi Gl8cT8aDtOi7YE9DuIX3KvpXUxNS0XFbGtQYaMNfzlG5y3WvB5IT5l/UiPIQw3Qy +yddpCEPOCAR3c/58PaMyDdLihZeft9cJugbYbmxq9du+4OEu6lBxaWdbKZWhEer C0cA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1705192830; x=1705279230; bh=xrwr6lWSvmvdP fw1YGL0Z4/QEXJtHhFuf8u5XXoyxKc=; b=9CXKGnRzRKkP13NFcVkfDWGB55bjo Talw9YPDK+xxRBB29O+EblkvHiv4ktL8BxqLaXZAZTIB3VKfADAIOhMUIuXQSr3+ rMl3ummFw2zmqkv3dWdsH4p64fPMIiPwUVRg1fAeL9TcEqOJ6c6g3p7Aroy30xtn hxWxmmJa2sOHk3QPrjCvy+4gwpZd8c1z8jRN1BvkcyEMCL+9UtmosTfMkIjZzpL7 sHagyK+9c/NlqVO8G6+44QuRbsQ9W+VQ/yt4o0hEv1gfnSVO68Xfy7Vakbb8aW7X Aict5DDX1wgIR7jE6cS1hHnhAHOhYNzflFMDvlgYzzuTD2C7DpBY+gB/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeikedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffogggtgfesthekre dtredtjeenucfhrhhomhepkfgrnhcugfhurhgvuceoihgrnhesrhgvthhrohhsphgvtgdr thhvqeenucggtffrrghtthgvrhhnpeejuefghefgffefteehvddtuddutefhvddtfeduhf dugfdvvdeulefgfefhhefhheenucffohhmrghinhepghhnuhdrohhrghenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehirghnsehrvghtrhhosh hpvggtrdhtvh X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 13 Jan 2024 19:40:29 -0500 (EST) From: Ian Eure Date: Sat, 13 Jan 2024 16:40:17 -0800 Message-ID: <20240114004019.5019-1-ian@retrospec.tv> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/services/pm.scm (powertop-shepherd-service): New variable. * gnu/services/pm.scm (powertop-service-type): New variable. * gnu/services/pm.scm (powertop-configuration): New variable. * doc/guix.texi (Power Management Services): Document powertop-service-type. Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a --- doc/guix.texi | 24 ++++++++++++++++++++++++ gnu/services/pm.scm | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 811edd0bf7..a48aa655ae 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34798,6 +34798,30 @@ Ignore cpuid check for supported CPU models. @item @code{thermald} (default: @var{thermald}) Package object of thermald. +@cindex powertop +@cindex Power tuning with PowerTOP +@subsubheading PowerTOP + +The @code{(gnu services pm)} module provides a Guix service definition +for PowerTOP. When started, it tunes kernel settings to reduce power +consumption. + +@defvar powertop-service-type +The service type for PowerTOP. No configuration is necessary. When the +service starts, it executes @code{powertop --auto-tune}. + +@lisp +(service powertop-service-type) + +@end defvar + +Available @code{powertop-configuration} fields are: + +@deftypevr {@code{powertop-configuration} parameter} package powertop +The PowerTOP package. Defaults to @code{powertop}. + +@end deftypevr + @end table @end deftp diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index 3daf484cc1..13a153ab1d 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2024 Ian Eure ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,6 +18,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services pm) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) @@ -31,7 +34,10 @@ (define-module (gnu services pm) tlp-configuration thermald-configuration - thermald-service-type)) + thermald-service-type + + powertop-configuration + powertop-service-type)) (define (uglify-field-name field-name) (let ((str (symbol->string field-name))) @@ -466,3 +472,38 @@ (define thermald-service-type (default-value (thermald-configuration)) (description "Run thermald, a CPU frequency scaling service that helps prevent overheating."))) + + + +;;; +;;; powertop +;;; +;;; Calls `powertop --auto-tune' to reduce energy consumption. + + + +(define-configuration powertop-configuration + (powertop (package powertop) "PowerTOP package to use.")) + +(define powertop-shepherd-service + (match-lambda + (($ powertop) + (shepherd-service + (documentation "Tune kernel power settings at boot.") + (provision '(powertop powertop-auto-tune)) + (requirement '(user-processes)) + (one-shot? #t) + (start #~(lambda _ + (zero? (system* #$(file-append powertop "/sbin/powertop") + "--auto-tune")))))))) + +(define powertop-service-type + (service-type + (name 'powertop) + (extensions + (list + (service-extension shepherd-root-service-type + (compose list powertop-shepherd-service)))) + (compose concatenate) + (default-value (powertop-configuration)) + (description "Tune power-related kernel parameters to reduce energy consumption."))) -- 2.41.0 From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH 2/2] gnu: Correct package description. Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 14 Jan 2024 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68309@debbugs.gnu.org Cc: Ian Eure Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.17051928423354 (code B ref 68309); Sun, 14 Jan 2024 00:41:02 +0000 Received: (at 68309) by debbugs.gnu.org; 14 Jan 2024 00:40:42 +0000 Received: from localhost ([127.0.0.1]:41364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOoYL-0000s2-RT for submit@debbugs.gnu.org; Sat, 13 Jan 2024 19:40:42 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:34387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOoYH-0000rZ-GU for 68309@debbugs.gnu.org; Sat, 13 Jan 2024 19:40:38 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7B4D85C0113; Sat, 13 Jan 2024 19:40:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 13 Jan 2024 19:40:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1705192833; x= 1705279233; bh=ljUlfQP5YLSmrmtRdK6YmkiHaibElqJTI0Kp879Hm8E=; b=S 5aVXihtSMk3i1fgDy5EdcacX7eHnvoJ63emzJjw+4BVb66MLgIftqzxMa9DGQWHb 1l7LayhRXTqgUg5wnBmWzGYqJgaHWJsT6Mc1u2YgFS/P6VTxVGxDFHTi+A8Pec05 SsqvsKdjnc1efxKWTwOTklVlIzGDzFqYvvfkAqoumJG/k4vGtQeNRnMtLMLhCtEO 5S2mcPRidVQxy6/DWevyinN1WpOn1v709kwOk7mPNXfbPUAl6iIoV1q5aj/lqZwj sVMMbD6TTJ/lrBDnUvCJzIZ+A8JOe3UebJabVb4fCh72gQJAlb7T6e67zj8+EWHn wpybhDQbogWMJ8k1XIKUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1705192833; x= 1705279233; bh=ljUlfQP5YLSmrmtRdK6YmkiHaibElqJTI0Kp879Hm8E=; b=6 mzobsQJBQYyvQ0oaW4D7S2bLwKlObN1QLr5QZH5JZWeAHxrH8H2phgqgoCBMV977 wB9fqsdLq9Uz189lBABkHWYRJvl+8eKHXEtNveYK58poFcrBAZ/SX0bPN8NZvTC/ re9kXY/Txz64NrOaBL7XL0wlaJygdBPl12PsA9F5E10NK+jlI1/vuYs+JHjzsFq5 G5UX0Nw3yEHK7E/vedNud+X78pjNPf8IKXbY70AP0NXOn2xMFLI0/1b009tkqI0E V3YQJtwRGGuc0knkrcS93T3CutqYs5a1ilLfMP482zUmCA3H4DorJ1t09buWMAhR zkhNxRshj6uq987LkaZ+A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeikedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefkrghnucfguhhrvgcuoehirghnsehrvghtrhhoshhpvggt rdhtvheqnecuggftrfgrthhtvghrnhepgfeiveehgeeijeeifeekfedthfejudduhfduhe ehjeeuhfettdehkedthfegudeinecuffhomhgrihhnpedtuddrohhrghenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehirghnsehrvghtrhhosh hpvggtrdhtvh X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 13 Jan 2024 19:40:32 -0500 (EST) From: Ian Eure Date: Sat, 13 Jan 2024 16:40:18 -0800 Message-ID: <20240114004019.5019-2-ian@retrospec.tv> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240114004019.5019-1-ian@retrospec.tv> References: <20240114004019.5019-1-ian@retrospec.tv> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/packages/linux.scm (powertop): Correct package description. Change-Id: Ifc81ed62158df8b3c235d335731590e977dcc725 --- gnu/packages/linux.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 716f5907f0..3cd63df6ee 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -3634,7 +3634,7 @@ (define-public powertop (inputs (list kmod libnl ncurses pciutils zlib)) (home-page "https://01.org/powertop/") - (synopsis "Analyze power consumption on Intel-based laptops") + (synopsis "Analyze power consumption on x86-based laptops") (description "PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has -- 2.41.0 From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH 1/2] gnu: Add powertop-service-type. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Jan 2024 10:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ian Eure Cc: 68309@debbugs.gnu.org Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.170548655332608 (code B ref 68309); Wed, 17 Jan 2024 10:16:02 +0000 Received: (at 68309) by debbugs.gnu.org; 17 Jan 2024 10:15:53 +0000 Received: from localhost ([127.0.0.1]:50880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ2xd-0008TP-0O for submit@debbugs.gnu.org; Wed, 17 Jan 2024 05:15:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ2xc-0008JR-Cv for 68309@debbugs.gnu.org; Wed, 17 Jan 2024 05:15:52 -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 1rQ2xW-0000Ab-2e; Wed, 17 Jan 2024 05:15:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=51COeu+49A4leErFpaTCrtPRM4VJ7LTTT00WbYsx+qQ=; b=ZG3mUszsTuzojTozj7gN 9U7GKI9SnCDmyzW0wbZdduCuBlJ/ql/jxgI83eAE5UaQxBSona6MuTV+2rwRUBa673LdDgc8ewstq PXkukigajaZhCBti7f9S0d24HKZJkRFhT/3vn+TB/xtrabDZ5wAlgZVf49xXQ1j4u65E0ThvfVdnq dsg/F3puFDOwnAislHbLP26LTDGNzan9pWKJP74tJ/fFT6nchtOC3AsNGY5O8GMHsV1EjJ89Kzwrw MfWNC3z0VdGO30UZrzgbVI+5iJXnecYWWmnV7lTogwnAjE3dEpG30MJ9sVYzwueXrByKC89PWpNHL P7bj9lugumCSQg==; From: Mathieu Othacehe In-Reply-To: <20240114004019.5019-1-ian@retrospec.tv> (Ian Eure's message of "Sat, 13 Jan 2024 16:40:17 -0800") References: <20240107212122.21810-1-ian@retrospec.tv> <20240114004019.5019-1-ian@retrospec.tv> Date: Wed, 17 Jan 2024 11:15:44 +0100 Message-ID: <87a5p4jmen.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey, Thanks for the v2! > +The @code{(gnu services pm)} module provides a Guix service definition > +for PowerTOP. When started, it tunes kernel settings to reduce power > +consumption. I have this error when building the documentation: --8<---------------cut here---------------start------------->8--- guix.texi:34841: `@end' expected `lisp', but saw `defvar' --8<---------------cut here---------------end--------------->8--- > + > + > + Kill that extra line > +;;; > +;;; powertop > +;;; > +;;; Calls `powertop --auto-tune' to reduce energy consumption. > + > + That one too. > + (description "Tune power-related kernel parameters to reduce energy consumption."))) Wrap it to be under 78 characters. Thanks, Mathieu From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH v3] gnu: Add powertop-service-type. References: <20240107212122.21810-1-ian@retrospec.tv> In-Reply-To: <20240107212122.21810-1-ian@retrospec.tv> Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Jun 2024 18:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68309@debbugs.gnu.org Cc: Ian Eure Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.171726578118216 (code B ref 68309); Sat, 01 Jun 2024 18:17:01 +0000 Received: (at 68309) by debbugs.gnu.org; 1 Jun 2024 18:16:21 +0000 Received: from localhost ([127.0.0.1]:57379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDTHA-0004jk-M3 for submit@debbugs.gnu.org; Sat, 01 Jun 2024 14:16:21 -0400 Received: from wfout4-smtp.messagingengine.com ([64.147.123.147]:42195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDTH3-0004j4-Nt for 68309@debbugs.gnu.org; Sat, 01 Jun 2024 14:16:19 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.west.internal (Postfix) with ESMTP id 7EAE21C000AF; Sat, 1 Jun 2024 14:15:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 01 Jun 2024 14:15:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm3; t=1717265755; x=1717352155; bh=dM bKW8SE/go6ph/7Ku0UJ85ojxBwwMPZ0lsW+VDxsys=; b=a44ikf6HqvFUQUVFkU vCbCe/9IRDWDbMtvgy9nlBbZVJNdnkyjBuPWSROvwzEOJG/B7WprK2bWO1RV3iTQ 3rGGZgBgC8OTX2XBUWLUVOphzKBYnaq81Uj/oqzE2XXe7jJ9YvcwgMC/zzksL4n0 S2eEJJfDd30Vjgz6WimxcppjXZ9K7lXcbHUYncvqPo4awzXmQ8lJ+gg20GpQ7U+L 0Eto+i9eDGPOTKOzTs+0oID/THL5y2xe0iU9ccpLozRMLqyM2JVDKghVnDaiO887 9ZFwjTEABvpba79pIP/zVxv7wzwQIrn3UnTiDVsjFJQ7HcrbKc8HJwAinvyl1nz1 j65g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1717265755; x=1717352155; bh=dMbKW8SE/go6p h/7Ku0UJ85ojxBwwMPZ0lsW+VDxsys=; b=mGVflGCRC4AgqYG2Gnfbtu5nomVrX dN461n6oWdqYh/Mnk/wE2rcSifSfjBQVsC2XSO9jlK7fOHZ/N9QWABBChkuttYE6 IVcW0rWMjBq9Ik0oci+v3GAhoU90flHTo4Os03YJ6m/yt16xWhJ9DtGuBbPoZ90d gfw4VEgIEOF3SebxFXDvzae9ZuyjTVdqe6jcqRDxn6ErRag38OTKoOJ5dWCzKvhC /mc0L/cjeMb7izSel2dr2BeqeDlwbeFv7jPg3VHWWzK8qzHXgeMz1s/z5CCUMECT Ap7Q2Ho7YT1WHunFc07WyfKBvGUdCb7RiZnS657Kr6MwOKFWtpTydMXwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekkedguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofggtgfgsehtke ertdertdejnecuhfhrohhmpefkrghnucfguhhrvgcuoehirghnsehrvghtrhhoshhpvggt rdhtvheqnecuggftrfgrthhtvghrnhepjeeugfehgffffeethedvtdduudethfdvtdefud fhudfgvddvueelgfefhfehhfehnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnhesrhgvthhroh hsphgvtgdrthhv X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 1 Jun 2024 14:15:54 -0400 (EDT) From: Ian Eure Date: Sat, 1 Jun 2024 11:15:49 -0700 Message-ID: <20240601181549.16529-1-ian@retrospec.tv> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/services/pm.scm (powertop-shepherd-service): New variable. * gnu/services/pm.scm (powertop-service-type): New variable. * gnu/services/pm.scm (powertop-configuration): New variable. * doc/guix.texi (Power Management Services): Document powertop-service-type. Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a --- doc/guix.texi | 25 +++++++++++++++++++++++++ gnu/services/pm.scm | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1224104038..031a4e61c2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35375,6 +35375,31 @@ Ignore cpuid check for supported CPU models. @item @code{thermald} (default: @var{thermald}) Package object of thermald. +@cindex powertop +@cindex Power tuning with PowerTOP +@subsubheading PowerTOP + +The @code{(gnu services pm)} module provides a Guix service definition +for PowerTOP. When started, it tunes kernel settings to reduce power +consumption. + +@defvar powertop-service-type +The service type for PowerTOP. No configuration is necessary. When the +service starts, it executes @code{powertop --auto-tune}. + +@lisp +(service powertop-service-type) +@end lisp +@end defvar + +Available @code{powertop-configuration} fields are: + +@deftypevr {@code{powertop-configuration} parameter} package powertop +The PowerTOP package. Defaults to @code{powertop} in the @code{(gnu +packages linux)} module + +@end deftypevr + @end table @end deftp diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index 47f0bf7812..1793bc873d 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2024 Dariqq +;;; Copyright © 2024 Ian Eure ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +19,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services pm) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) @@ -37,7 +40,10 @@ (define-module (gnu services pm) tlp-configuration thermald-configuration - thermald-service-type)) + thermald-service-type + + powertop-configuration + powertop-service-type)) ;;; ;;; power-profiles-daemon @@ -524,3 +530,37 @@ (define thermald-service-type (default-value (thermald-configuration)) (description "Run thermald, a CPU frequency scaling service that helps prevent overheating."))) + + + +;;; +;;; powertop +;;; +;;; Calls `powertop --auto-tune' to reduce energy consumption. + +(define-configuration powertop-configuration + (powertop (package powertop) "PowerTOP package to use.")) + +(define powertop-shepherd-service + (match-lambda + (($ powertop) + (shepherd-service + (documentation "Tune kernel power settings at boot.") + (provision '(powertop powertop-auto-tune)) + (requirement '(user-processes)) + (one-shot? #t) + (start #~(lambda _ + (zero? (system* #$(file-append powertop "/sbin/powertop") + "--auto-tune")))))))) + +(define powertop-service-type + (service-type + (name 'powertop) + (extensions + (list + (service-extension shepherd-root-service-type + (compose list powertop-shepherd-service)))) + (compose concatenate) + (default-value (powertop-configuration)) + (description "Tune power-related kernel parameters to reduce energy + consumption."))) -- 2.45.1 From unknown Sat Aug 16 13:49:26 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#68309] [PATCH 1/2] gnu: Add powertop-service-type. Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Jun 2024 18:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68309 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 68309@debbugs.gnu.org Received: via spool by 68309-submit@debbugs.gnu.org id=B68309.171726604218639 (code B ref 68309); Sat, 01 Jun 2024 18:21:01 +0000 Received: (at 68309) by debbugs.gnu.org; 1 Jun 2024 18:20:42 +0000 Received: from localhost ([127.0.0.1]:57389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDTLN-0004qY-VB for submit@debbugs.gnu.org; Sat, 01 Jun 2024 14:20:42 -0400 Received: from wfout4-smtp.messagingengine.com ([64.147.123.147]:42179) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDTLM-0004qL-Bz for 68309@debbugs.gnu.org; Sat, 01 Jun 2024 14:20:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.west.internal (Postfix) with ESMTP id E75151C000AF; Sat, 1 Jun 2024 14:20:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 01 Jun 2024 14:20:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1717266022; x=1717352422; bh=/pskQJRQmtOUIGYWjDc0PRLhZp+vbuJmIpfZfqepkrw=; b= U5HwBQSKRHkF2rhIGcqnKd7+RVNZhktfHuXwJ+9ofpEMyfjOXeOTps5FvaPuZlsS lXNMHnF2L0R2b67q5Lv1dcoOJVJKPhW4Udhxa1Gn/x2WEeQ2jRdfK0C2r1/kBW6+ qUUSoy9zsp6pJj10wKjvB4r0vmNB09BNoad7TcBM0/lt2iA2kPhKzGGrb1zPr/Lm v97bXhwalbcFLzx1nTWn9P9Q7zV9daY/rrNdCMslAOtR3RsVYNFCEkS/cyR8cZVU OJHO4UTfcC/3SoogUKsLBfF6a3gYeTGO2ugml3oTgfb9jgdBK47UBrsrBhe6NF2h SEn4qY9viZsKEcHA5TXsLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717266022; x= 1717352422; bh=/pskQJRQmtOUIGYWjDc0PRLhZp+vbuJmIpfZfqepkrw=; b=L ypK8i0ffN6lxnEW4ipFVKX0/0VOaqT3ZJlGnWn2TRkbtWRZq9RZ1DxRRT/PJyIYA PymMLfnpMaD7kupiG/inv7rdmK4Adz+Eo0aX27DxDscUaACLQUQpDjNIsJd9ZRyf PnEJKKgEJzodjqAUsP1wlsUbLajiSzL/jo7ujWmt/5eftfRl/azalvL362WcOYl6 HmKaUN/7wG+AtfeRZhWDd/5c8KnsEVTeMr3ALrF8pOtQzAlKkgkYrLtQeN83PelN jf+dztcr03TcTyrj3S3NP+MGVJCaggqrXWDNawmWQjJhvBxI5Co104T0SfG3/LME otgBXH18KNOxmWLUpS5BA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekkedguddvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepkfgr nhcugfhurhgvuceoihgrnhesrhgvthhrohhsphgvtgdrthhvqeenucggtffrrghtthgvrh hnpefhleevtdeifeffgfegiedvueekudettdevjeffhfelieelfeehgefgudfgieeuhfen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehirghnse hrvghtrhhoshhpvggtrdhtvh X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 1 Jun 2024 14:20:21 -0400 (EDT) References: <20240107212122.21810-1-ian@retrospec.tv> <20240114004019.5019-1-ian@retrospec.tv> <87a5p4jmen.fsf@gnu.org> User-agent: mu4e 1.8.13; emacs 28.2 From: Ian Eure Date: Sat, 01 Jun 2024 11:18:28 -0700 In-reply-to: <87a5p4jmen.fsf@gnu.org> Message-ID: <87wmn8tti3.fsf@meson> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Mathieu, Sorry for the extremely late response on this. Mathieu Othacehe writes: > Hey, > > Thanks for the v2! > >> +The @code{(gnu services pm)} module provides a Guix service=20 >> definition >> +for PowerTOP. When started, it tunes kernel settings to=20 >> reduce power >> +consumption. > > I have this error when building the documentation: > > guix.texi:34841: `@end' expected `lisp', but saw `defvar' > Fixed in v3, which I just sent. >> + >> + >> + > > Kill that extra line > This matches the style used by every other package in the module,=20 so I believe it should stay how it is. >> +;;; >> +;;; powertop >> +;;; >> +;;; Calls `powertop --auto-tune' to reduce energy consumption. >> + >> + > > That one too. > Done. >> + (description "Tune power-related kernel parameters to=20 >> reduce energy consumption."))) > > Wrap it to be under 78 characters. > Done. =E2=80=94 Ian From unknown Sat Aug 16 13:49:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ian Eure Subject: bug#68309: closed (Re: [bug#68309] [PATCH v3] gnu: Add powertop-service-type.) Message-ID: References: <874j3yq962.fsf@gnu.org> <20240107212122.21810-1-ian@retrospec.tv> X-Gnu-PR-Message: they-closed 68309 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 68309@debbugs.gnu.org Date: Sat, 23 Nov 2024 15:10:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1732374602-14001-1" This is a multi-part message in MIME format... ------------=_1732374602-14001-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #68309: [PATCH] gnu: Add powertop-service-type. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 68309@debbugs.gnu.org. --=20 68309: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D68309 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1732374602-14001-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 68309-done) by debbugs.gnu.org; 23 Nov 2024 15:09:22 +0000 Received: from localhost ([127.0.0.1]:58609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tErlB-0003cg-P5 for submit@debbugs.gnu.org; Sat, 23 Nov 2024 10:09:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tErl9-0003cR-J4 for 68309-done@debbugs.gnu.org; Sat, 23 Nov 2024 10:09:20 -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 1tErl4-0004w3-3x; Sat, 23 Nov 2024 10:09:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=10q8klO2jp8Dh+01I2hmg3rv/UQhiIaouH0bBMh1GA8=; b=CKALbd1O27AZ75XtAndn xXjP2Ez7xCPI6ShIzDkp+GUPj0l5QvnXvcBR35RTHkWAfVSgSDKR3gZZysgxLhDIKbT75NdPTifyW BC+IHIMtvngVQXc9kMEkFpaf5JtLUeQ22V/4+itQmo5XHyoU4LfEGfnlnGOjftL4gbplDmJrzKGPg niwKyTqHpMR8KqX1VPxgxBVqIwrbm6NUtOj9fX4WC/5VdMdrOG/X3YZ0fax0zz/fz9luoCuseb3zo 2KFMLH+GBbf9KzXnZOZUM6YmIliCWlJUYiqiW7D4QdUN/ItV0fm5PFg05CJU9gr1ojx6oZ618CoTh m87UsrfeW8KXfg==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ian Eure Subject: Re: [bug#68309] [PATCH v3] gnu: Add powertop-service-type. In-Reply-To: <20240601181549.16529-1-ian@retrospec.tv> (Ian Eure's message of "Sat, 1 Jun 2024 11:15:49 -0700") References: <20240107212122.21810-1-ian@retrospec.tv> <20240601181549.16529-1-ian@retrospec.tv> Date: Sat, 23 Nov 2024 16:09:09 +0100 Message-ID: <874j3yq962.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68309-done Cc: 68309-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ian, Ian Eure skribis: > * gnu/services/pm.scm (powertop-shepherd-service): New variable. > * gnu/services/pm.scm (powertop-service-type): New variable. > * gnu/services/pm.scm (powertop-configuration): New variable. > * doc/guix.texi (Power Management Services): Document powertop-service-ty= pe. > > Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a Applied with the tweaks below. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/guix.texi b/doc/guix.texi index d421d422a8..454dd66c18 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35800,13 +35800,14 @@ Power Management Services @item @code{thermald} (default: @var{thermald}) Package object of thermald. -@cindex powertop -@cindex Power tuning with PowerTOP +@cindex PowerTOP +@cindex power consumption tuning with PowerTOP @subsubheading PowerTOP -The @code{(gnu services pm)} module provides a Guix service definition -for PowerTOP. When started, it tunes kernel settings to reduce power -consumption. +The @code{(gnu services pm)} module also provides a service definition +for @uref{https://01.org/powertop/, PowerTOP}, a power consumption +analysis and tuning tool. When started, it tunes Linux kernel settings +to reduce power consumption. @defvar powertop-service-type The service type for PowerTOP. No configuration is necessary. When the --=-=-=-- ------------=_1732374602-14001-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Jan 2024 21:22:03 +0000 Received: from localhost ([127.0.0.1]:34031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMaao-0004sL-VS for submit@debbugs.gnu.org; Sun, 07 Jan 2024 16:22:03 -0500 Received: from lists.gnu.org ([2001:470:142::17]:38210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMaan-0004rs-Bo for submit@debbugs.gnu.org; Sun, 07 Jan 2024 16:22:01 -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 1rMaac-0002iV-9Z for guix-patches@gnu.org; Sun, 07 Jan 2024 16:21:50 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMaaa-0000Xh-25 for guix-patches@gnu.org; Sun, 07 Jan 2024 16:21:50 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 38DF65C122F; Sun, 7 Jan 2024 16:21:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 07 Jan 2024 16:21:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1704662505; x=1704748905; bh=Lk BAkNAoPU8qGkNgRcp5oABL3L3fpCu+Zc7z3MxBMrw=; b=SYg+tPkHKkAJ+FWOYE WPB+A3bWsOAUQMEQ6SksK0FN7qeRU8xCpakhaAPc8tfpqyt96hP2XXtc6pPFj1Sk yjsG5Yp1pG4W2eJfnJGgg3aBFW/irb19sKF7Y0t3LBUhst06x2iAssBLS/yOPplm 1+Y8u5ZYFAuJbOBMgX6ivpFJDq0Kbosmc8OBNYXjPSt9egGJqyqHJkPtUs8AIL3+ gSVm/CA0t/nGfQNMT4nybxTh/1/+HuwPMLZ1J0sFIjCEVbMkNMP6g1CPn1r8I/wU x3NsJuGYW3VCXtaFSVWIMKCBRWPxG0KIjbBfPVITzJmRKDChhQ+RsIUFOZe/Ql59 jEUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1704662505; x=1704748905; bh=LkBAkNAoPU8qG kNgRcp5oABL3L3fpCu+Zc7z3MxBMrw=; b=xnKkGtsQnVkLeeBrdTgGMy6iBz67y PTqV65eF8SIej/THu+zgqHojkCiM0jIqbk3JfI8IrLdVPA17+nyeBOE+Xq1uY0y/ Ku5+fRwdcuz/LY/Z2EkH2skWh2XLgqMiUHvpSV6ovpkpw1G3hW+abn1Ajy4p0O0X v29uUK5TnJiWHaFQ3bSZIEDliuk3trZ/gyV0wq7zNVbh0QIOtB+NlydjUMlcc04w /Z6Zm+PnRfqhgHmkQmKU4+7JaSL27mBRxk3fAv4fxPgQWIfS4N0MM/lVlBQ8QnC9 HR6oLS/YWrBYpYNyuE1R3u3FpAGtDBRrdHV1XpRYO0sA4i4D59xaruH2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehgedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffogggtgfesthekre dtredtjeenucfhrhhomhepkfgrnhcugfhurhgvuceoihgrnhesrhgvthhrohhsphgvtgdr thhvqeenucggtffrrghtthgvrhhnpeelhffgteelveejjeelffekhfehgfehtdefgfduvd duieffjedugedvhfevjeetteenucffohhmrghinheptddurdhorhhgpdhgnhhurdhorhhg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnh esrhgvthhrohhsphgvtgdrthhv X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 7 Jan 2024 16:21:44 -0500 (EST) From: Ian Eure To: guix-patches@gnu.org Subject: [PATCH] gnu: Add powertop-service-type. Date: Sun, 7 Jan 2024 13:21:21 -0800 Message-ID: <20240107212122.21810-1-ian@retrospec.tv> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: ( , Christopher Baines , Ludovic Courtès , Mathieu Othacehe , Raghav Gururajan , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice , jgart Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=66.111.4.25; envelope-from=ian@retrospec.tv; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit Cc: Ian Eure X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) * gnu/services/pm.scm (powertop-shepherd-service): New variable. * gnu/services/pm.scm (powertop-service-type): New variable. * gnu/services/pm.scm (powertop-configuration): New variable. * gnu/packages/linux.scm (powertop): Correct package description. * doc/guix.texi (Power Management Services): Document powertop-service-type. Change-Id: I1c5ef855526458ad54f62ca6e755da82acce1c4a --- doc/guix.texi | 24 +++++++++++++++++++++++ gnu/packages/linux.scm | 2 +- gnu/services/pm.scm | 43 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a648a106b3..e95ae140f2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34755,6 +34755,30 @@ Ignore cpuid check for supported CPU models. @item @code{thermald} (default: @var{thermald}) Package object of thermald. +@cindex powertop +@cindex Power tuning with PowerTOP +@subsubheading PowerTOP + +The @code{(gnu services pm)} module provides a Guix service definition +for PowerTOP. When started, it tunes kernel settings to reduce power +consumption. + +@defvar powertop-service-type +The service type for PowerTOP. No configuration is necessary. When the +service starts, it executes @code{powertop --auto-tune}. + +@lisp +(service powertop-service-type) + +@end defvar + +Available @code{powertop-configuration} fields are: + +@deftypevr {@code{powertop-configuration} parameter} package powertop +The PowerTOP package. Defaults to @code{powertop}. + +@end deftypevr + @end table @end deftp diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0fe64bacf3..c53d8f82bd 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -3634,7 +3634,7 @@ (define-public powertop (inputs (list kmod libnl ncurses pciutils zlib)) (home-page "https://01.org/powertop/") - (synopsis "Analyze power consumption on Intel-based laptops") + (synopsis "Analyze power consumption on x86-based laptops") (description "PowerTOP is a Linux tool to diagnose issues with power consumption and power management. In addition to being a diagnostic tool, PowerTOP also has diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm index 3daf484cc1..13a153ab1d 100644 --- a/gnu/services/pm.scm +++ b/gnu/services/pm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2024 Ian Eure ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,6 +18,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services pm) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) @@ -31,7 +34,10 @@ (define-module (gnu services pm) tlp-configuration thermald-configuration - thermald-service-type)) + thermald-service-type + + powertop-configuration + powertop-service-type)) (define (uglify-field-name field-name) (let ((str (symbol->string field-name))) @@ -466,3 +472,38 @@ (define thermald-service-type (default-value (thermald-configuration)) (description "Run thermald, a CPU frequency scaling service that helps prevent overheating."))) + + + +;;; +;;; powertop +;;; +;;; Calls `powertop --auto-tune' to reduce energy consumption. + + + +(define-configuration powertop-configuration + (powertop (package powertop) "PowerTOP package to use.")) + +(define powertop-shepherd-service + (match-lambda + (($ powertop) + (shepherd-service + (documentation "Tune kernel power settings at boot.") + (provision '(powertop powertop-auto-tune)) + (requirement '(user-processes)) + (one-shot? #t) + (start #~(lambda _ + (zero? (system* #$(file-append powertop "/sbin/powertop") + "--auto-tune")))))))) + +(define powertop-service-type + (service-type + (name 'powertop) + (extensions + (list + (service-extension shepherd-root-service-type + (compose list powertop-shepherd-service)))) + (compose concatenate) + (default-value (powertop-configuration)) + (description "Tune power-related kernel parameters to reduce energy consumption."))) -- 2.41.0 ------------=_1732374602-14001-1--