Commit graph

269 commits

Author SHA1 Message Date
Bastien Nocera
c20e09a711 0.13 2023-04-26 14:53:07 +02:00
Bastien Nocera
6eaf337c33 intel-pstate: Remove unused variable
src/ppd-driver-intel-pstate.c:174:22: warning: unused variable 'gov_path' [-Wunused-variable]
    g_autofree char *gov_path = NULL;
                     ^
2023-04-26 14:28:14 +02:00
Prajna Sariputra
1b18784f12 README: Add documentation for the AMD P-State driver 2023-04-26 14:28:14 +02:00
Prajna Sariputra
ea0e2be53c tests: Add tests for the AMD P-state driver 2023-04-26 14:23:18 +02:00
Prajna Sariputra
db60051aea main: Add amd_pstate-based driver
The AMD P-states driver has added support for active mode in kernel 6.3,
which exposes a similar interface for controlling energy performance
preference as the Intel P-state driver, with the same presets present,
so make use of it.

See:
https://www.kernel.org/doc/html/v6.3/admin-guide/pm/amd-pstate.html

Closes: #108
2023-04-26 14:23:18 +02:00
Bastien Nocera
414543e881 ci: Use detached pipelines
See https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438#what-it-means-for-me-a-maintainer-of-a-project-part-of-gitlabfreedesktoporg
2023-03-16 15:11:19 +01:00
Bastien Nocera
0cb116f351 main: Fix pylint warnings
src/powerprofilesctl:137:0: C0325: Unnecessary parens after '=' keyword (superfluous-parens)
src/powerprofilesctl:126:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)
src/powerprofilesctl:134:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)
src/powerprofilesctl:154:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)
2023-03-16 15:04:48 +01:00
Bastien Nocera
1116e54128 platform-profile: "cool" should be balanced
The "cool" profile isn't a low-power mode, but a mode where the fans are
always running to reduce the temperature, presumably to allow it to run
faster.

At the same time, we need to handle the lack of low-power profile on HP
machines as they only had a cool mode and no low-power mode.

Closes: #89
2023-02-08 16:06:48 +01:00
Bastien Nocera
cbdac3da5b tests: Add tests for checking for profile existence 2022-09-08 11:44:19 +02:00
Bastien Nocera
eefb002ac5 main: Check that profile exists before switching to it
Don't allow switching to an unsupported profile, or holding that
unsupported profile, as that might cause problems for front-ends that
can't display that combination.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1504
2022-09-08 11:44:19 +02:00
Bastien Nocera
674732919a utils: Add debug to monitoring helper
As we don't have easy access to the full path of the attribute
we're monitoring elsewhere.
2022-09-08 11:37:28 +02:00
Bastien Nocera
1ddc98ecd8 0.12 2022-06-28 15:58:14 +02:00
Bastien Nocera
0005a190f0 README: Update README to mention EPB
See https://www.kernel.org/doc/html/v5.17/admin-guide/pm/intel_epb.html
2022-06-28 15:50:27 +02:00
Bastien Nocera
50eb7d3441 intel-pstate: Reapply energy_perf_bias on resume
From https://www.kernel.org/doc/html/v5.17/admin-guide/pm/intel_epb.html?highlight=energy_perf_bias:
"
There are systems where the platform firmware resets the EPB during
system-wide transitions from sleep states back into the working state
effectively causing the previous EPB updates by user space to be lost.
"

So reapply energy_perf_bias on resume.
2022-06-28 15:50:27 +02:00
Bastien Nocera
58d556e85b tests: Add test for energy_perf_bias support 2022-06-28 15:50:27 +02:00
Bastien Nocera
d42af96f9d intel-pstate: Probe EPB on startup 2022-06-28 15:50:27 +02:00
Bastien Nocera
6d03eddcf4 intel-pstate: Add EPB application 2022-06-28 15:50:27 +02:00
Bastien Nocera
f212ffdac9 intel-pstate: Factor out writing to sysfs files 2022-06-28 15:50:27 +02:00
Bastien Nocera
30ce9b1c68 intel-pstate: Rename profile_to_pref() 2022-06-28 15:50:27 +02:00
Bastien Nocera
bc5433e788 intel-pstate: Split probing EPP 2022-06-28 15:50:27 +02:00
Bastien Nocera
ade5c0e1b8 intel-pstate: Split EPP and EPB devices
Split energy_perf_bias and energy_performance_preference devices, as
they use different values.
2022-06-28 15:50:27 +02:00
Bastien Nocera
fbc7cad121 ci: Enable tests in the CI 2022-06-28 15:36:34 +02:00
Bastien Nocera
b0f6aa5e85 build: Make tests optional
And check for dbusmock and gi being available.

Closes: #95
2022-06-28 15:36:03 +02:00
Bastien Nocera
915f3dfc92 build: Install D-Bus config in /usr
/etc should be left for sysadmin overrides.

Closes: #94
2022-06-28 15:32:04 +02:00
Bastien Nocera
e2c4f6fec9 intel-pstate: Fix return type of ->probe() implementation 2022-06-28 14:40:05 +02:00
Bastien Nocera
4684a0ceb8 intel-pstate: Simplify opening policy dir 2022-06-28 14:34:37 +02:00
Bastien Nocera
785267939b main: Add profile activation reason "Resume" 2022-06-28 14:21:00 +02:00
Bastien Nocera
4aa9922e2a tests: Fix typo 2022-06-28 14:17:47 +02:00
Bastien Nocera
53d9f55edd tests: Fix error running tests with Python 3.11
In 664448d81f
the "errors" attribute was removed from the _Outcome object. Adapt the
code to print the daemon log after a failed run().
2022-06-24 13:21:03 +02:00
Bastien Nocera
d72a30cff6 tests: Indent a hunk of code correctly 2022-06-24 10:24:36 +02:00
Bastien Nocera
8b6e96e727 tests: Disable MALLOC_PERTURB when running pylint 2022-06-23 17:28:51 +02:00
Bastien Nocera
e83b4556bf 0.11.1 2022-05-02 17:07:24 +02:00
Bastien Nocera
bd2d4202e8 README: Document how the Intel P-State driver works
It used to just tweak a single file, but it's now (unfortunately) complicated
enough that it needs to be documented.
2022-05-02 15:07:07 +02:00
Bastien Nocera
afed35451d tests: Add test case for Intel P-State in passive mode 2022-05-02 14:47:22 +02:00
Bastien Nocera
23103bca59 intel-pstate: Don't change scaling_governor if P-State isn't active
On systems without HWP support, or when the Intel P-State driver runs in
"passive" mode, the CPU is effectively controlled by cpufreq governors.

Only modify the cpufreq scaling_governor if the Intel P-State driver is in
active mode.

See https://www.kernel.org/doc/html/v5.17/admin-guide/pm/intel_pstate.html#operation-modes

Closes: #91
2022-05-02 14:42:37 +02:00
Bastien Nocera
29151898b6 0.11 2022-04-29 14:29:31 +02:00
Bastien Nocera
5260fae7cf tests: Test with a non-default scaling_governor
Check that the daemon is resetting the value on startup, and add
scaling_governor sysfs files for all the intel-pstate tests.
2022-04-28 15:25:52 +02:00
Bastien Nocera
fb41403b8e main: Change default scaling_governor on startup
Otherwise energy_performance_preference might not be writable. This can
happen on systems where the default cpufreq scaling governor has been
changed.

See https://bugzilla.redhat.com/show_bug.cgi?id=2079898

Closes: #90
2022-04-28 15:17:45 +02:00
Bastien Nocera
588fe2cc08 tests: Add tests for error reporting when profile can't be set 2022-04-28 14:42:35 +02:00
Bastien Nocera
b028f276e6 ci: Run tests with tmpdir in the build tree
This should allow using chattr to make files immutable, which only works
on ext{2,3,4} and not tmpfs.
2022-04-28 14:42:35 +02:00
Bastien Nocera
79c7ee282d ci: Run tests before make a dist
As the dist runs the tests, best run the tests first, should fail
earlier.
2022-04-28 14:31:07 +02:00
Bastien Nocera
53e77cf572 ci: Install e2fsprogs to get access to chattr tool 2022-04-28 14:11:50 +02:00
Bastien Nocera
b12907c14a main: Catch D-Bus errors when running "set" command
Before:
Traceback (most recent call last):
  File "/usr/bin/powerprofilesctl", line 262, in <module>
    main()
  File "/usr/bin/powerprofilesctl", line 216, in main
    _set(args[0])
  File "/usr/bin/powerprofilesctl", line 111, in _set
    proxy.Set('(ssv)',
  File "/usr/lib/python3.10/site-packages/gi/overrides/Gio.py", line 349, in __call__
    result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
gi.repository.GLib.GError: g-io-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code26: Error writing '/sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference': Device or resource busy (26)

After:
Failed to communicate with power-profiles-daemon: g-io-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code26: Error writing '/sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference': Device or resource busy (26)
2022-04-28 14:00:47 +02:00
Bastien Nocera
6719ced657 main: Return D-Bus error on profile activation failure
Throw a D-Bus error when activating a profile fails:
gi.repository.GLib.GError: g-io-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code26: Error writing '/sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference': Device or resource busy (26)

Closes: #90
2022-04-28 14:00:47 +02:00
Bastien Nocera
d000f9a3ff main: Add error reporting to internal activate_target_profile()
This will allow propagating potential errors.
2022-04-28 14:00:47 +02:00
Bastien Nocera
d352d5a2cb utils: Better debug and error messages
Add debugging and make error messages better on errors.
2022-04-28 14:00:47 +02:00
Bastien Nocera
d57a45fd23 utils: Fix ignored write errors
Because fprintf() is buffered unless disabled and we weren't checking
for the fclose() return value, we were returning without errors when
there should have been some.
2022-04-28 14:00:47 +02:00
Bastien Nocera
4bf9871b6f ci: Skip tests when dependencies are missing 2022-04-28 13:54:14 +02:00
Bastien Nocera
3d9a706ba0 ci: Fail CI when tests are skipped 2022-04-28 13:54:14 +02:00
Bastien Nocera
f6cfb32568 build: Fix run_command() call
WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300
2022-04-27 16:04:05 +02:00