-
Notifications
You must be signed in to change notification settings - Fork 68
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 keeps saying MSR isn't loaded when it is #6
Comments
Due to changes in Linux regarding MSR-permissions (read/write can be used to subvert Kernel, code can be executed) you must (for python 3.6...) (disabling SecureBoot used to work before the changes were made):
However, I wouldn't recommend giving python such capabilities like that as a whole. Hopefully a SIGNED kernel module will be available in the future to allow mediating MSR reads/writes for sudoers. Edit: Edit: Edit: |
Thank you for your suggestion. I followed your instructions and now I don't get an error when I run this command:
Furthermore I can confirm that C6 is indeed off with this command:
Question though...how can I automatically load this? "Disable-c6" uses a different permutation of my command, so I assume that wouldn't work? This site (https://forum.manjaro.org/t/ryzen-freezes-possible-solution-related-to-c6-state/37870) suggests you just need to load the kill command in Systemd...but I'm not super familiar with SystemD...do you know how I would set this up and if it would work with sudo access? Also, do you know if this kill command must be run continually in a loop on the background, or do you just need to load it once on bootup? Thanks again for your help. |
In response, again, I would recommend: https://github.com/jfredrickson/disable-c6. You can use systemd to automatically do this on boot. I modified Zenstates to disable all but P0 and C6 with my own command-line parameter and incorporated that into the systemd stuff that the link mentions. I never had to do anything with kill commands or any such stuff. It seems to keep until shutdown. Not sure if the systemd task/job needs sudo, but I put it in anyway. I did not need to give python any special permission! |
If any Ryzen user finds this via Google...I continue to suffer system crashes. I'm going to try to disable P1 and P2 now to see if that helps. Cross my fingers...
|
I hope that is through systemd. You don't need to give python those caps if you do it through systemd making it much safer... My modified version of disable-c6 loops through all P-states except 0 and disables them but leaves C6 optionally enabled or disabled. Trivial to modify both projects to add this functionality. I did it to stop ASUS from modifying my rig to throttle with the power unplugged. Helps but not perfect. |
What's curious is it seems this script is less effective if executed later. For example if I boot up...load my browser, music program etc...then execute zenstates.py...then I have higher chances of a crash. This appears to be more effective if executed as soon as possible. Ideally this is executed at bootup. The following are instruction on how to do this for Mint/Ubuntu and SystemD. 1) sudo nano /etc/systemd/system/killryzen.service 2) Wite your file. eg: [Unit] [Service] [Install] 3) Save (with nano this is ctrl-x + y) 4) Make the file writeable sudo chmod u+x /etc/systemd/system/killryzen.service 5) Test this to make sure it works sudo systemctl start killryzen 6) Add to your startup sudo systemctl enable killryzen 7) Reboot to verify that this worked sudo reboot now If C6 is off, then you know this worked. As Yuji mentioned, this is a nice way to do this as you don't need to run systemd commands with sudo. |
Another update for wayward googlers that find this. I've tried a LOT of things to fix this stupid Ryzen bug...nothing worked. Except...once I got an external video card ALL problems went away. The card I got was the R7240-2GD3-L which is about $75 on Amazon, and is comparable to the graphics on the 2200. |
What bug, anyway? Behaves fine on all of my Ryzen systems. |
Never worked on my MSI X470 motherboard. Many other users have had similar problem. I suspect this issue might be motherboard specific. Doesn't matter now...an external graphics card fixed all my random lockups. |
For me the issue was that I wasn't running zenstates as root. |
I've enabled MSR. I've done this on boot up...
sudo nano -w /etc/modules-load.d/modules.conf
msr
ctrl-x (y)
sudo reboot now
I've also also added this manually:
sudo modprobe msr
When I check to see if my modules are listed with lsmod, I do indeed see MSR:
lsmod | grep msr
But...when I run zenstates...it always says MSR module not loaded.
/home/smithaa02/ryzen/ZenStates-Linux/zenstates.py --c6-disable
Traceback (most recent call last):
File "/home/smithaa02/ryzen/ZenStates-Linux/zenstates.py", line 112, in <module> writemsr(0xC0010292, readmsr(0xC0010292) & ~(1 << 32))
File "/home/smithaa02/ryzen/ZenStates-Linux/zenstates.py", line 33, in readmsr raise OSError("msr module not loaded (run modprobe msr)")
OSError: msr module not loaded (run modprobe msr)
Even the list command shows no MSR:
smithaa02@smithaa02-MS-7B79:/dev/cpu/1$ /home/smithaa02/ryzen/ZenStates-Linux/zenstates.py -l Traceback (most recent call last):
File "/home/smithaa02/ryzen/ZenStates-Linux/zenstates.py", line 76, in <module> print('P' + str(p) + " - " + pstate2str(readmsr(pstates[p])))
File "/home/smithaa02/ryzen/ZenStates-Linux/zenstates.py", line 33, in readmsr raise OSError("msr module not loaded (run modprobe msr)")
OSError: msr module not loaded (run modprobe msr)
The Pythod code this references is:
try:
f = os.open('/dev/cpu/%d/msr' % cpu, os.O_RDONLY)
os.lseek(f, msr, os.SEEK_SET)
val = struct.unpack('Q', os.read(f, 8))[0]
os.close(f)
return val
except:
raise OSError("msr module not loaded (run modprobe msr)")
But this makes no sense. How can the program complain about missing /dev/cpu/*/msr when I see them?
smithaa02@smithaa02-MS-7B79:/dev/cpu$ ls -al /dev/cpu/*/msr
crw------- 1 root root 202, 0 Jan 20 16:38 /dev/cpu/0/msr
crw------- 1 root root 202, 1 Jan 20 16:38 /dev/cpu/1/msr
crw------- 1 root root 202, 2 Jan 20 16:38 /dev/cpu/2/msr
crw------- 1 root root 202, 3 Jan 20 16:38 /dev/cpu/3/msr
Any help would be appreciated. My ryzen crashes have been hell...I really think it is the c6 issues and I'm desperate to fix this.
My system is:
The text was updated successfully, but these errors were encountered: