Skip to content

Commit

Permalink
Fix spam error message when setting energy_performance_preference
Browse files Browse the repository at this point in the history
The 'intel_pstate' and 'amd_pstate_epp' driver does not allow the EPP
to be set to anything but 'performance' when the scaling governor is
set to 'performance', previously auto-cpufreq when the scaling-governor
was set to 'performance' tried to set the EPP to 'balance-performance'
which caused a spam of write error messages in journalctl in system
with 'intel_pstate' and 'amd_pstate_epp' drivers.
This is an intended behavior, since according to the [kernel documentation](https://docs.kernel.org/admin-guide/pm/intel_pstate.html#hwp-performance)
when HWP is enabled[(which is enabled by default during boot with supported processors)](https://docs.kernel.org/admin-guide/pm/intel_pstate.html#active-mode-with-hwp)
and scaling governor is set to performance the processor’s internal
P-state selection logic is expected to focus entirely on performance.
And this will override the EPP setting and reject any value different from 0 (“performance”).
This commit just changes the 'balance-performance' EPP preference in
set_performance() to 'performance'. Which fixes the spam issue.
  • Loading branch information
FosRexx committed Apr 20, 2024
1 parent 8bb7478 commit c5b418a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ def set_override(override):
# Current work-around for Pop!_OS where symlink causes permission issues
print("[!] Warning: Cannot get distro name")
if os.path.exists("/etc/pop-os/os-release"):
# Check if using a Snap
# Check if using a Snap
if os.getenv("PKG_MARKER") == "SNAP":
print("[!] Snap install on PopOS detected, you must manually run the following"
" commands in another terminal:\n")
print("[!] Snap install on PopOS detected, you must manually run the following"
" commands in another terminal:\n")
print("[!] Backup the /etc/os-release file:")
print("sudo mv /etc/os-release /etc/os-release-backup\n")
print("sudo mv /etc/os-release /etc/os-release-backup\n")
print("[!] Create hardlink to /etc/os-release:")
print("sudo ln /etc/pop-os/os-release /etc/os-release\n")
print("sudo ln /etc/pop-os/os-release /etc/os-release\n")
print("[!] Aborting. Restart auto-cpufreq when you created the hardlink")
sys.exit(1)
else:
Expand Down Expand Up @@ -182,7 +182,7 @@ def check_for_update():
print("Error fetching recent release!")
if message is not None and message.startswith("API rate limit exceeded"):
print("GitHub Rate limit exceeded. Please try again later within 1 hour or use different network/VPN.")
else:
else:
print("Unexpected status code:", response.status_code)
return False
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout,
Expand Down Expand Up @@ -215,8 +215,8 @@ def check_for_update():
# Handle the case where "tag_name" key doesn't exist
print("Malformed Released data!\nReinstall manually or Open an issue on GitHub for help!")



def new_update(custom_dir):
os.chdir(custom_dir)
print(f"Cloning the latest release to {custom_dir}")
Expand Down Expand Up @@ -247,7 +247,7 @@ def get_formatted_version():
literal_version = get_literal_version("auto-cpufreq")
splitted_version = literal_version.split("+")
formatted_version = splitted_version[0]

if len(splitted_version) > 1:
formatted_version += " (git: " + splitted_version[1] + ")"

Expand Down Expand Up @@ -571,7 +571,7 @@ def countdown(s):
os.environ["TERM"] = "xterm"

print("\t\t\"auto-cpufreq\" is about to refresh ", end = "")

# empty log file if size is larger then 10mb
if auto_cpufreq_stats_file is not None:
log_size = os.path.getsize(auto_cpufreq_stats_path)
Expand Down Expand Up @@ -942,8 +942,8 @@ def set_performance():
run(f"cpufreqctl.auto-cpufreq --epp --set={epp}", shell=True)
print(f'Setting to use: "{epp}" EPP')
else:
run("cpufreqctl.auto-cpufreq --epp --set=balance_performance", shell=True)
print('Setting to use: "balance_performance" EPP')
run("cpufreqctl.auto-cpufreq --epp --set=performance", shell=True)
print('Setting to use: "performance" EPP')

# set frequencies
set_frequencies()
Expand Down Expand Up @@ -1382,4 +1382,3 @@ def not_running_daemon_check():
elif os.getenv("PKG_MARKER") == "SNAP" and dcheck == "disabled":
daemon_not_running_msg()
exit(1)

0 comments on commit c5b418a

Please sign in to comment.