User Tools

Site Tools


systemfreeze

If you want to send us your comments, please do so. Thanks
More on comments


System freeze

Also kown as system hangup

Useful commands

less -S  /var/log/messages

Show C states

Show the C states the processor is capable off

turbostat

turbostat can be found in the linux-cpupower package (previous in the linux-tools-common package)
Check man trubostat and turbostat --help for all options

Other ways

An other way to show the available C states

find /sys/devices/system/cpu/cpu0/cpuidle -name name | xargs cat

For all kernels and theads

find /sys/devices/system/cpu/cpu*/cpuidle -name name | xargs cat

turbostat ouput for an AMD A6-9500 APU

turbostat version 18.07.27 - Len Brown <lenb@kernel.org>
CPUID(0): AuthenticAMD 0xd CPUID levels; 0x8000001e xlevels; family:model:stepping 0x15:65:1 (21:101:1)
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX
cpu1: POLL: CPUIDLE CORE POLL IDLE
cpu1: C1: ACPI HLT
cpu1: C2: ACPI IOPORT 0x414
cpu1: cpufreq driver: acpi-cpufreq
cpu1: cpufreq governor: ondemand
cpufreq boost: 1
Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	IRQ	POLL	C1	C2	POLL%	C1%	C2%
-	-	910	33.08	2751	3493	12782	0	3777	2820	0.00	19.29	47.55

turbostat output for an AMD Ryzen 5 1600 with C states disabled

turbostat version 18.07.27 - Len Brown <lenb@kernel.org>
CPUID(0): AuthenticAMD 0xd CPUID levels; 0x8000001f xlevels; family:model:stepping 0x17:1:1 (23:1:1)
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX
NSFOD /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	IRQ
-	-	53	1.55	3396	3199	3544

AMD Ryzen based computers

Processor

AMD Ryzen 5 1600

We have the AMD Ryzen 5 1600 (Summit Ridge) processor replaced by AMD 5 times so far and the motherboard by Asrock once but that did not solve the freezes
There are a lot of people having computers with this issue. Search for “Ryzen 5 1600 freeze” on the Internet
Further investigation is needed. See below

Test software

Flops. You need x64-13-Haswell.exe since it supports FMA3 1)
All Flops versions for Linux and Windows can be found here

Motherboard

Asrock

Although Asrock writes “ASRock do NOT recommend updating this BIOS if Pinnacle, Raven, Summit or Bristol Ridge CPU is being used on your system.” the BIOS update can be preformed on a system with a Ryzen 1600 without risk. The procedrure:

  • Download the latest BIOS version
  • Put it on a vfat formatted USB drive
  • Make sure there is only one memory module in the board in slot A2 (second slot seen from the CPU)
  • With F9 set the BIOS to default settings
  • Insert the USB drive in the computer
  • Run the BIOS update with instant flash

SSD drives

SSD drives can have firmware which can need an update to solve systemfreezes

VendorFirmware location
Samsungtools

Possible solutions

These three work. No more freezes

  1. The most simple one:
    1. In UEFI only change: Advanced > AMD CBS > Power Supply idle control > Typical current idle
    2. /etc/default/grub
      GRUB_CMDLINE_LINUX="idle=nomwait processor.max_cstate=2 intel_idle.max_cstate=2"
      GRUB_CMDLINE_LINUX_DEFAULT="idle=nomwait processor.max_cstate=2 intel_idle.max_cstate=2"
    3. Run update-grub
    4. reboot
    5. Status: up for 78 hours. Otherwise a freeze within 24 hours
  2. Fixing stability issues with 1st generation Ryzen chips on Debian by Louis-Philippe Véronneau. This disables C states. The Ryzen 5 1600 will run only on 6 cores and use 10 W more power. Change the grub and UEFI settings
    • Asrock A320M Pro4. UEFI P5.90
      • Set in /etc/default/grub
        • GRUB_CMDLINE_LINUX=“idle=nomwait processor.max_cstate=2”
        • GRUB_CMDLINE_LINUX_DEFAULT=““
        • Run update-grub
        • Reboot
      • . Agesa Combo-AM4 0.0.7.2.In the UEFI set in the menu
        • OS Tweaker
          • SMT mode: Disable
        • Advanced
          • SVM mode: Disable
          • CPU configuration
            • Cool'n'Quiet: Disable
          • CPU common options
            • Global-C state Control: Disable
            • Not found: Power Supply idle control: Typical current idle
        • We had no freezes for over 45 days uptime
        • Still freezes? Try updating the UEFI to version P6.00 (Check with Asrock if in doubt)
    • Asrock AB350 Pro4. UEFI P6.30
      • Set in /etc/default/grub
        • GRUB_CMDLINE_LINUX=“idle=nomwait processor.max_cstate=2”
        • GRUB_CMDLINE_LINUX_DEFAULT=“idle=nomwait processor.max_cstate=2 intel_idle.max_cstate=2”
        • Run update-grub
        • Reboot
      • In the UEFI set in the menu
        • Advanced
          • SVM mode: Disable
          • CPU configuration
            • SMT mode: Disable
          • CPU common options
            • Global-C state: Disable
            • Power Supply idle control: Typical current idle
        • Save the UEFI settings (F10 and Yes)
        • Reboot
      • Go into the UEFI (Del or F2)
        • Check the boot drives and order. Set as desired
    • Consequences
      • This configuration brings the idle energy consumption from 47 W before to 57 W now. So maybe the issue is solved at the cost of a 10W extra power consumption
      • Hyperthreading is turned off. So only 6 instead of 12 “cores” maximum
      • turbostat --Summary --show sysfs --quiet sleep 0.1 shows no more C-states as expected. Before there were C1 and C2
    • Conclusion
      • The first test shows an uptime of 14 days 1 hour 40 minutes 24/7. Much longer than without these settings. So it seems to be a working solution. Thanks Louis-Philippe Véronneau 2)
  3. Replace the Ryzen 5 1600 processor with an AMD A6-9500 APU

