@mioc has described a method for disabling the C6 power state reliably in another topic. here, i want to amend my own experiences, simplify the process altogether, and create an editable wiki so other people can add their experiences.
there are couple of tips floating around on the internet for fixing Ryzen lockups related to low system usage. typically, your system is no doing much at all (like showing a movie, playing music, showing the same simple website for an extended period of time) and when you want more CPU power, e.g. by moving the mouse, it freezes.
the cause of this freeze/crash is a bug in the C6 power/sleep state of first generation Ryzen CPUs.
i have collected and tested these tips in the past:
rcu_nocbs=0-11(for a 12 thread CPU) as your boot parameter in /etc/default/grub. this setting is supposed to disable ASLR, which should decrease the number of times Ryzen CPUs enter C6 sleep state. my system still kept crashing!
processor.max_cstate=5as your boot parameter in /etc/default/grub. this setting is supposed to disable the c6 sleep state altogether, but my system kept crashing. probably this setting was overwritten by another process.
the only method, which works for me (i have already been without crashes for almost a month) is described in the following tutorial. i have only tested it on both kernel 4.14 and 4.15.
load MSR kernel module during boot:
sudo nano /etc/modules-load.d/modules.conf
add the following line and save the file:
get zenstates from github:
git clone https://github.com/r4m0n/ZenStates-Linux.git
zenstates.pyto a place you can leave it and forget about it:
sudo cp ZenStates-Linux/zenstates.py /usr/local/bin/
create systemd service:
sudo nano /usr/lib/systemd/system/ryzen-disable-c6.service
enter the following code and save it:
[Unit] Description=Disable C6 power state on Ryzen CPUs DefaultDependencies=no After=sysinit.target local-fs.target Before=basic.target [Service] Type=oneshot ExecStart=/usr/local/bin/zenstates.py --c6-disable [Install] WantedBy=basic.target
enable systemd service:
sudo systemctl enable ryzen-disable-c6
delete downloaded folder from github:
sudo rm -r ZenStates-Linux
reboot your system
make sure everything has worked:
check, whether msr kernel module is loaded (the following command should have an output):
lsmod | grep msr
check, whether c6 power state is disabled:
sudo /usr/local/bin/zenstates.py -l