unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#35345] [PATCH 0/2] Add missing run-time dependency for TLP (Power management tool for Linux).
@ 2019-04-20 16:26 Stefan Stefanović
  2019-04-20 16:45 ` [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy Stefan Stefanović
  2019-04-20 16:48 ` [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency Stefan Stefanović
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Stefanović @ 2019-04-20 16:26 UTC (permalink / raw)
  To: 35345

Hello.

The first patch will add system (arch-kernel) specific
x86-energy-perf-policy package,
and the second patch will adjust TLP package to use
x86-energy-perf-policy as a optional/system-specific run-time
dependency.

To understand my motivation please take a look at:
- https://linrunner.de/en/tlp/docs/tlp-configuration.html#scaling
the section explaining ENERGY_PERF_POLICY_ON_AC parameter has the
following note:
"Important: this setting requires the kernel module msr and the tool
x86_energy_perf_policy matching your kernel version."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy
  2019-04-20 16:26 [bug#35345] [PATCH 0/2] Add missing run-time dependency for TLP (Power management tool for Linux) Stefan Stefanović
@ 2019-04-20 16:45 ` Stefan Stefanović
  2019-05-27 14:35   ` Ludovic Courtès
  2019-04-20 16:48 ` [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency Stefan Stefanović
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Stefanović @ 2019-04-20 16:45 UTC (permalink / raw)
  To: 35345

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-gnu-Add-x86-energy-perf-policy.patch --]
[-- Type: text/x-patch, Size: 2128 bytes --]

From 79d021f7bd686159ad9cf4dd2f94c360b2a21ae4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Sat, 20 Apr 2019 15:37:13 +0200
Subject: [PATCH 1/2] gnu: Add x86-energy-perf-policy.

* gnu/packages/linux.scm (cpupower): New variable.
---
 gnu/packages/linux.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index b562a23b2f..88905b6b74 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3889,6 +3889,40 @@ Linux kernel to retrieve and control processor features related to power saving,
 such as frequency and voltage scaling.")
     (license license:gpl2)))
 
+(define-public x86-energy-perf-policy
+  (package
+   (name "x86-energy-perf-policy")
+   (version (package-version linux-libre))
+   (source (package-source linux-libre))
+   (build-system gnu-build-system)
+   (arguments
+    '(#:tests? #f
+      #:phases
+      (modify-phases
+       %standard-phases
+       (add-after 'unpack 'enter-subdirectory
+                  (lambda _
+                    (chdir "tools/power/x86/x86_energy_perf_policy")
+                    #t))
+       (delete 'configure)
+       (add-before 'build 'fix-makefile
+                   (lambda _
+                     (substitute* "Makefile" (("/usr") ""))
+                     #t)))
+      #:make-flags
+      (let ((out (assoc-ref %outputs "out")))
+        (list (string-append "DESTDIR=" out)
+              (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
+   (supported-systems '("i686-linux" "x86_64-linux"))
+   (home-page (package-home-page linux-libre))
+   (synopsis "Display and update Intel-CPU energy-performance policy")
+   (description
+    "@command{x86_energy_perf_policy} displays and updates
+energy-performance policy settings specific to Intel Architecture Processors.
+Settings are accessed via Model Specific Register (MSR) updates,
+no matter if the Linux cpufreq sub-system is enabled or not.")
+   (license license:gpl2)))
+
 (define-public haveged
   (package
     (name "haveged")
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency.
  2019-04-20 16:26 [bug#35345] [PATCH 0/2] Add missing run-time dependency for TLP (Power management tool for Linux) Stefan Stefanović
  2019-04-20 16:45 ` [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy Stefan Stefanović
@ 2019-04-20 16:48 ` Stefan Stefanović
  2019-05-27 14:43   ` bug#35345: " Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Stefanović @ 2019-04-20 16:48 UTC (permalink / raw)
  To: 35345

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0002-gnu-tlp-Add-required-x86-energy-perf-policy-input-de.patch --]
[-- Type: text/x-patch, Size: 5041 bytes --]

From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Sat, 20 Apr 2019 16:13:37 +0200
Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
 dependency.

* gnu/packages/linux.scm (tlp)
[inputs]: Add system specific x86-energy-perf-policy dependency.
[arguments]<#:phases>['wrap]:
Adjust bin-directory procedure to return #f on missing input,
a guard against system specific input dependencies.
Filter only strings in the path list. Reformat for-each block.
Add x86-energy-perf-policy in bin-directory input-name list.
---
 gnu/packages/linux.scm | 56 ++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 88905b6b74..aa0eeef1b0 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4451,7 +4451,11 @@ interface in sysfs, which can be accomplished with the included udev rules.")
               ("sed" ,sed)
               ("usbutils" ,usbutils)
               ("util-linux" ,util-linux)
-              ("wireless-tools" ,wireless-tools)))
+              ("wireless-tools" ,wireless-tools)
+              ,@(if (member (or (%current-target-system) (%current-system))
+                            (package-supported-systems x86-energy-perf-policy))
+                    `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
+                    '())))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -4488,31 +4492,35 @@ interface in sysfs, which can be accomplished with the included udev rules.")
              (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
                     (bin-files (find-files bin ".*")))
                (define (bin-directory input-name)
-                 (string-append (assoc-ref inputs input-name) "/bin"))
+                 (let ((p (assoc-ref inputs input-name)))
+                   (and p (string-append p "/bin"))))
                (define (sbin-directory input-name)
                  (string-append (assoc-ref inputs input-name) "/sbin"))
-               (for-each (lambda (program)
-                           (wrap-program program
-                             `("PATH" ":" prefix
-                               ,(append
-                                 (map bin-directory '("bash"
-                                                      "coreutils"
-                                                      "dbus"
-                                                      "eudev"
-                                                      "grep"
-                                                      "inetutils"
-                                                      "kmod"
-                                                      "perl"
-                                                      "sed"
-                                                      "usbutils"
-                                                      "util-linux"))
-                                 (map sbin-directory '("ethtool"
-                                                       "hdparm"
-                                                       "iw"
-                                                       "pciutils"
-                                                       "rfkill"
-                                                       "wireless-tools"))))))
-                         bin-files)
+               (for-each
+                (lambda (program)
+                  (wrap-program program
+                    `("PATH" ":" prefix
+                      ,(filter string?
+                               (append
+                                (map bin-directory '("bash"
+                                                     "coreutils"
+                                                     "dbus"
+                                                     "eudev"
+                                                     "grep"
+                                                     "inetutils"
+                                                     "kmod"
+                                                     "perl"
+                                                     "sed"
+                                                     "usbutils"
+                                                     "util-linux"
+                                                     "x86-energy-perf-policy"))
+                                (map sbin-directory '("ethtool"
+                                                      "hdparm"
+                                                      "iw"
+                                                      "pciutils"
+                                                      "rfkill"
+                                                      "wireless-tools")))))))
+                bin-files)
                #t))))))
     (home-page "http://linrunner.de/en/tlp/tlp.html")
     (synopsis "Power management tool for Linux")
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy
  2019-04-20 16:45 ` [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy Stefan Stefanović
@ 2019-05-27 14:35   ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2019-05-27 14:35 UTC (permalink / raw)
  To: Stefan Stefanović; +Cc: 35345

Hi Stefan,

Stefan Stefanović <stefanx2ovic@gmail.com> skribis:

> From 79d021f7bd686159ad9cf4dd2f94c360b2a21ae4 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
> Date: Sat, 20 Apr 2019 15:37:13 +0200
> Subject: [PATCH 1/2] gnu: Add x86-energy-perf-policy.
>
> * gnu/packages/linux.scm (cpupower): New variable.

I fixed up indentation, added a copyright line for you, and committed.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#35345: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency.
  2019-04-20 16:48 ` [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency Stefan Stefanović
@ 2019-05-27 14:43   ` Ludovic Courtès
  2019-05-28 18:21     ` [bug#35345] " Stefan Stefanović
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2019-05-27 14:43 UTC (permalink / raw)
  To: Stefan Stefanović; +Cc: 35345-done

Hi,

Stefan Stefanović <stefanx2ovic@gmail.com> skribis:

> From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
> Date: Sat, 20 Apr 2019 16:13:37 +0200
> Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
>  dependency.
>
> * gnu/packages/linux.scm (tlp)
> [inputs]: Add system specific x86-energy-perf-policy dependency.
> [arguments]<#:phases>['wrap]:
> Adjust bin-directory procedure to return #f on missing input,
> a guard against system specific input dependencies.
> Filter only strings in the path list. Reformat for-each block.
> Add x86-energy-perf-policy in bin-directory input-name list.

I reworded it to use ‘filter-map’ intead of (filter string? …).

> +              ,@(if (member (or (%current-target-system) (%current-system))
> +                            (package-supported-systems x86-energy-perf-policy))

This would not work, because ‘%current-target-system’ returns a
“triplet”, not a “system type”, so I’ve also rephrased it.

Let me know if something’s broken!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency.
  2019-05-27 14:43   ` bug#35345: " Ludovic Courtès
@ 2019-05-28 18:21     ` Stefan Stefanović
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Stefanović @ 2019-05-28 18:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 35345-done

Hi,

The patch you made works fine on my system.
Sorry for the late response.

Your work on correcting, improving and applying my original patch is
appreciated,
thank you.

Stefan.

On 5/27/19, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi,
>
> Stefan Stefanović <stefanx2ovic@gmail.com> skribis:
>
>> From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
>> Date: Sat, 20 Apr 2019 16:13:37 +0200
>> Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
>>  dependency.
>>
>> * gnu/packages/linux.scm (tlp)
>> [inputs]: Add system specific x86-energy-perf-policy dependency.
>> [arguments]<#:phases>['wrap]:
>> Adjust bin-directory procedure to return #f on missing input,
>> a guard against system specific input dependencies.
>> Filter only strings in the path list. Reformat for-each block.
>> Add x86-energy-perf-policy in bin-directory input-name list.
>
> I reworded it to use ‘filter-map’ intead of (filter string? …).
>
>> +              ,@(if (member (or (%current-target-system)
>> (%current-system))
>> +                            (package-supported-systems
>> x86-energy-perf-policy))
>
> This would not work, because ‘%current-target-system’ returns a
> “triplet”, not a “system type”, so I’ve also rephrased it.
>
> Let me know if something’s broken!
>
> Thanks,
> Ludo’.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-28 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-20 16:26 [bug#35345] [PATCH 0/2] Add missing run-time dependency for TLP (Power management tool for Linux) Stefan Stefanović
2019-04-20 16:45 ` [bug#35345] [PATCH 1/2] gnu: Add x86-energy-perf-policy Stefan Stefanović
2019-05-27 14:35   ` Ludovic Courtès
2019-04-20 16:48 ` [bug#35345] [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency Stefan Stefanović
2019-05-27 14:43   ` bug#35345: " Ludovic Courtès
2019-05-28 18:21     ` [bug#35345] " Stefan Stefanović

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).