1
0

- Add respect-dpm-manual.patch:

Don't override user settings for dpm if set to manual
  (glfo#upower/power-profiles-daemon#163)

OBS-URL: https://build.opensuse.org/package/show/Base:System/power-profiles-daemon?expand=0&rev=31
This commit is contained in:
Atri Bhattacharya 2024-09-10 08:55:18 +00:00 committed by Git OBS Bridge
commit 8fca984cd0
8 changed files with 489 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,53 @@
Index: power-profiles-daemon-0.11/src/power-profiles-daemon.c
===================================================================
--- power-profiles-daemon-0.11.orig/src/power-profiles-daemon.c
+++ power-profiles-daemon-0.11/src/power-profiles-daemon.c
@@ -537,6 +537,29 @@ holder_disappeared (GDBusConnection *con
g_ptr_array_free (cookies, TRUE);
}
+#define MAX_UNTRUSTED_STR_LEN 1024
+#define MAX_PROFILE_HOLDS 32
+
+static gboolean
+check_sane_string(const char *s)
+{
+ guint i;
+
+ for (i = 0; s[i] != 0; i++) {
+ gchar ch = s[i];
+
+ if (i > MAX_UNTRUSTED_STR_LEN)
+ return FALSE;
+
+ if (g_ascii_isalnum(ch) || g_ascii_isspace(ch))
+ continue;
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
hold_profile (PpdApp *data,
GVariant *parameters,
@@ -559,6 +582,18 @@ hold_profile (PpdApp *dat
return;
}
+ if (!check_sane_string(reason) || !check_sane_string(application_id)) {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+ "Input strings are too long or contain invalid characters");
+ return;
+ }
+
+ if (g_hash_table_size(data->profile_holds) > MAX_PROFILE_HOLDS) {
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_LIMITS_EXCEEDED,
+ "Too many profile holds already active");
+ return;
+ }
+
hold = g_new0 (ProfileHold, 1);
hold->profile = profile;
hold->reason = g_strdup (reason);

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c61a2350e58d51d4d6e58a61cf2aaa9b307ce42f16c40c4ece0bf1ed6d020506
size 63984

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a030b25c4e86faab782a134cf7ac8e19d1e7edf2d2c0ed6f158750de10c1f8d5
size 66394

View File

@ -0,0 +1,202 @@
-------------------------------------------------------------------
Mon Sep 9 18:54:06 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Add respect-dpm-manual.patch:
Don't override user settings for dpm if set to manual
(glfo#upower/power-profiles-daemon#163)
-------------------------------------------------------------------
Tue Sep 3 06:20:18 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Update to version 0.22:
* power-profiles-daemon is now battery-level aware:
some drivers use this value for better optimizations
* AMD p-state improvements:
+ supports core performance boost when not in power-saver mode
+ uses minimum frequency to lowest non-linear frequency
+ more impervious to faulty firmware and kernel bugs
* support for changing DPM clocks on amdgpu:
explicitly set the DPM clocks down to "low" when in
power-saver mode
* powerprofilesctl can disable logind and upower integration
* fix handling of turbo_pct, now assumed as not present
by default
* power-profiles-daemon.service further lockdown restrictions
* start power-profiles-daemon.service after
multi-user.target AND display-manager.target
to avoid conflicts with module loading
-------------------------------------------------------------------
Wed Apr 17 10:01:27 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>
- Drop BuildRequires on python-pylint by disabling pylint option
during configure.
- Split out bash-completion into own package:
powerprofilesctl-bash-completion.
-------------------------------------------------------------------
Tue Apr 9 10:48:35 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.21:
* power-profiles-daemon is now battery-state aware and some
drivers use a more power efficient state when using the
balanced profile on battery.
* Various fixes for the powerprofilesctl command line tool when
using the launch or version commands.
* Generate manual page for powerprofilesctl and shell
completions.
* Improved daemon command line interface for debugging, see
`--help-debug` for more information.
* More restrictive systemd service lockdown settings.
* Various code optimizations.
- Drop python3-shebang.patch: no longer required since
%python3_fix_shebang is used anyway.
- New BuildRequires: cmake, pkgconfig(bash-completion),
python3-argparse-manpage, python3-pylint, python3-shtab.
- New Requires: bash-completion, python3-gobject.
- Build completions for zsh shell and split off new package
powerprofilesctl-zsh-completion to be automatically installed
when both zsh and power-profiles-daemon are installed.
-------------------------------------------------------------------
Sat Mar 30 20:01:51 UTC 2024 - Florian "sp1rit" <sp1rit@disroot.org>
- Revert "Remove duplicate DBus service files
net.hadess.PowerProfiles" workaround to boo#1222179 (see comment
10).
-------------------------------------------------------------------
Wed Mar 13 10:12:35 UTC 2024 - pgajdos@suse.com
- remove dependency on /usr/bin/python3 using
%python3_fix_shebang macro, [bsc#1212476]
-------------------------------------------------------------------
Wed Feb 21 12:09:15 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Remove duplicate DBus service files net.hadess.PowerProfiles
-------------------------------------------------------------------
Thu Feb 15 05:53:07 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Update to version 0.20:
* Service has new name 'org.freedesktop.UPower.PowerProfiles'
* Allow multiple power-profiles-daemon drivers to load simultaneously
* amdgpu panel power savings which uses dedicated hardware in systems with
integrated Radeon graphics to decrease panel power consumption when the
system is on battery
- Add python3-shebang.patch:
* resolve env-script-interpreter error
-------------------------------------------------------------------
Wed Apr 26 15:19:01 UTC 2023 - Enrico Belleri <idesmi@protonmail.com>
- Update to version 0.13:
* Add support for the AMD P-State driver included in Linux 6.3
* Fix mismatched profiles on some HP laptops and some
miscellaneous bug fixes.
-------------------------------------------------------------------
Sun Jul 3 23:56:23 UTC 2022 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.12:
* Add support for the Intel "Energy Performance Bias" feature.
- Adapt to change of installed dbus configuration file
[boo#1201125].
-------------------------------------------------------------------
Fri May 13 13:13:55 UTC 2022 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.11.1:
* Stops power-profiles-daemon from modifying the cpufreq driver
when the user/administrator has chosen to disable the Intel
P-State scaling governor (eg. forcing a passive operation
mode).
-------------------------------------------------------------------
Sun May 1 17:32:18 UTC 2022 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.11:
* Fixes problems on Intel machines when the CPUs didn't support
turbo at all, or the performance scaling governor was built as
default in the kernel.
* Add better end-user documentation.
* Fixes in the command-line tool to not cause bug report tools
to popup on not-uncommon errors.
* Bug fix for running on some systems with controllable charge
speeds.
- Drop fd1664dfe26f13f8c8cd7b44483cd872dfdede36.patch: upstreamed.
-------------------------------------------------------------------
Fri Nov 19 15:29:11 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- Add fd1664dfe26f13f8c8cd7b44483cd872dfdede36.patch: main: Error
out on D-Bus communication errors (rh#2019536).
- Bump pkgconfig(polkit-gobject-1) BuildRequires version to 0.114.
It's required for the g_autoptr() support we use.
-------------------------------------------------------------------
Fri Nov 5 18:35:24 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.10.1:
* Fix bug in the authorisation codepath added in 0.10.0, where
holding a profile could still succeed despite having sent a
denial to the calling process.
* Make pylint test optional.
- Drop f83685732b9dd8211840645ce76f43718b30218b.patch:
incorporated upstream.
-------------------------------------------------------------------
Wed Oct 6 20:32:31 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 0.10.0:
+ This release adds authorisation checks for the profile holds
and profile switching features of the backend daemon, through
polkit. It is recommended that all distributions upgrade to
this version as soon as possible.
+ This release also adds support for the "quiet" kernel platform
profile used in some systems.
- Drop patches fixed upstream:
+ power-profiles-daemon-polkit-policy.patch
+ c9b646025d9f155509a6cda1c292bfd120daeb9e.patch
+ 20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch
- Add f83685732b9dd8211840645ce76f43718b30218b.patch: build: Make
pylint test optional. As power-profiles-daemon keeps getting
built with slightly different versions of pylint with newer
warnings, disable pylint test by default to avoid getting bug
reports about it.
- Add hold-profile-hardening.patch: Hardening of HoldProfile D-Bus
method (boo#1189900). Requested by openSUSE security team.
-------------------------------------------------------------------
Tue Sep 28 13:05:16 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
- Add power-profiles-daemon-polkit-policy.patch -- Describe and
set defaults for switching and holding power profiles; patch
taken from upstream merge request (boo#1189900,
glfo#hadess/power-profiles-daemon#47).
- Add Requires: polkit, needed at runtime after changes in
permission handling due to above patch.
- Disable tests as they fail due to polkit changes from above
patch not being integrated yet.
-------------------------------------------------------------------
Fri Sep 24 19:45:59 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- Pass explicit systemdsystemunitdir=%{_unitdir} to meson, ensure
we have the correct systemd unitdir.
- Drop systemd and systemd-rpm-macros BuildRequires, not needed.
- Add check section and run meson_test macro, replace umockdev with
pkgconfig(umockdev-1.0) BuildRequires.
- Add generic c_compiler BuildRequires as meson checks for it.
- Add upstream patches:
+ c9b646025d9f155509a6cda1c292bfd120daeb9e.patch:
platform-profile: Add support for 'quiet' profile.
+ 20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch: tests: Add
tests for quiet profile support.
-------------------------------------------------------------------
Thu Aug 26 18:16:58 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
- Initial package.

141
power-profiles-daemon.spec Normal file
View File

@ -0,0 +1,141 @@
#
# spec file for package power-profiles-daemon
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: power-profiles-daemon
Version: 0.22
Release: 0
Summary: Power profiles handling over D-Bus
License: GPL-3.0-or-later
URL: https://gitlab.freedesktop.org/upower/power-profiles-daemon
Source: %{url}/-/archive/%{version}/%{name}-%{version}.tar.bz2
# PATCH-FEATURE-OPENSUSE hold-profile-hardening.patch boo#1189900 -- Hardening of HoldProfile D-Bus method
Patch0: hold-profile-hardening.patch
# PATCH-FIX-UPSTREAM respect-dpm-manual.patch -- based on commit 21b58819 glfo#upower/power-profiles-daemon#163 : Don't override user settings for dpm if set to manual
Patch1: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/commit/21b58819edcbbd87fc161474d1501debfd9b84b7.patch#/respect-dpm-manual.patch
BuildRequires: c_compiler
BuildRequires: cmake
BuildRequires: gtk-doc
BuildRequires: meson >= 0.59.0
BuildRequires: pkgconfig
BuildRequires: python3-argparse-manpage
BuildRequires: python3-dbusmock
BuildRequires: python3-shtab
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gudev-1.0) >= 234
BuildRequires: pkgconfig(polkit-gobject-1) >= 0.91
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(umockdev-1.0)
BuildRequires: pkgconfig(upower-glib)
Requires: polkit
Requires: python3-gobject
%description
power-profiles-daemon offers to modify system behaviour based upon user-selected
power profiles. There are 3 different power profiles: a "balanced" default mode,
a "power-saver" mode, and a "performance" mode.
%package doc
Summary: Documentation for power-profiles-daemon
BuildArch: noarch
%description doc
This package provides documentation for %{name}.
%package -n powerprofilesctl-bash-completion
Summary: Bash completion for powerprofilesctl
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description -n powerprofilesctl-bash-completion
This package provides bash shell completions for powerprofilesctl.
%package -n powerprofilesctl-zsh-completion
Summary: Zsh shell completion for powerprofilesctl
Requires: %{name} = %{version}
Requires: zsh
Supplements: (%{name} and zsh)
BuildArch: noarch
%description -n powerprofilesctl-zsh-completion
This package provides zsh shell completions for powerprofilesctl.
%prep
%autosetup -p1
%build
%meson \
-Dsystemdsystemunitdir=%{_unitdir} \
-Dgtk_doc=true \
-Dpylint=disabled \
-Dtests=true \
-Dzshcomp=%{_datadir}/zsh/site-functions/ \
%{nil}
%meson_build
%install
%meson_install
%{python3_fix_shebang}
%check
%meson_test
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license COPYING
%doc README.md
%{_bindir}/powerprofilesctl
%{_libexecdir}/%{name}
%{_unitdir}/%{name}.service
%{_datadir}/dbus-1/system.d/net.hadess.PowerProfiles.conf
%{_datadir}/dbus-1/system.d/org.freedesktop.UPower.PowerProfiles.conf
%{_datadir}/dbus-1/system-services/net.hadess.PowerProfiles.service
%{_datadir}/dbus-1/system-services/org.freedesktop.UPower.PowerProfiles.service
%{_datadir}/polkit-1/actions/power-profiles-daemon.policy
%{_mandir}/man1/powerprofilesctl.1%{?ext_man}
%ghost %dir %{_localstatedir}/lib/%{name}
%files doc
%dir %{_datadir}/gtk-doc/
%dir %{_datadir}/gtk-doc/html/
%{_datadir}/gtk-doc/html/%{name}/
%files -n powerprofilesctl-bash-completion
%{_datadir}/bash-completion/completions/*
%files -n powerprofilesctl-zsh-completion
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/*
%changelog

63
respect-dpm-manual.patch Normal file
View File

@ -0,0 +1,63 @@
From 21b58819edcbbd87fc161474d1501debfd9b84b7 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello@amd.com>
Date: Thu, 5 Sep 2024 18:53:50 -0500
Subject: [PATCH] action-amdgpu-dpm: Don't override user settings for dpm if
set to `manual`
---
src/ppd-action-amdgpu-dpm.c | 5 +++++
tests/integration_test.py | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/src/ppd-action-amdgpu-dpm.c b/src/ppd-action-amdgpu-dpm.c
index 7e141de..e8e34b9 100644
--- a/src/ppd-action-amdgpu-dpm.c
+++ b/src/ppd-action-amdgpu-dpm.c
@@ -99,6 +99,11 @@ ppd_action_amdgpu_dpm_update_target (PpdActionAmdgpuDpm *self, GError **error)
continue;
}
+ if (g_strcmp0 (value, "manual") == 0) {
+ g_info ("Device %s is in manual mode, not changing", g_udev_device_get_sysfs_path (dev));
+ continue;
+ }
+
g_info ("Setting device %s to %s", g_udev_device_get_sysfs_path (dev), target);
if (!ppd_utils_write_sysfs (dev, DPM_SYSFS_NAME, target, error))
return FALSE;
diff --git a/tests/integration_test.py b/tests/integration_test.py
index 30ae097..6c898fd 100644
--- a/tests/integration_test.py
+++ b/tests/integration_test.py
@@ -1646,6 +1646,28 @@ class Tests(dbusmock.DBusTestCase):
upowerd_obj.Set("org.freedesktop.UPower", "OnBattery", True)
self.assert_file_eventually_contains(energy_prefs, "balance_power")
+ def test_amdgpu_dpm_manual(self):
+ """Verify AMDGPU dpm power actions avoid manual"""
+ amdgpu_dpm = "device/power_dpm_force_performance_level"
+ card = self.testbed.add_device(
+ "drm",
+ "card0",
+ None,
+ [amdgpu_dpm, "manual\n"],
+ ["DEVTYPE", "drm_minor"],
+ )
+ self.create_amd_apu()
+
+ self.start_daemon()
+
+ self.assertIn("amdgpu_dpm", self.get_dbus_property("Actions"))
+
+ self.set_dbus_property("ActiveProfile", GLib.Variant.new_string("balanced"))
+ self.assert_sysfs_attr_eventually_is(card, amdgpu_dpm, "manual")
+
+ self.set_dbus_property("ActiveProfile", GLib.Variant.new_string("power-saver"))
+ self.assert_sysfs_attr_eventually_is(card, amdgpu_dpm, "manual")
+
def test_amdgpu_dpm(self):
"""Verify AMDGPU dpm power actions"""
amdgpu_dpm = "device/power_dpm_force_performance_level"
--
GitLab