Open rmeissn opened 6 months ago
Hi, @rmeissn , really appreciated for reviewing intel_lpmd with Fedora 39.
some comments inline.
**Observations:
It's unclear whether intel_hfi is active or available on my kernel/system (default Fedora kernel). I can't find a kernel module or file related to hfi.
_Rui: the driver name is intelhfi.
AC/BAT changes do not appear to affect intel_lpmd.
Rui: this is expected.
enabled auto mode (at least I guess so).
Upon system boot, it doesn't enter low-power mode automatically (sudo systemctl status intel_lpmd shows no mode changes).
Rui: Maybe this is because the config file you're using.
I manually activated it with intel_lpmd_control ON and switched to AUTO afterward.
It remains in low-power mode regardless of AC attachment status
When active, CPUs 12-16 (range 1-16) are primarily utilized, unless there's high system load.
Rui: This is expected behavior. we enter low power mode and only the last Ecore Module is activated, unless we quit from low power mode when utilization is high.
Questions:
Is there a file I can check to determine whether intel_hfi is available/active? -> possible improvement for documentation
_Rui: So far not sure, I need to find a general way for this purpose. And I like your idea, maybe I can put intel_hfi driver detection messages during intellpmd launch time as well.
I've disabled power-profile-daemon in favour of using TLP. Are PerformanceDef, BalancedDef, and PowersaverDef related to power-profile-daemon levels? -> possible improvement for documentation
Rui: yes and agreed.
Recommendations (in my opinion):
Implement an option to manage AC attach/detach events (e.g., to activate low-power mode only when on battery, not on AC). In my opinion, it should only be active when on battery power, not AC.
Rui: I need to think about this. I was thinking do different policies for AC/Battery, but I haven't thought disabling low power mode completely with AC.
Implement a CLI option to check for dependencies, to know whether e.g. hfi can be used, which cgroup to use, power-profiles, etc.**
Rui: do we need a separate CLI option? I thought dumping the status of all potential dependencies during launch time should be enough. If you use --loglevel=debug option, you can already see much more info there.
Rui: the driver name is intel_hfi.
Then it seems fedora isn't shipping it, as I can't find a module named intel_hfi
Rui: do we need a separate CLI option? I thought dumping the status of all potential dependencies during launch time should be enough. If you use --loglevel=debug option, you can already see much more info there.
I guess this is also fine, if documented =)
I've added an AC/BAT behaviour by adding the following udev rule under /usr/lib/udev/rules.d/99-intel_lpmd.rules
# intel_lpmd - udev rules
# Rule for when switching to battery
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/intel_lpmd_control ON"
# Rule for when switching to AC
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/intel_lpmd_control OFF"
On Fri, 2024-03-01 at 03:15 -0800, Roy Meissner wrote:
Rui: the driver name is intel_hfi. Then it seems fedora isn't shipping it, as I can't find a module named intel_hfi
Hi, Richardo,
Roy cannot find intel_hfi module loaded on this system
System: Framework 13 (i7-1260P), Fedora 39, intel_lpmd v0.3 (compiled per Readme), enabled through systemd, kernel 6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC.
any tips to get the root cause? is cpuid dump sufficient or we need some other information?
thanks, rui
Rui: do we need a separate CLI option? I thought dumping the status of all potential dependencies during launch time should be enough. If you use --loglevel=debug option, you can already see much more info there. I guess this is also fine, if documented =) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Problem is that
/usr/bin/intel_lpmd_control ON
forces the system to always stay in low power mode. This might not be true depending on the intel_lpmd_config.xml file used.
Ah, I see. So AUTO
might be better than ON
.
# intel_lpmd - udev rules
# Rule for when switching to battery
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/intel_lpmd_control AUTO"
# Rule for when switching to AC
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/intel_lpmd_control OFF"
No... what if the config file uses ON? To achieve this, we need two more lpmd commands, freeze and restore...
@zhang-rui @rmeissn Hello, there is not an intel_hfi module. It is not a proper driver in the Linux sense. Plus, it is always compiled as CONFIG_INTEL_HFI_THERMAL=y. You can tell that HFI is enabled if you do $ rdmsr 0x17d1 1
If you read 1 then it shows that the HFI "driver" is loaded.
I understand that there is currently no official AC/BAT mode, and that it depends on the configuration in the XML file. I've implemented a workaround that consistently works for me (using Fedora 39 with power-profiles-daemon deactivated and TLP activated) to control intel_lpmd based on AC/BAT status. I'm sharing this in case someone else wishes to achieve the same with version 0.3.
This could also potentially serve as inspiration for further development within the project itself.
intel_lpmd_config.xml (stripped from comments, forced off in all modes)
<?xml version="1.0"?>
<Configuration>
<lp_mode_cpus></lp_mode_cpus>
<Mode>0</Mode>
<PerformanceDef>-1</PerformanceDef>
<BalancedDef>-1</BalancedDef>
<PowersaverDef>-1</PowersaverDef>
<HfiLpmEnable>1</HfiLpmEnable>
<HfiSuvEnable>1</HfiSuvEnable>
<util_entry_threshold>10</util_entry_threshold>
<util_exit_threshold>95</util_exit_threshold>
<EntryDelayMS>0</EntryDelayMS>
<ExitDelayMS>0</ExitDelayMS>
<EntryHystMS>2000</EntryHystMS>
<ExitHystMS>3000</ExitHystMS>
<IgnoreITMT>0</IgnoreITMT>
</Configuration>
--> deactivates automatisms of intel_lpmd (forced off)
/usr/lib/udev/rules.d/99-intel-lpmd.rules
:
# Rule for when switching to battery
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/intel_lpmd_control AUTO"
# Rule for when switching to AC
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/intel_lpmd_control OFF"
--> allows for changing behaviour dynamically when already running and when plugging/unplugging AC. However, it does not activate intel_lpmd in AUTO mode when booted on battery, necessitating the use of a systemd service:
/etc/systemd/system/ac_power_control.service
:
[Unit]
Description=Intel Low Power Mode Service for AC BAT change
Requires=intel_lpmd.service
After=intel_lpmd.service
[Service]
Type=oneshot
ExecStart=/usr/bin/ac_power_control.sh
[Install]
WantedBy=default.target
/usr/bin/ac_power_control.sh
:
#!/bin/bash
# Check if AC is connected
if upower -i /org/freedesktop/UPower/devices/line_power_ACAD | grep "online" | grep -q "yes" ; then
/usr/bin/intel_lpmd_control OFF
else
/usr/bin/intel_lpmd_control AUTO
fi
The script determines the presence of AC during boot and adjusts the activation of the intel_lpmd AUTO mode accordingly. I had to set the correct SELinux context for the script using sudo chcon -t bin_t /usr/bin/ac_power_control.sh
. Failure to do so resulted in a permission error for the systemd service.
As mentioned, this AC/BAT mode is not currently intended by intel, and these scripts serve as a workaround, offering the following functionality:
I'm thinking to add this into lpmd base support, say, we can have two configurations for each power profile, one for AC and one for DC. @rmeissn @spandruvada what do you think?
I think "/org/freedesktop/UPower/devices/line_power_ACAD" is fedora specific, right? Is there a universal way to detect system online/offline? say like kernel ABI? can I just rely on "/sys/class/power_supply/*/online" or uevent or anything else?
Having separate configuration files for AC and DC settings sounds good to me. It would suffice to have a file containing modifications to the default DC configuration file, activated when the system is running on AC power, if needed. Another approach might be to have one config file with different settings for AC/DC, like found with TLP.
I am uncertain whether "/org/freedesktop/UPower/devices/line_power_ACAD" is specific to Fedora or not. My understanding is that it pertains to UPower and D-Bus, which are used on most distros, but I'm not really familiar with those systems.
@rmeissn does the gnome ui get laggy for you when lpmd is active in battery mode? Scrolling documents on the document viewer is also very choppy. If I stop intel_lpmd or set it to off, performance is normal.
@stereomato I didn't notice any significant lags on gnome-shell or evince while lpmd is active (only 4 e-cores active) (on my 1260P system). But I've tuned my tlp config a bit. e.g. I've noticed that if you change
CPU_ENERGY_PERF_POLICY_ON_BAT=balance_power
to
CPU_ENERGY_PERF_POLICY_ON_BAT=power
the system gets quite laggy. I'm also using overleaf a lot and it gets a bit laggy on my battery tlp profile (with or without lpmd).
These are my changes to the default tlp.conf for my Framework 13 1260P (mostly copied from the framework recommendation):
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave
CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC=100
CPU_MIN_PERF_ON_BAT=0
CPU_MAX_PERF_ON_BAT=40
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
CPU_HWP_DYN_BOOST_ON_AC=1
CPU_HWP_DYN_BOOST_ON_BAT=0
PLATFORM_PROFILE_ON_AC=balance_performance
PLATFORM_PROFILE_ON_BAT=balance_power
INTEL_GPU_MIN_FREQ_ON_AC=100
INTEL_GPU_MIN_FREQ_ON_BAT=100
INTEL_GPU_MAX_FREQ_ON_AC=1400
INTEL_GPU_MAX_FREQ_ON_BAT=700
INTEL_GPU_BOOST_FREQ_ON_AC=1400
INTEL_GPU_BOOST_FREQ_ON_BAT=1000
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1
PCIE_ASPM_ON_AC=default
PCIE_ASPM_ON_BAT=powersupersave
USB_ALLOWLIST="32ac:0002"
System: Framework 13 (i7-1260P), Fedora 39, intel_lpmd v0.3 (compiled per Readme), enabled through systemd, kernel
6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC
.Observations:
sudo systemctl status intel_lpmd
shows no mode changes).intel_lpmd_control ON
and switched toAUTO
afterward.Questions:
PerformanceDef
,BalancedDef
, andPowersaverDef
related to power-profile-daemon levels? -> possible improvement for documentationRecommendations (in my opinion):
Config:
Journal log (
journalctl -b | grep -i intel_lpmd
):