Bug 1445834

Summary: Add support for AMD EPYC processors
Product: Red Hat Enterprise Linux 7 Reporter: Paolo Bonzini <pbonzini>
Component: qemu-kvm-rhevAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED ERRATA QA Contact: Guo, Zhiyi <zhguo>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: ailan, chayang, c.justin88, ctatman, ehabkost, jan.public, jinzhao, juzhang, knoel, michen, mtessun, pasteur, pbonzini, rui.gouveia, virt-maint, zhguo
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.10.0-3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1445836 1450396 1481252 1524824 (view as bug list) Environment:
Last Closed: 2018-04-11 00:16:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1445836, 1450396, 1481252, 1524824    

Description Paolo Bonzini 2017-04-26 15:32:12 UTC
Based on LKML email, the processor has all the features in Opteron_G5 plus the following features:

cpu family	: 23
model		: 1
model name	: AMD Ryzen 7 1800X Eight-Core Processor
flags           :
mmxext fxsr_opt rdtscp movbe rdrand extapic cr8_legacy 3dnowprefetch fsgsbase 
bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1
xsaves clzero topoext

The "topoext" feature needs extra support in QEMU.

"bpext" and "mwaitx" may need KVM support too.

Comment 2 Paolo Bonzini 2017-04-27 10:24:05 UTC
> BTW, search from beaker, I have two suspects that maybe engineer samples of 
> Ryzen, but they lack some of flags comparing with yours: clzero bpext mwaitx  

Yes, they are engineering samples of Ryzen.  I'm not sure whether we have any machines with final parts.

Comment 5 Jan Vlug 2017-05-28 15:20:36 UTC
I added a similar issue for Fedora: bug 1456273

Comment 6 Paolo Bonzini 2017-05-29 12:02:01 UTC
Jan,

rhis is not related to your issue; it is only about adding a "-cpu" flag that enables Ryzen features for the virtual machine.

Comment 7 Eduardo Habkost 2017-07-26 13:18:16 UTC
There's also SMT ("Simultaneous multithreading") support.  See upstream bug:
https://bugs.launchpad.net/qemu/+bug/1703506

Comment 8 Eduardo Habkost 2017-08-14 12:52:04 UTC
libvirt bug created: bug 1481252.

SMT will be tracked at bug 1481253.

Comment 13 Eduardo Habkost 2017-08-24 22:27:53 UTC
Changing BZ summary to mention EPYC to avoid confusion.  EPYC CPU model was already submitted by AMD queued for inclusion upstream.

Comment 15 Eduardo Habkost 2017-10-05 21:14:50 UTC
Upstream commit:

commit 2e2efc7dbe2b0adc1200b5aa286cdbed729f6751
Author: Brijesh Singh <brijesh.singh>
Date:   Tue Aug 15 12:00:51 2017 -0500

    target-i386/cpu: Add new EPYC CPU model
    
    Add a new base CPU model called 'EPYC' to model processors from AMD EPYC
    family (which includes EPYC 76xx,75xx,74xx, 73xx and 72xx).
    
    The following features bits have been added/removed compare to Opteron_G5
    
    Added: monitor, movbe, rdrand, mmxext, ffxsr, rdtscp, cr8legacy, osvw,
           fsgsbase, bmi1, avx2, smep, bmi2, rdseed, adx, smap, clfshopt, sha
           xsaveopt, xsavec, xgetbv1, arat
    
    Removed: xop, fma4, tbm
    
    Cc: Paolo Bonzini <pbonzini>
    Cc: Richard Henderson <rth>
    Cc: Eduardo Habkost <ehabkost>
    Cc: Tom Lendacky <Thomas.Lendacky>
    Signed-off-by: Brijesh Singh <brijesh.singh>
    Message-Id: <20170815170051.127257-1-brijesh.singh>
    Reviewed-by: Eduardo Habkost <ehabkost>
    Signed-off-by: Eduardo Habkost <ehabkost>

Comment 16 Miroslav Rezanina 2017-10-20 09:31:37 UTC
Fix included in qemu-kvm-rhev-2.10.0-3.el7

Comment 20 Guo, Zhiyi 2017-11-09 16:16:19 UTC
Hi Edurado,

   Can I continue my test with -cpu EPYC,-rdtscp,enforce since rdtscp block the enforce option. Another interesting part is EPYC also delete some flags like fma4, does AMD not want guest boot with default, no customized cpu model like Opteron_G5 to be migrated to new EPYC host? Do I need to test migration from old host to new EPYC host?(Since intel really allow this)

BR/
Guo, Zhiyi

Comment 21 Eduardo Habkost 2017-11-09 19:23:13 UTC
If the RHEL-7.5 kernel doesn't support virtualizing RDTSCP yet (the upstream kernel does), we need to manually disable RDTSCP in the RHEL-7 machine-types.  I plan to do that soon, so please continue testing using "-cpu EPYC,-rdtscp,enforce".

About the missing fma4 feature: if the host really doesn't support it, migration of existing VMs with the FMA4 feature to a EPYC host will be impossible, and in this case all we can do is to ensure libvirt is preventing migration before it starts.  We can add a note about this on the test plan.

Comment 22 Paolo Bonzini 2017-11-10 08:07:41 UTC
Eduardo, adding support for RDTSCP on RHEL 7 is easy.  zhguo is opening a new bug for that.

Comment 23 Guo, Zhiyi 2017-11-10 08:25:52 UTC
Kernel side rdtscp bug:
Bug 1511805 - Kernel missing rdtscp for amd Ryzen/EPYC cpu model

Comment 28 errata-xmlrpc 2018-04-11 00:16:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:1104