From owner-freebsd-current@freebsd.org Wed Jun 13 11:46:38 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B5161001259 for ; Wed, 13 Jun 2018 11:46:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A0DEE7D094 for ; Wed, 13 Jun 2018 11:46:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 5EA8C1001256; Wed, 13 Jun 2018 11:46:37 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CC421001253; Wed, 13 Jun 2018 11:46:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD5627D090; Wed, 13 Jun 2018 11:46:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTP id w5DBkPlW041391; Wed, 13 Jun 2018 14:46:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w5DBkPlW041391 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w5DBkPFv041390; Wed, 13 Jun 2018 14:46:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 13 Jun 2018 14:46:25 +0300 From: Konstantin Belousov To: Johannes Lundberg Cc: current@freebsd.org, amd64@freebsd.org Subject: Re: Ryzen public erratas Message-ID: <20180613114625.GQ2493@kib.kiev.ua> References: <20180613103535.GP2493@kib.kiev.ua> <86602neyil.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86602neyil.fsf@gmail.com> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2018 11:46:38 -0000 On Wed, Jun 13, 2018 at 12:06:42PM +0100, Johannes Lundberg wrote: > > Konstantin Belousov writes: > > > Today I noted that AMD published the public errata document for Ryzens, > > https://developer.amd.com/wp-content/resources/55449_1.12.pdf > > > > Some of the issues listed there looks quite relevant to the potential > > hangs that some people still experience with the machines. I wrote > > a script which should apply the recommended workarounds to the erratas > > that I find interesting. > > > > To run it, kldload cpuctl, then apply the latest firmware update to your > > CPU, then run the following shell script. Comments indicate the errata > > number for the workarounds. > > > > Please report the results. If the script helps, I will code the kernel > > change to apply the workarounds. > > > > #!/bin/sh > > > > # Enable workarounds for erratas listed in > > # https://developer.amd.com/wp-content/resources/55449_1.12.pdf > > > > # 1057, 1109 > > sysctl machdep.idle_mwait=0 > > sysctl machdep.idle=hlt > > > > for x in /dev/cpuctl*; do > > # 1021 > > cpucontrol -m '0xc0011029|=0x2000' $x > > # 1033 > > cpucontrol -m '0xc0011020|=0x10' $x > > # 1049 > > cpucontrol -m '0xc0011028|=0x10' $x > > # 1095 > > cpucontrol -m '0xc0011020|=0x200000000000000' $x > > done > > > > Hi > > Thanks for the fix! I'm trying it now on my Ryzen 3 2200G which does > experience some random occasional resets. > > About updating to latest firmware, is this something that's done from BIOS or > from FreeBSD? If the latter, how? >From FreeBSD, install sysutils/devcpu-data then do service microcode_update start and of course, you must flash latest BIOS. The microcode_update must be applied before running this script.