Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-667: Modify message when using amd-pstate-epp #674

Merged
merged 6 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,23 @@ def turbo(value: bool = None):
"""
p_state = Path("/sys/devices/system/cpu/intel_pstate/no_turbo")
cpufreq = Path("/sys/devices/system/cpu/cpufreq/boost")
amd_pstate = Path("/sys/devices/system/cpu/amd_pstate/status")
scaling_driver = Path("/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to check scaling_driver. Just amd_pstate/status is enough


if p_state.exists():
inverse = True
f = p_state
elif cpufreq.exists():
f = cpufreq
inverse = False
elif amd_pstate.exists() and scaling_driver.exists():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove scaling_driver.exists()

amd_value = amd_pstate.read_text().strip()
scaling_driver_value = scaling_driver.read_text().strip()
if amd_value == "active" and scaling_driver_value == "amd-pstate-epp":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the scaling_driver check since if amd_pstate/status equals "active", then the loaded driver must be amd-pstate-epp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this isn't really important but I think this entire if statement doesn't actually do anything since the cpufreq Path only doesn't exist on amd-pstate-epp but I think we should leave the if statement since it makes it more clear what is actually happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, by the way, what for amd_pstate == guided or amd_pstate == passive?

Copy link
Contributor Author

@corona10 corona10 Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-reply for guided mode: #602 (comment)
if amd_pstate=guided is set, then /sys/devices/system/cpu/cpufreq/boost is set.

print("CPU turbo is controlled by amd-pstate-epp driver")
else:
print("Warning: CPU turbo is not available")
Copy link
Contributor Author

@corona10 corona10 Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if more status can exist at this moment which can set the turbo.
FYI, I am not the AMD expert :)

If "yes," we should make it to set the turbo if the user wants.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be removed since this else statement will never be reached. the cpufreq Path does exist on amd-pstate so it would be caught by the preceding elif statement

return False
else:
print("Warning: CPU turbo is not available")
return False
Expand Down