Louis-Philippe Véronneau - amdhttps://veronneau.org/2019-01-03T00:00:00-05:00Fixing stability issues with 1st generation Ryzen chips on Debian2019-01-03T00:00:00-05:002019-01-03T00:00:00-05:00Louis-Philippe Véronneautag:veronneau.org,2019-01-03:/fixing-stability-issues-with-1st-generation-ryzen-chips-on-debian.html<p>I was an early adopter when Ryzen - AMD's latest CPU line - came out. The prices
were very good, the chips had a lot of cores and they ran pretty fast. At the
time I thought the Ryzen 1600 CPU with its 6 core and 12 threads all running
at 3 …</p><p>I was an early adopter when Ryzen - AMD's latest CPU line - came out. The prices
were very good, the chips had a lot of cores and they ran pretty fast. At the
time I thought the Ryzen 1600 CPU with its 6 core and 12 threads all running
at 3.4 GHz with a TDP of 65W (with support for ECC RAM) made the perfect
homeserver chip.</p>
<p>Fast forward two years: I've finally got around the stability issues I was
having that hung my server at random intervals. Sometimes, everything was fine
for months, but I also experienced random system freezes twice in a week.
Since I'm using full disk encryption on all the drives in my server, a whole
system freeze meant I had to go back home and reboot the server manually.</p>
<p>I first thought I was affected by a <a href="https://www.extremetech.com/computing/254750-amd-replaces-ryzen-cpus-users-affected-rare-linux-bug">"rare" bug</a> that touched the first
batch of Ryzen CPUs so I RMAed mine and had to handle nearly a month of
downtime. Sadly, it didn't solve my problem. Two weeks ago I decided I was tired
of this whole reboot cycle and tried to see if upgrading to a more recent kernel
(4.9 -> 4.18) did the trick. The problem only got worse and my server ended up
freezing each and every night. As always, no errors showed up anywhere in the
logs.</p>
<p>With the 4.18 kernel, the timing of the system freezes got me thinking and I
found this <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1690085">bug report</a> in Launchpad. Turns out the problem is caused by
bad low-power handling. When the CPU idles for a long time, it enventually
freezes and hangs the whole system. This is corroborated by this
<a href="https://www.amd.com/system/files/TechDocs/55449_Fam_17h_M_00h-0Fh_Rev_Guide.pdf">AMD report</a> that states:</p>
<pre>
1109 MWAIT Instruction May Hang a Thread
Description: Under a highly specific and detailed set of internal timing
conditions, the MWAIT instruction may cause a thread to
hang in SMT (Simultaneous Multithreading) Mode.
Potential Effect on System: The system may hang or reset.
Suggested Workaround: System software may contain the workaround for
this erratum.
Fix Planned: No fix planned
</pre>
<p>To fix the problem I've:</p>
<ul>
<li>disabled SMT in the BIOS</li>
<li>disabled "Cool 'n Quiet" in the BIOS</li>
<li>disabled "Global C-states" in the BIOS</li>
<li>set "Power Supply Idle Control" to "Common current idle" in the BIOS</li>
<li>set <code>idle=nomwait</code> in the kernel</li>
<li>set <code>processor.max_cstate=5</code> in the kernel</li>
</ul>
<p>Disabling C-States means that the CPU cores always run at 3.4 GHz and the chip
consumes 50W at idle instead of 30W, but that's a price I'm willing to pay to
have a stable server.</p>
<p>Note that from what I've read online, the Ryzen 2 chips aren't affected by this.
Don't take my word for it though. I guess I've learnt the hard way that trying
to build a stable system out of a bleeding edge platform is a bad idea.</p>AMD Ryzen 5 2400G on Debian2018-11-08T00:00:00-05:002018-11-08T00:00:00-05:00Louis-Philippe Véronneautag:veronneau.org,2018-11-08:/amd-ryzen-5-2400g-on-debian.html<p>Today at work I built two new computers for co-workers. They were (rightfully
so) complaining the 2008 iMacs they were using were getting old and slow.</p>
<p>I can't help but be a little sad about it. These computers are still pretty
usable for light tasks and are in overall pretty …</p><p>Today at work I built two new computers for co-workers. They were (rightfully
so) complaining the 2008 iMacs they were using were getting old and slow.</p>
<p>I can't help but be a little sad about it. These computers are still pretty
usable for light tasks and are in overall pretty good shape. To be honest, I'm
not sure what I'll be doing with them.</p>
<p>Tasked with the job of building new computers at a reasonable price, I decided
to go with the latest AMD CPU, the Ryzen 5 2400G. This is the second generation
of Ryzen chips and it includes an APU, thus negating the need to buy a discrete
GPU.</p>
<p>This chip is pretty recent so the support in Stretch isn't great. The APU
graphics stack was too recent to be supported by the 4.9 stable kernel, so I had
to install 4.18 from the backports.</p>
<p>I also had to install the <code>xserver-xorg-video-amdgpu</code> driver from testing, as
AMD's Vega arch wasn't a thing when Stretch came out. Although AMD did the right
thing and used FOSS drivers for their Vega GPU lineup, you still need
proprietary firmware (<code>firmware-amd-graphics</code>) for the APU to be fully
supported.</p>
<p>It was my first time using NVME SSDs, and oh boy are those fast. I was sceptical
at first (SATA SSDs are pretty fast, right?) but the difference in <em>snap</em> really
is noticeable. I now regret I didn't put that in my desktop at home when I
replaced my SSD 6 months ago...</p>
<p>All in all I'm pretty happy with the final result. The performance of the Ryzen
5 2400G is good and the price of the overall build was reasonable.</p>