Page MenuHomeFreeBSD

cpufreq(4): add tunable to prefer MSR over acpi_perf for P-state info
Needs ReviewPublic

Authored by jo_bruelltuete.com on May 18 2023, 12:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 8:34 AM
Unknown Object (File)
Fri, Apr 26, 12:18 PM
Unknown Object (File)
Fri, Apr 26, 12:18 PM
Unknown Object (File)
Fri, Apr 26, 12:18 PM
Unknown Object (File)
Fri, Apr 26, 12:18 PM
Unknown Object (File)
Fri, Apr 26, 6:42 AM
Unknown Object (File)
Apr 7 2024, 12:28 PM
Unknown Object (File)
Feb 22 2024, 4:57 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Adds a new tunable to get P-state info from the CPUs MSR instead of acpi_perf.

Test Plan

Tried on my Ryzen 3700X. Works as expected.
acpi_perf and MSR have the same info on my machine.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This seems reasonable to me. I can't easily test it myself.

sys/x86/cpufreq/hwpstate_amd.c
141

This should perhaps be RDTUN, since toggling the value won't have any effect after the driver has been loaded.

143
399

I think this is ok. It would be useful to have some motivation for the tunable: when should a user try it? Is there some risk involved?

I note that there is no hwpstate_amd manual page. :( That would be a good place to document this.

sys/x86/cpufreq/hwpstate_amd.c
394

You can reduce indentation by using else if above instead of separate else and if clauses.

I think this is ok. It would be useful to have some motivation for the tunable: when should a user try it? Is there some risk involved?

It should be used when you dont trust your BIOS. Mine has absolute shoddy quality. It's the critical piece of software that got the least amount of code review (if any, it certainly wasnt actually tested, at all).
Can't think of much risk... not any more than the risk from using the driver as is: maybe there's something peculiar about your hardware that the BIOS knows about and going through acpi_perf would take care of that, but then using hwpstate_amd would already bypass that anyway.