These seem rosaceous

    • Update UEFI to or above AGESA update 1.0.0.2a
    • In UEFI set: Advanced > AMD CBS > Zen Common > Typical
  • UEFI settings. P states
    • OC Tweaker
      • Frequency and Voltage Change: Manual
      • SMT Mode: Enable
    • Advanced
      • AMD CBS
        • Zen Common Options
          • Global C-state control: Disable
          • Custom Pstates / Throttling
            • Custom Pstates: Custom
            • Pstate0 FID: Leave it as it is
            • Pstate0 DID: Leave it as it is
            • Pstate0 VID: Leave it as it is
            • Custom Pstate1: Disable (also for the others Custom Pstates)
            • Relaxed EDC throtteling: Enable

What does not help

  • Using a different video card
  • Using a different powersupply
  • Using a different Linux Distro like Fedora or PCLinuxOS (Live versions)
  • So far we did not succees in makeing the computer have a permanent minimum load. We do not know how the C-states algorithm work so it is a bit of a gamble and experience which load value is enough to prevent freezes. The procedure, some experience values and some ideas
    • If you have set 1. undo it
    • We ran the computer for 9 days with a load of about 25% read from top: %Cpu(s): 25,1 us. No freezes. Before we had a freeze within 24 hours.
    • We ran
      • with the 15 minutes load of 0,5 or larger
      • The “Cpu %usr” for all 12 cores is in mpstat 300 5000 is between 3% and 4% when at its lowest
      • No freezes so far
    • Run mpstat -P all | tr -s ' ' | tail -n 1 | cut -d ' ' -f 12 to check on the idle state. We keep the idle state below 94,0 we had no freezes so far
    • An better alternative is to run a script in cron every 5 minutes using the ps command. This adds up the CPU load of the two most active processes (cumulative over time, so it is not the actual value) and logs the value to a logfile for later examination
      #! /bin/bash
      highload=$(ps -e -o %cpu,%pid | sort -n | tail -n 2 | cut -d ',' -f 2 | tr -d 'i' | tr -d 'd' | tr -d ' ')
      echo "Load: $(bc <<< $(ps h -p $(echo $highload | cut -d ' ' -f 1) -o \%cpu)+$(ps h -p $(echo $highload | cut -d ' ' -f 2) -o \%cpu))" >> /home/user/load.log
    • This, using top, shows the actual value of the addition of the userload and the systemload
      #! /bin/bash
      highload=$(top -b -n 1 | grep "Cpu(s)" | tr ',' '.' | awk '{printf "%0.1f", $2 + $4}')
      echo -e "Load:\n$highload" >> /home/user/load.log
      • For now we test it while trying to keep it at a value greater then 5.0 to avoid freezes
      • With an average of 4.7 over 11 samples taken with an interval of 5 minutes the computer froze. The sample before the freeze was 6.8

Testing

  1. C6 state
    1. Ran as root modprobe msr
    2. Disabled C6 state with the ZenStates Python script
      • Ran ./zenstates.py --c6-enable which resulted in
        • C6 State - Package - Disabled
        • C6 State - Core - Disabled
  2. In a xterm we experience video issues with characters and the whole terminal. This has not occurred before the action at point 1
  3. After 45 hours uptime added intel_idle.max_cstate=5 to /etc/default/grub : GRUB_CMDLINE_LINUX_DEFAULT=“verbose intel_idle.max_cstate=5” . After saving the file we ran update-grub . The aim is to check if the effects from point 2 go away and if the freezes stay away
    • We did not reboot at this point. First we will wait more days for a possible freeze. Then undo the action at point 1 and reboot
  4. After 100 hours of uptime without freeze we
    • ran ./zenstates.py --c6-disable
    • powered the computer off and at a later time booted the computer again
    • noticed that the effects from point 2 are not seen in the first 3 hours of uptime
    • After a bit more time the computer froze
  5. Ran turbostat --Summary --show sysfs --num_iterations 1 --quiet sleep .1 and noticed that there is only C1 and C2 states. So the maximum avaiable C-state seems to be 2. This value can also be found with cat /sys/module/intel_idle/parameters/max_cstate
    • In /etc/default/grub we have set GRUB_CMDLINE_LINUX=“intel_idle.max_cstate=2” and GRUB_CMDLINE_LINUX_DEFAULT=“intel_idle.max_cstate=2” , ran update-grub and rebooted. Got a freeze again
  6. In /etc/default/grub we have set GRUB_CMDLINE_LINUX=“processor.max_cstate=2” and GRUB_CMDLINE_LINUX_DEFAULT=“processor.max_cstate=2” , ran update-grub and rebooted. Got a freeze again

Other possibilities

  • Upgrade the OS to the latest version - Did not solve the issue
  • Test an OS version with as little as possible processes running
  • Test all components in the computer
  • Better cooling. Especially for the graphics card and CPU. Check with a fan on the graphics card or replace a graphics card without fan for a type with fan
  • The SSD firmware is not up to date
  • A memory XMP profile which crashes the computer
  • Replace the Ryzen 5 1600 for a type of which no freezes are known. That would be a A6-9500 APU. An alternative, the Athlon 200GE, seems to have freezes too according to our investigations on the Internet.
  • Run as root
    • modprobe msr
    • lsmod | grep msr to check
    • More info: modinfo msr
    • Edit /etc/default/grub and add one or more of the following statemens between the ” ” on the end of the GRUB_CMDLINE_LINUX_DEFAULT= line (separate with spaces)
      • idle=nomwait Disable mwait for CPU C-states
      • iommu=pt of it that does not work iommu=soft (Majaro only?)
      • processor.max_cstate=0 rcu_nocbs=0-15 . Mayby processor.max_cstate=5 is sufficient. processor.max_cstate is based on acpi
      • intel_idle.max_cstate=5 This is the newer way of processor.max_cstate
    • Save the file
    • Run as root update-grub
    • Reboot
  • C states
    • Check C states with find /sys/devices/system/cpu/cpu0/cpuidle -name latency -o -name name | xargs cat
    • Disable C6 state in the BIOS / UEFI
    • Disable C6 state with the ZenStates Python script
      • C6 State - Package - Disabled
      • C6 State - Core - Disabled (leaving this enabled should also work but ZenStates only disables both)
    • Check the available C-states with turbostat --Summary --show sysfs --num_iterations 1 --quiet sleep .1
  • Turn overclocking off
  • Set “Typical Current Idle”
  • Implement AMD's “Power Supply Option”
  • Turn PBO (Precision Boost Overdrive) off in the BIOS / UEFI
  • Make sure the UEFI has the latest AGESA version: 1.0.0.4 Patch B (February 2020) or newer

General

C states

An overview of C states can be found on Github
The highest possible C state of the computer can be found with

cat /sys/module/intel_idle/parameters/max_cstate

Show the C states in the computer

grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name

Found in /var/log/syslog

[Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
microcode: CPU0: patch_level=0x08001138

Bitrot

Bitrot in the BIOS / UEFI flash memory can be a cause. Reflashing or updating the BIOS / UEFI flash memory can solve this issue as we experienced
See Wikipedia for more causes

Random freezes/crashes with enabled C-State C6 - AMD Ryzen
AMD found the root problem causing its new Ryzen processors to freeze desktops
AMD RMA form
AMD GPU Driver on Stretch and Buster
AMD Ryzen problems and fixes
Intel on Power management states P states C states and package C states
Ryzen and disabling C6 C state
Kernel.org bug 196683
Kernel parameters
Ryzen 5 2600 freezes minutes after booting Linux
C states
Kernel.org kernel-parameters
How to set intel idle max cstate 1?
processor-max_cstate intel_idle_max_cstate and devcpu_dma_latency
A minimum complete tutorial of cpu power management C-states and P-states
AMD spendiert Ryzen 5 1600 Pinnacle Ridge
AMD Fam 17h M 00h-0Fh Revision guide
mwait explained
Ryzen 1800X freeze. See item 788 for example
Random Soft Lockup on new Ryzen build
Random full system freezes with AMD Ryzen 1600
Random freezes/crashes with enabled C-State C6 - AMD Ryzen
Random freezes with AMD Ryzen on Linux
CPU related hard freezes
Everything You Need to Know About the CPU C-States Power Saving Modes

Kernel issue

Here is a hint that it might be a Linux kernel issue. Read the posts of Dino-Fossil


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2026 Webevaluation.nl and the authors
Changes reserved.

systemfreeze.txt · Last modified: by wim