* [PATCH 1/3] cpupower: do not write DESTDIR to cpupower.service
2025-05-13 16:29 [PATCH 0/3] cpupower: fixes for cpupower.service Francesco Poli (wintermute)
@ 2025-05-13 16:29 ` Francesco Poli (wintermute)
2025-05-13 16:29 ` [PATCH 2/3] cpupower: do not call systemctl at install time Francesco Poli (wintermute)
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Francesco Poli (wintermute) @ 2025-05-13 16:29 UTC (permalink / raw)
To: linux-pm list
Cc: Francesco Poli, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
John Kacur, Thorsten Leemhuis, Justin Forbes
Fix the use of DESTDIR variable in the Makefile, as far as the
installation of the systemd service unit 'cpupower.service' is
concerned.
This was caused by a misunderstanding about the purpose of the DESTDIR
variable in the Makefile, which is instead meant to support staged
installations: its value should not end up into installed file contents.
Link: https://lore.kernel.org/linux-pm/20250509002206.bd2519ba52035d47c3c32aa6@paranoici.org/T/#mfbb938f9c0d5a21173acb92a061eb9205fd0abfe
Link: https://www.gnu.org/prep/standards/html_node/DESTDIR.html
Fixes: 9c70b779ad91 ("cpupower: add a systemd service to run cpupower")
Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
---
tools/power/cpupower/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 9c2b5f71fee1..4ad931509eaa 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -310,7 +310,7 @@ install-tools: $(OUTPUT)cpupower
$(INSTALL) -d $(DESTDIR)${libexecdir}
$(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower'
$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
- sed 's|___CDIR___|$(DESTDIR)${confdir}|; s|___LDIR___|$(DESTDIR)${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
+ sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
$(SETPERM_DATA) '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
if test -d /run/systemd/system; then systemctl daemon-reload; fi
base-commit: 99d2fce9b44dec6d270b85a7d28cdc99aaa93da6
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] cpupower: do not call systemctl at install time
2025-05-13 16:29 [PATCH 0/3] cpupower: fixes for cpupower.service Francesco Poli (wintermute)
2025-05-13 16:29 ` [PATCH 1/3] cpupower: do not write DESTDIR to cpupower.service Francesco Poli (wintermute)
@ 2025-05-13 16:29 ` Francesco Poli (wintermute)
2025-05-13 16:29 ` [PATCH 3/3] cpupower: do not install files to /etc/default/ Francesco Poli (wintermute)
2025-05-13 22:09 ` [PATCH 0/3] cpupower: fixes for cpupower.service Shuah Khan
3 siblings, 0 replies; 5+ messages in thread
From: Francesco Poli (wintermute) @ 2025-05-13 16:29 UTC (permalink / raw)
To: linux-pm list
Cc: Francesco Poli, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
John Kacur, Thorsten Leemhuis, Justin Forbes
Fix the installation procedure for the systemd service unit
'cpupower.service'. Do not call "systemctl daemon-reload" in the
Makefile, but explain when this command should be manually issued
in the README file.
Link: https://lore.kernel.org/linux-pm/20250509002206.bd2519ba52035d47c3c32aa6@paranoici.org/T/#mfbb938f9c0d5a21173acb92a061eb9205fd0abfe
Fixes: 9c70b779ad91 ("cpupower: add a systemd service to run cpupower")
Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
---
tools/power/cpupower/Makefile | 2 --
tools/power/cpupower/README | 19 ++++++++++++++-----
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 4ad931509eaa..7cec2c30f98a 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -312,7 +312,6 @@ install-tools: $(OUTPUT)cpupower
$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
sed 's|___CDIR___|${confdir}|; s|___LDIR___|${libexecdir}|' cpupower.service.in > '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
$(SETPERM_DATA) '$(DESTDIR)${libdir}/systemd/system/cpupower.service'
- if test -d /run/systemd/system; then systemctl daemon-reload; fi
install-man:
$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
@@ -360,7 +359,6 @@ uninstall:
- for HLANG in $(LANGUAGES); do \
rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
done;
- - if test -d /run/systemd/system; then systemctl daemon-reload; fi
help:
@echo 'Building targets:'
diff --git a/tools/power/cpupower/README b/tools/power/cpupower/README
index e6ae7c1e0a0d..494104de1540 100644
--- a/tools/power/cpupower/README
+++ b/tools/power/cpupower/README
@@ -59,7 +59,7 @@ $ sudo make install
-----------------------------------------------------------------------
| man pages | /usr/man |
-----------------------------------------------------------------------
-| systemd service | /usr/lib |
+| systemd service | /usr/lib/systemd/system |
-----------------------------------------------------------------------
| systemd support script | /usr/libexec |
-----------------------------------------------------------------------
@@ -113,7 +113,7 @@ The files will be installed to the following dirs:
-----------------------------------------------------------------------
| man pages | ${DESTDIR}/usr/man |
-----------------------------------------------------------------------
-| systemd service | ${DESTDIR}/usr/lib |
+| systemd service | ${DESTDIR}/usr/lib/systemd/system |
-----------------------------------------------------------------------
| systemd support script | ${DESTDIR}/usr/libexec |
-----------------------------------------------------------------------
@@ -185,11 +185,20 @@ systemd service
---------------
A systemd service is also provided to run the cpupower utility at boot with
-settings read from a configuration file. In order to enable this systemd
-service, edit '${DESTDIR}/etc/default/cpupower' (uncommenting at least one of
-the options, depending on your preferences) and then issue the following
+settings read from a configuration file.
+
+If you want systemd to find the new service after the installation, the service
+unit must have been installed in one of the system unit search path directories
+(such as '/usr/lib/systemd/system/', which is the default location) and (unless
+you are willing to wait for the next reboot) you need to issue the following
command:
+$ sudo systemctl daemon-reload
+
+If you want to enable this systemd service, edit
+'${DESTDIR}/etc/default/cpupower' (uncommenting at least one of the options,
+depending on your preferences) and then issue the following command:
+
$ sudo systemctl enable --now cpupower.service
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] cpupower: do not install files to /etc/default/
2025-05-13 16:29 [PATCH 0/3] cpupower: fixes for cpupower.service Francesco Poli (wintermute)
2025-05-13 16:29 ` [PATCH 1/3] cpupower: do not write DESTDIR to cpupower.service Francesco Poli (wintermute)
2025-05-13 16:29 ` [PATCH 2/3] cpupower: do not call systemctl at install time Francesco Poli (wintermute)
@ 2025-05-13 16:29 ` Francesco Poli (wintermute)
2025-05-13 22:09 ` [PATCH 0/3] cpupower: fixes for cpupower.service Shuah Khan
3 siblings, 0 replies; 5+ messages in thread
From: Francesco Poli (wintermute) @ 2025-05-13 16:29 UTC (permalink / raw)
To: linux-pm list
Cc: Francesco Poli, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
John Kacur, Thorsten Leemhuis, Justin Forbes
Improve the installation procedure for the systemd service unit
'cpupower.service', to be more distro-agnostic. Do not install the
service unit configuration file to /etc/default/ (a directory that
is used by Debian and Debian-derivatives and only rarely by other
distros).
Also, clarify the role of the configuration file in its own comments.
Link: https://lore.kernel.org/linux-pm/20250509002206.bd2519ba52035d47c3c32aa6@paranoici.org/T/#ma8a3fa80acc4036af6c754e8ecabacc55b288ad1
Fixes: 9c70b779ad91 ("cpupower: add a systemd service to run cpupower")
Signed-off-by: Francesco Poli (wintermute) <invernomuto@paranoici.org>
---
tools/power/cpupower/Makefile | 6 +++---
tools/power/cpupower/README | 6 +++---
.../{cpupower.default => cpupower-service.conf} | 10 +++++++---
tools/power/cpupower/cpupower.service.in | 4 ++--
4 files changed, 15 insertions(+), 11 deletions(-)
rename tools/power/cpupower/{cpupower.default => cpupower-service.conf} (67%)
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 7cec2c30f98a..be8dfac14076 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -305,8 +305,8 @@ install-tools: $(OUTPUT)cpupower
$(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir}
$(INSTALL) -d $(DESTDIR)${bash_completion_dir}
$(INSTALL_SCRIPT) cpupower-completion.sh '$(DESTDIR)${bash_completion_dir}/cpupower'
- $(INSTALL) -d $(DESTDIR)${confdir}default
- $(INSTALL_DATA) cpupower.default '$(DESTDIR)${confdir}default/cpupower'
+ $(INSTALL) -d $(DESTDIR)${confdir}
+ $(INSTALL_DATA) cpupower-service.conf '$(DESTDIR)${confdir}'
$(INSTALL) -d $(DESTDIR)${libexecdir}
$(INSTALL_PROGRAM) cpupower.sh '$(DESTDIR)${libexecdir}/cpupower'
$(INSTALL) -d $(DESTDIR)${libdir}/systemd/system
@@ -346,7 +346,7 @@ uninstall:
- rm -f $(DESTDIR)${includedir}/cpufreq.h
- rm -f $(DESTDIR)${includedir}/cpuidle.h
- rm -f $(DESTDIR)${bindir}/utils/cpupower
- - rm -f $(DESTDIR)${confdir}default/cpupower
+ - rm -f $(DESTDIR)${confdir}cpupower-service.conf
- rm -f $(DESTDIR)${libexecdir}/cpupower
- rm -f $(DESTDIR)${libdir}/systemd/system/cpupower.service
- rm -f $(DESTDIR)${mandir}/man1/cpupower.1
diff --git a/tools/power/cpupower/README b/tools/power/cpupower/README
index 494104de1540..9de449469568 100644
--- a/tools/power/cpupower/README
+++ b/tools/power/cpupower/README
@@ -195,9 +195,9 @@ command:
$ sudo systemctl daemon-reload
-If you want to enable this systemd service, edit
-'${DESTDIR}/etc/default/cpupower' (uncommenting at least one of the options,
-depending on your preferences) and then issue the following command:
+If you want to enable this systemd service, edit '/etc/cpupower-service.conf'
+(uncommenting at least one of the options, depending on your preferences)
+and then issue the following command:
$ sudo systemctl enable --now cpupower.service
diff --git a/tools/power/cpupower/cpupower.default b/tools/power/cpupower/cpupower-service.conf
similarity index 67%
rename from tools/power/cpupower/cpupower.default
rename to tools/power/cpupower/cpupower-service.conf
index 376ca40fe5a6..02eabe8e3614 100644
--- a/tools/power/cpupower/cpupower.default
+++ b/tools/power/cpupower/cpupower-service.conf
@@ -2,7 +2,11 @@
# Copyright (C) 2012, Sébastien Luttringer
# Copyright (C) 2024-2025, Francesco Poli <invernomuto@paranoici.org>
-# Default file for linux-cpupower
+# Configuration file for cpupower.service systemd service unit
+#
+# Edit this file (uncommenting at least one of the options, depending on
+# your preferences) and then enable cpupower.service, if you want cpupower
+# to run at boot with these settings.
# --- CPU clock frequency ---
@@ -15,14 +19,14 @@
#MIN_FREQ="2.25GHz"
#MAX_FREQ="3GHz"
-# Specific frequency to be set.
+# Set a specific frequency
# Requires userspace governor to be available.
# If this option is set, all the previous frequency options are ignored
#FREQ=
# --- CPU policy ---
-# Sets a register on supported Intel processore which allows software to convey
+# Set a register on supported Intel processore which allows software to convey
# its policy for the relative importance of performance versus energy savings to
# the processor. See man CPUPOWER-SET(1) for additional details
#PERF_BIAS=
diff --git a/tools/power/cpupower/cpupower.service.in b/tools/power/cpupower/cpupower.service.in
index f91eaed03872..fbd5b8c14270 100644
--- a/tools/power/cpupower/cpupower.service.in
+++ b/tools/power/cpupower/cpupower.service.in
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2012-2020, Sébastien Luttringer
-# Copyright (C) 2024, Francesco Poli <invernomuto@paranoici.org>
+# Copyright (C) 2024-2025, Francesco Poli <invernomuto@paranoici.org>
[Unit]
Description=Apply cpupower configuration
@@ -8,7 +8,7 @@ ConditionVirtualization=!container
[Service]
Type=oneshot
-EnvironmentFile=-___CDIR___default/cpupower
+EnvironmentFile=-___CDIR___cpupower-service.conf
ExecStart=___LDIR___/cpupower
RemainAfterExit=yes
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] cpupower: fixes for cpupower.service
2025-05-13 16:29 [PATCH 0/3] cpupower: fixes for cpupower.service Francesco Poli (wintermute)
` (2 preceding siblings ...)
2025-05-13 16:29 ` [PATCH 3/3] cpupower: do not install files to /etc/default/ Francesco Poli (wintermute)
@ 2025-05-13 22:09 ` Shuah Khan
3 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2025-05-13 22:09 UTC (permalink / raw)
To: Francesco Poli (wintermute), linux-pm list
Cc: Thomas Renninger, Shuah Khan, John B. Wyatt IV, John Kacur,
Thorsten Leemhuis, Justin Forbes, Shuah Khan
On 5/13/25 10:29, Francesco Poli (wintermute) wrote:
>
> Hello!
>
> I prepared a patch series to address the issues reported about my
> previous patch by Thorsten Leemhuis.
>
> The patch series has been created against the tip of the
> 'origin/cpupower' git branch.
> I hope it can be applied soon, if you agree with the fixes.
>
> Thanks for your time!
> Bye.
I applied the series for my next pr to Rafael.
https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread