For my first couple of weeks on Manjaro, back at the start of 2022, I had a lot of freezes. While there are a lot of things that can cause freezes, on my specific hardware it was easy to track down the issue.
I found a post about it on the archived Manjaro forum, which no longer exists.
🪦 RIP archived manjaro forum
It appears to be isolated to the AM4 platform, specifically earlier generation AMD CPUs are affected.
Since then I already upgraded to a newer 5600X.
At the time I had the following system:
- Ryzen 1600X
- MSI PC Mate B350
- GTX 1080
The Problem is that the linux kernel, under low CPU load, sends the CPU into a power saving state: C6. With Ryzen CPUs it was a gamble, whether it would or would not freeze the entire OS.
Symptoms
Most of the time, my system would freeze while I was away from my computer. This meant the system was most likely ideling, and wanted to go into a lower power state. Rarely would it freeze during use.
The lock ups would almost certainly happen every single day, or close to it.
When frozen, the system would not let me switch ttys, or execute a clean shutdown with REISUB. The Displays would show the last thing that happened.
Solution
- In BIOS/UEFI set
Idle CurrenttoTypical Idle Current - Set a kernel boot parameter
idle=nomwait - Install a service to disable C6 states with
Zenstates.py
1. Idle Current
In your BIOS or UEFI, there is an option called Power Supply Idle Control or similar.
It is usually located in some of the CPU features or overclocking settings.
Set it from auto or Low Idle Current to Typical Idle Current
2. Kernel Boot Parameter
Edit /etc/default/grub and add the idle=nomwait flag to your current list of parameters:
GRUB_CMDLINE_LINUX_DEFAULT="<current params> idle=nomwait"
Save the file and run sudo update-grub to re-generate the initramfs.
3. Zenstates.py
- Install zenstates-git from AUR
- The kernel module
msris needed for Zenstates. To load this module every boot, addmsrto the file/etc/modules-load.d/modules.conf. - To disable C6 states permanently, create a systemd unit.
- create a file in
/etc/systemd/system/called something likedisable_c6.service. - add the folowing contents to the file:
[Unit]
Description=Ryzen Disable C6
DefaultDependencies=no
After=sysinit.target local-fs.target
Before=basic.target
[Service]
Type=oneshot
ExecStart=/usr/bin/zenstates --c6-disable
[Install]
WantedBy=basic.target
- Run
sudo systemctl enable disable_c6.serviceto enable the system.d unit. - Reboot.
- Run
lsmod | grep msrto check ifmsrhas been loaded. - Check if Zenstates has disabled C6:
sudo zenstates -l:
roman@pc~: sudo zenstates -l
...
C6 State - Package - Disabled
C6 State - Core - Disabled