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

zenstates.py fails when msr module is built into kernel #5

Closed
spyder0080 opened this issue Oct 9, 2018 · 15 comments
Closed

zenstates.py fails when msr module is built into kernel #5

spyder0080 opened this issue Oct 9, 2018 · 15 comments

Comments

@spyder0080
Copy link

Hello,
My current setup is Fedora 28 x64 running kernel 4.18.11-200. My machine is a HP Envy x360 running Ryzen 5 2500U APU. In Fedora at least, the msr module is built into the kernel. I ran the following:

cat /boot/config-$(uname -r) | grep CONFIG_X86_MSR

and the following result came up:

CONFIG_X86_MSR=y

Which means that the msr module is built in. Running zenstates.py --c6-disable fails with the following output:
File "./zenstates.py", line 112, in
writemsr(0xC0010292, readmsr(0xC0010292) & ~(1 << 32))
File "./zenstates.py", line 23, in writemsr
raise OSError("msr module not loaded (run modprobe msr)")
OSError: msr module not loaded (run modprobe msr)

Maybe you can add the above check as well?

@spyder0080
Copy link
Author

The same error happens if Secure boot is on or off.

@nikhilbobb
Copy link

The script does not check for the MSR module, just for the device and access to it. Are you running the script as root?

@spyder0080
Copy link
Author

Yes, I was running it as root. Attached is a screenshot
zenstates_msr_error

@nikhilbobb
Copy link

That error implies that the script cannot open the /dev/cpu/[0-9]*/msr device. Can you check if these exist?

If they don't exist your MSR module is not being loaded properly.

@spyder0080
Copy link
Author

They do exist

dev_cpu

@AD-Wright
Copy link

Try changing [0-9]* to %d if you have less than 10 cores.
That got it to run for me (Ryzen 2500U [8 cores]), although I'm still having issues actually disabling the c6 state.

@spyder0080
Copy link
Author

@AD-Wright can you show me what you mean?

@ghtux
Copy link

ghtux commented Nov 20, 2018

Ryzen 1700x with 8 cores here. You must load msr first! Manual sudo modprobe msr.

For automatic loading of module insert in modprobe conf.
Have a look here:
https://forum.manjaro.org/t/amd-ryzen-problems-and-fixes/55533

@AD-Wright
Copy link

@spyder0080 - so really the change I mention makes it so the command to disable c6 executes, but it doesn't actually do anything. So that's not a fix.
@ghtux - with modprobe not loaded, can you still read the p-states (zenstates.py -l)? That works fine on my system, and lsmod | grep msr returns the msr module. It seems that there is an issue with writing to the registers. Perhaps changing the registers is not possible on mobile processors. (2500U) The folders for the processors exist, and have msr files inside, and reading seems to go fine, but writing errors out.

@OdinVex
Copy link

OdinVex commented Jan 26, 2019

Duplicate of #6.

@spyder0080
Copy link
Author

Just as an update, I was able to successfully run python zenstates.py --c6-disable as root using the latest version of the script. My C6 state is now disabled. You can close this issue.

@spyder0080
Copy link
Author

FYI I am running kernel 5.1.7 on Fedora 30.

@angelhodar
Copy link

@spyder0080 Hey dude, i have a Ryzen 5 2500U and i have followed this repo https://github.com/jfredrickson/disable-c6 but it says that the msr module is not loaded but indeed it is! Same problem as you had, but you said that you were successfully:

Just as an update, I was able to successfully run python zenstates.py --c6-disable as root using the latest version of the script. My C6 state is now disabled. You can close this issue.

But in my case it stil says that the msr module cant be found... What is so special with Ryzen 2500U?

@spyder0080
Copy link
Author

@spyder0080 Hey dude, i have a Ryzen 5 2500U and i have followed this repo https://github.com/jfredrickson/disable-c6 but it says that the msr module is not loaded but indeed it is! Same problem as you had, but you said that you were successfully:

Just as an update, I was able to successfully run python zenstates.py --c6-disable as root using the latest version of the script. My C6 state is now disabled. You can close this issue.

But in my case it stil says that the msr module cant be found... What is so special with Ryzen 2500U?

Hello @angelhodar ,

I have not ran the script from the repo that you mentioned ( https://github.com/jfredrickson/disable-c6), but I did run the script from this repo. I downloaded the latest version and ran it again successfully.

@All3xJ
Copy link

All3xJ commented Sep 27, 2021

For me the issue was that I didn't run as root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants