Resolving System Hangs in Linux with AMD Ryzen Processors

2025.03.02 | Yuki Rea

Many users with AMD Ryzen CPUs, especially newer generations CPUs, may experience system freezes within Linux operating systems. This is because the Linux kernel currently does not fully support the new C-states used by Ryzen Processors. When the processor switches to one of these unsupported C-states, the operating system hangs. C-states are power saving features implemented by modern processors. A lower number C-state means a higher power mode. The higher the C-state, the lower the power mode of the CPU.


[0] - Upgrade to the latest Linux kernel

Before you attempt to resolve this issue by other means, please verify your distribution is up to date and you are on the latest stable Linux kernel available for your distribution of choice.


[1] - Set maximum available C-States in Grub configuration file

Use your text editor of choice to add processor.max_cstate=5 to the GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT lines within the /etc/default/grub file as shown below.

If this does not work, try processor.max_cstate=1 instead of 5.

/etc/default/grub
 1 # If you change this file, run 'update-grub' afterwards to update
 2 # /boot/grub/grub.cfg.
 3 # For full documentation of the options in this file, see:
 4 #   info -f grub -n 'Simple configuration'
 5 
 6 GRUB_DEFAULT=0
 7 GRUB_TIMEOUT=0
 8 GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
 9 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
10 GRUB_CMDLINE_LINUX="processor.max_cstate=5"
11 GRUB_CMDLINE_LINUX_DEFAULT="quiet processor.max_cstate=5"

[2] - Update Grub, reboot, and test results

Save the file and run the following command to update your grub configuration.

sudo update-grub

Reboot the computer once the command completes and test to see if the issue has been resolved. If the issue is not resolved, try setting a C-state of 1 instead of 5 or continue to the next step.


[3] - Disable RCU Callbacks in Grub configuration file

Disabling Read-Copy-Update (RCU) callbacks can help improve system stability at the cost of some performance. Use your text editor of choice to add rcu_nocbs=0-15 to the GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT lines within the /etc/default/grub file as shown below.

0-15 refers to the number of cores in your Ryzen CPU.
This example is applicable to a 16 core processor. For an 8 core processor, you would use 0-7 instead for example.

/etc/default/grub
 1 # If you change this file, run 'update-grub' afterwards to update
 2 # /boot/grub/grub.cfg.
 3 # For full documentation of the options in this file, see:
 4 #   info -f grub -n 'Simple configuration'
 5 
 6 GRUB_DEFAULT=0
 7 GRUB_TIMEOUT=0
 8 GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
 9 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
10 GRUB_CMDLINE_LINUX="processor.max_cstate=5 rcu_nocbs=0-15"
11 GRUB_CMDLINE_LINUX_DEFAULT="quiet processor.max_cstate=5 rcu_nocbs=0-15"

[4] - Update Grub, reboot, and test results

Save the file and run the following command to update your grub configuration.

sudo update-grub

Reboot the computer once the command completes and test to see if the issue has been resolved. You may also force specific C-states from within your BIOS / UEFI configuration if your mainboard allows.