Skip to content

performance module#1542

Merged
brianmcgillion merged 1 commit intotiiuae:mainfrom
kajusnau:scheduler
Nov 21, 2025
Merged

performance module#1542
brianmcgillion merged 1 commit intotiiuae:mainfrom
kajusnau:scheduler

Conversation

@kajusnau
Copy link
Copy Markdown
Collaborator

@kajusnau kajusnau commented Nov 7, 2025

Description of Changes

Introduced a new performance module inspired by System76 Scheduler and TuneD.
This module replaces both power-profiles-daemon and system76-power, providing greater flexibility and allowing the definition of custom power profiles for both AC and battery modes in Ghaf.

With the addition of the module, Ghaf-specific power profiles are introduced as well, and are enabled by default for the host, based on the selected power profile (e.g. selecting powersave enables the ghaf-powersave profile).
Gui, net and audio VMs all use the upstream virtual-guest profile, which can be found here.


Key Features

  • TuneD’s power-profiles-daemon API - allows changing power profiles on any device via gui-vm
  • Enables custom Ghaf-specific, hardware-agnostic power and scheduler optimizations
  • Automatically detects AC/battery usage and adjusts profiles dynamically
  • Propagates power profile changes from gui-vm to host
  • Allows the use of custom scripts during power profile activation

Current configuration

gui-vm, net-vm, other possible guests

{
  power-saver = "virtual-guest";
  balanced = "virtual-guest";
  performance = "virtual-guest";
};
  • Generally VMs use virtual-guest default TuneD profile, with some extra functionality provided by scripts:
    • gui-vm scripts include propagating profile changes to other VMs and host, as well as reducing backlight brightness
    • net-vm scripts adjust Wi-Fi power management - disable in perf mode, re-enable for all other modes

host

{
  power-saver = "ghaf-powersave";
  balanced = "ghaf-balanced";
  performance = "ghaf-performance";
};
  • ghaf-* profiles are a mixture of the default profiles from system76-power and TuneD's virtual-host profile
  • PCI device power management is disabled in performance mode, enabled on powersave

Note: Battery and AC profiles are the same except for backlight adjustment - on battery, backlight adjustment is more aggressive.


Behavior

  • Users can now change the device's power profile at runtime by using COSMIC's battery applet (top panel, right side)
  • Changing the power profile automatically propagates the change to the host as well
  • 6 distinct profiles available - powersave, balanced, performance, and their respective "-battery" profiles
  • "Battery" profiles are activated automatically if the device is running on battery power only

Real world performance

Thanks to @milva-unikie and @leivos-unikie, we now have a clear visualization of the impact of this change.
The table below shows two power-measurement graphs collected on a Lenovo X1 Gen 11.

Before After
Before After
Mainline power measurements with the system left idle in its default state. Power measurements for this PR, taken in two-minute intervals for each power mode (performance -> balanced -> powersave), then repeated once. Backlight brightness is fixed at 100% throughout the test.
Power consumption stays around 14–15 W, dropping to ~12 W when the backlight eventually dims. The system suspends at around the 15-minute mark. Power consumption is approximately 19–20 W in performance mode, 14–15 W in balanced mode, and 9–10 W in powersave mode. This represents a worst-case scenario since the backlight is locked at full brightness; in normal use, balanced and powersave modes should see an additional ~2 W reduction.

Supported Targets

  • host (enabled by default)
  • gui-vm (enabled by default)
  • net-vm (enabled by default)

Type of Change

  • New Feature
  • Bug Fix
  • Improvement / Refactor

Related Issues / Tickets

Checklist

  • Clear summary in PR description
  • Detailed and meaningful commit message(s)
  • Commits are logically organized and squashed if appropriate
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • Author has run make-checks and it passes
  • All automatic GitHub Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing Instructions

Applicable Targets

  • Orin AGX aarch64
  • Orin NX aarch64
  • Lenovo X1 x86_64
  • Dell Latitude x86_64
  • System 76 x86_64

Installation Method

  • Requires full re-installation
  • Can be updated with nixos-rebuild ... switch
  • Other:

Test Steps To Verify:

General:

  1. Boot into Ghaf
  2. Verify the default power profile is Balanced
  3. Change the power profile (battery applet, top right)
  4. Verify the power profile changes in gui-vm, net-vm, and host, to their respective profiles, by running this command in each: tuned-adm active

Performance (Optional, perf tests can be done after merge):

  1. Boot into Ghaf and test the general responsiveness and performance (boot time, app load time, etc) using the different performance profiles
  2. Verify no degradation in performance using the balanced profile, comment on the "feeling" of using powersave and performance profiles

Battery life:

  1. Boot into Ghaf
  2. Login and wait 2-3 minutes for the system to settle and set backlight brightness to 100%
  3. Wait for system to settle 1-2 mins, unplug the charger, and observe the estimated remaining battery time in the battery applet (top right)
  4. Repeat step 3 for performance and powersave profiles and verify battery time increases or decreases as the profiles change performance -> balanced -> powersave

@kajusnau kajusnau self-assigned this Nov 7, 2025
@kajusnau kajusnau changed the title wip scheduler performance module Nov 12, 2025
@kajusnau
Copy link
Copy Markdown
Collaborator Author

Waiting for cloudflare issue to be resolved before re-running checks

@mbssrc
Copy link
Copy Markdown
Collaborator

mbssrc commented Nov 19, 2025

Nice work!

@kajusnau
Copy link
Copy Markdown
Collaborator Author

kajusnau commented Nov 19, 2025

Update:

  • Default power profile will always be performance for all targets, and will persist even after user login. User can then freely change to balanced or powersave, as they see fit.
  • Removed video.radeon_powersave setting.
  • Updated testing instructions to reflect new behavior.

@kajusnau
Copy link
Copy Markdown
Collaborator Author

Ready for testing, but QA is likely busy with release testing, so we may need to wait a while (or merge as is 👀)

@leivos-unikie
Copy link
Copy Markdown
Contributor

Is it possible to change the performance profile via command line?

@kajusnau
Copy link
Copy Markdown
Collaborator Author

kajusnau commented Nov 19, 2025

Is it possible to change the performance profile via command line?

sudo tuned-adm profile <profile-name>
Where profile-name is:

  • On gui-vm:
    • gui-[performance|balanced|powersave]
    • gui-[performance|balanced|powersave]-battery
  • On net-vm:
    • net-[performance|balanced|powersave]
    • net-[performance|balanced|powersave]-battery
  • On host:
    • host-[performance|balanced|powersave]
    • host-[performance|balanced|powersave]-battery

Generally it should be enough to change the profile in gui-vm, host and net-vm should change automatically.

You can also list available profiles sudo tuned-adm list, but this will produce a list of all available profiles, even ones we will not use.

@leivos-unikie
Copy link
Copy Markdown
Contributor

Is it possible to change the performance profile via command line?

sudo tuned-adm profile <profile-name> Where profile-name is:

* On gui-vm:
  
  * `gui-[performance|balanced|powersave]`
  * `gui-[performance|balanced|powersave]-battery`

* On net-vm:
  
  * `net-[performance|balanced|powersave]`
  * `net-[performance|balanced|powersave]-battery`

* On host:
  
  * `host-[performance|balanced|powersave]`
  * `host-[performance|balanced|powersave]-battery`

Generally it should be enough to change the profile in gui-vm, host and net-vm should change automatically.

You can also list available profiles sudo tuned-adm list, but this will produce a list of all available profiles, even ones we will not use.

Ok. Thanks. I think those are enough to automate some tests later.

So change of performance profile should propagate from gui-vm to host/net-vm. Does it work from host to net-vm/gui-vm?

@milva-unikie
Copy link
Copy Markdown

Ok. Thanks. I think those are enough to automate some tests later.

I have already written an automated test case for this :) We used it to create the graph in the description. I need to clean it up a bit first, but I’m planning to add it to our performance tests.

@kajusnau
Copy link
Copy Markdown
Collaborator Author

So change of performance profile should propagate from gui-vm to host/net-vm. Does it work from host to net-vm/gui-vm?

No, only from gui-vm to others.

@milva-unikie
Copy link
Copy Markdown

Tested on Lenovo-X1 (nixos-rebuild switch)

personally, I would take a crazy fan during boot any day if it would mean a couple of seconds quicker boot :)

@mbssrc I have to strongly disagree with this. With performance mode the fans are extremely loud and disturb the peaceful office environment.

I measured the boot time and it is not faster with this PR. The fans don't actually start going crazy during boot, they only start after the login screen has been visible for a while. Because the mode is forced to performance during boot this happens every time.

I suggest changing the default mode back to balanced.

My Darter Pro is used in the release testing currently, but I quickly borrowed Vunny's to check the fans. With Darter Pro the fans are not as noticeable.

@mbssrc
Copy link
Copy Markdown
Collaborator

mbssrc commented Nov 20, 2025

@milva-unikie That's why I prefixed it with "personally" :), and conditioned on that it actually makes the boot faster. I assume that the current bottleneck is mostly IO, based on what I measured a while back (which we can hopefully change in the future).
My suggestion was to run performance on boot and then switch.

That being said, I ran this on my system76 and it is silent, but I agree if it doesn't result in faster boot and hurts your ears let's keep it on balanced.

- added ghaf performance module
- added power profiles for host, gui-vm, net-vm, audio-vm
- enabled power profile switching on all targets
- enabled power profile propagation from gui-vm to host and net-vm
- added s76-scheduler assignments for host and gui-vm for improved responsiveness

Signed-off-by: Kajus Naujokaitis <kajus.naujokaitis@unikie.com>
@kajusnau
Copy link
Copy Markdown
Collaborator Author

Update:

  • Changed to "balanced" profile by default for all targets

@milva-unikie
Copy link
Copy Markdown

Tested on Darter Pro and Lenovo X1 (nixos-rebuild switch)

Looks good, feels good, sounds good.

  • Power profile is balanced by default
  • Power profile can be changed from the applet
  • There is a significant difference in power consumption between the modes
  • Performance test results on the Lenovo X1 are normal

@leivos-unikie
Copy link
Copy Markdown
Contributor

Ok. Thanks. I think those are enough to automate some tests later.

I have already written an automated test case for this :) We used it to create the graph in the description. I need to clean it up a bit first, but I’m planning to add it to our performance tests.

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon Tested on System76

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants