RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1521202 - libvirt change the running guest cpu model after upgrade from 7.3
Summary: libvirt change the running guest cpu model after upgrade from 7.3
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks: libvirtCPUconfig
TreeView+ depends on / blocked
 
Reported: 2017-12-06 01:07 UTC by Luyao Huang
Modified: 2018-04-10 11:01 UTC (History)
10 users (show)

Fixed In Version: libvirt-3.9.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 11:00:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 11:01:32 UTC

Description Luyao Huang 2017-12-06 01:07:25 UTC
Description of problem:
libvirt change the running guest cpu model after upgrade, and it will introduce some compatibility issues

Version-Release number of selected component (if applicable):
libvirt-3.9.0-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a EPYC host:

# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                128
On-line CPU(s) list:   0-127
Thread(s) per core:    2
Core(s) per socket:    32
Socket(s):             2
NUMA node(s):          8
Vendor ID:             AuthenticAMD
CPU family:            23
Model:                 1
Model name:            AMD EPYC 7601 32-Core Processor

2. install 7.3 libvirt and qemu:

3. start a guest which use host-model:

# virsh dumpxml r7-mig
...
  <cpu mode='host-model'>
    <model fallback='allow'/>
...

# virsh start r7-mig
Domain r7-mig started

4. recheck xml:
# virsh dumpxml r7-mig
...
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <numa>
      <cell id='0' cpus='0-4' memory='524288' unit='KiB'/>
      <cell id='1' cpus='5-9' memory='524288' unit='KiB'/>
    </numa>
  </cpu>


# virsh dumpxml r7-mig --migratable
...
  <cpu mode='host-model' match='exact'>
    <model fallback='allow'>Opteron_G3</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='pclmuldq'/>
    <feature policy='require' name='ssse3'/>
    <feature policy='require' name='fma'/>
    <feature policy='require' name='sse4.1'/>
    <feature policy='require' name='sse4.2'/>
    <feature policy='require' name='movbe'/>
    <feature policy='require' name='aes'/>
    <feature policy='require' name='xsave'/>
    <feature policy='require' name='osxsave'/>
    <feature policy='require' name='avx'/>
    <feature policy='require' name='f16c'/>
    <feature policy='require' name='rdrand'/>
    <feature policy='require' name='arat'/>
    <feature policy='require' name='fsgsbase'/>
    <feature policy='require' name='bmi1'/>
    <feature policy='require' name='avx2'/>
    <feature policy='require' name='smep'/>
    <feature policy='require' name='bmi2'/>
    <feature policy='require' name='rdseed'/>
    <feature policy='require' name='adx'/>
    <feature policy='require' name='smap'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='xsaveopt'/>
    <feature policy='require' name='xsavec'/>
    <feature policy='require' name='xgetbv1'/>
    <feature policy='require' name='mmxext'/>
    <feature policy='require' name='fxsr_opt'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='extapic'/>
    <feature policy='require' name='cr8legacy'/>
    <feature policy='require' name='3dnowprefetch'/>
    <feature policy='require' name='osvw'/>
    <feature policy='require' name='skinit'/>
    <feature policy='require' name='wdt'/>
    <feature policy='require' name='tce'/>
    <feature policy='require' name='topoext'/>
    <feature policy='require' name='perfctr_core'/>
    <feature policy='require' name='perfctr_nb'/>
    <numa>
      <cell id='0' cpus='0-4' memory='524288' unit='KiB'/>
      <cell id='1' cpus='5-9' memory='524288' unit='KiB'/>
    </numa>
  </cpu>
...

5. update libvirt and qemu to 7.5:

6. recheck guest xml, libvirt change the model to EPYC:

# virsh dumpxml r7-mig
...
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='allow'>EPYC</model>
    <vendor>AMD</vendor>
    <feature policy='disable' name='ht'/>
    <feature policy='disable' name='osxsave'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='disable' name='extapic'/>
    <feature policy='disable' name='skinit'/>
    <feature policy='disable' name='wdt'/>
    <feature policy='disable' name='tce'/>
    <feature policy='disable' name='topoext'/>
    <feature policy='disable' name='perfctr_core'/>
    <feature policy='disable' name='perfctr_nb'/>
    <feature policy='disable' name='monitor'/>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='disable' name='sha-ni'/>
    <feature policy='disable' name='rdtscp'/>
    <feature policy='disable' name='svm'/>
...

# virsh dumpxml r7-mig --migratable
...
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>EPYC</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='osxsave'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='extapic'/>
    <feature policy='require' name='skinit'/>
    <feature policy='require' name='wdt'/>
    <feature policy='require' name='tce'/>
    <feature policy='require' name='topoext'/>
    <feature policy='require' name='perfctr_core'/>
    <feature policy='require' name='perfctr_nb'/>
...

7. this guest cannot migrate to 7.3 since there is no EPYC cpu model:
# virsh migrate r7-mig qemu+ssh://target/system --live
error: internal error: Unknown CPU model EPYC

8. and after managedsave and restart, libvirt will use EPYC cpu model to build qemu command line:

# ps aux|grep qemu
 ... -cpu Opteron_G3,+vme,+ht,+pclmuldq,+ssse3,+fma,+sse4.1,+sse4.2,+movbe,+aes,+xsave,+osxsave,+avx,+f16c,+rdrand,+arat,+fsgsbase,+bmi1,+avx2,+smep,+bmi2,+rdseed,+adx,+smap,+clflushopt,+xsaveopt,+xsavec,+xgetbv1,+mmxext,+fxsr_opt,+pdpe1gb,+cmp_legacy,+extapic,+cr8legacy,+3dnowprefetch,+osvw,+skinit,+wdt,+tce,+topoext,+perfctr_core,+perfctr_nb

# virsh managedsave r7-mig
Domain r7-mig state saved by libvirt

# virsh start r7-mig
Domain r7-mig started

# ps aux|grep qemu
 -cpu EPYC,ht=off,osxsave=off,cmp_legacy=on,extapic=off,skinit=off,wdt=off,tce=off,topoext=off,perfctr_core=off,perfctr_nb=off,monitor=off,x2apic=on,hypervisor=on,sha-ni=off,rdtscp=off,svm=off

Actual results:

libvirt change the cpu model after upgrade and cause the xml for migrate changed

Expected results:

Don't change the guest cpu model after upgrade

Additional info:

From bug 1481252 comment 10:

that's unfortunately caused by the older libvirt which did not store the actual CPU configuration it used to start the domain. Thus the libvirt needs to guess it. But apparently we don't do it the way we should. We should ask the running QEMU what CPU model it supports and only use one of the reported models.

Comment 2 Jiri Denemark 2017-12-07 13:20:45 UTC
Patches sent upstream for review: https://www.redhat.com/archives/libvir-list/2017-December/msg00250.html

Comment 3 Jiri Denemark 2017-12-08 15:14:03 UTC
Fixed upstream by

commit 4486dcdb4a386a906807d4eb7de586202e50cd18
Refs: v3.10.0-37-g4486dcdb4a
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Dec 7 11:21:48 2017 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Fri Dec 8 15:50:52 2017 +0100

    qemu: Separate fetching CPU definitions from filling qemuCaps

    virQEMUCapsProbeQMPCPUDefinitions is now a small wrapper which fills in
    qemuCaps with CPU models fetched by virQEMUCapsFetchCPUDefinitions.

    Signed-off-by: Jiri Denemark <jdenemar>

commit ce73de441d35e17a29b83b8741e668a6ddc013ba
Refs: v3.10.0-38-gce73de441d
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Dec 7 11:23:50 2017 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Fri Dec 8 15:50:52 2017 +0100

    qemu: Make sure host-model uses CPU model supported by QEMU

    When reconnecting to a running domain started by old libvirt, which did
    not change host-model into a custom CPU definition, we replace the CPU
    definition with a specific CPU model from host capabilities. However,
    that CPU model may not be supported by the running qemu process. We need
    to translate the CPU model to one of the models which libvirt could have
    used when starting the domain.

    https://bugzilla.redhat.com/show_bug.cgi?id=1521202

    Signed-off-by: Jiri Denemark <jdenemar>

Comment 6 Luyao Huang 2018-01-17 06:11:07 UTC
Hi jirka,

I found that still get failure when migrate to a rhel7.3 host, but the error is different this time (the step is the same with comment 0):

1. the guest xml before upgrade to 7.5:

  <cpu mode='host-model' match='exact'>
    <model fallback='forbid'>Opteron_G3</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='pclmuldq'/>
    <feature policy='require' name='ssse3'/>
    <feature policy='require' name='fma'/>
    <feature policy='require' name='sse4.1'/>
    <feature policy='require' name='sse4.2'/>
    <feature policy='require' name='movbe'/>
    <feature policy='require' name='aes'/>
    <feature policy='require' name='xsave'/>
    <feature policy='require' name='osxsave'/>
    <feature policy='require' name='avx'/>
    <feature policy='require' name='f16c'/>
    <feature policy='require' name='rdrand'/>
    <feature policy='require' name='arat'/>
    <feature policy='require' name='fsgsbase'/>
    <feature policy='require' name='bmi1'/>
    <feature policy='require' name='avx2'/>
    <feature policy='require' name='smep'/>
    <feature policy='require' name='bmi2'/>
    <feature policy='require' name='rdseed'/>
    <feature policy='require' name='adx'/>
    <feature policy='require' name='smap'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='xsaveopt'/>
    <feature policy='require' name='xsavec'/>
    <feature policy='require' name='xgetbv1'/>
    <feature policy='require' name='mmxext'/>
    <feature policy='require' name='fxsr_opt'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='extapic'/>
    <feature policy='require' name='cr8legacy'/>
    <feature policy='require' name='3dnowprefetch'/>
    <feature policy='require' name='osvw'/>
    <feature policy='require' name='skinit'/>
    <feature policy='require' name='wdt'/>
    <feature policy='require' name='tce'/>
    <feature policy='require' name='topoext'/>
    <feature policy='require' name='perfctr_core'/>
    <feature policy='require' name='perfctr_nb'/>
    <feature policy='require' name='ibpb'/>

2. guest xml after update to 7.5:

# virsh dumpxml vm1
...
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='allow'>Opteron_G5</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='movbe'/>
    <feature policy='require' name='rdrand'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='arat'/>
    <feature policy='require' name='fsgsbase'/>
    <feature policy='require' name='bmi1'/>
    <feature policy='require' name='avx2'/>
    <feature policy='require' name='smep'/>
    <feature policy='require' name='bmi2'/>
    <feature policy='require' name='rdseed'/>
    <feature policy='require' name='adx'/>
    <feature policy='require' name='smap'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='xsaveopt'/>
    <feature policy='require' name='xsavec'/>
    <feature policy='require' name='xgetbv1'/>
    <feature policy='require' name='mmxext'/>
    <feature policy='require' name='fxsr_opt'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='cr8legacy'/>
    <feature policy='require' name='osvw'/>
    <feature policy='require' name='ibpb'/>
    <feature policy='disable' name='rdtscp'/>
    <feature policy='disable' name='svm'/>
    <feature policy='disable' name='xop'/>
    <feature policy='disable' name='fma4'/>
    <feature policy='disable' name='tbm'/>
    <feature policy='disable' name='ht'/>
    <feature policy='disable' name='osxsave'/>
    <feature policy='disable' name='extapic'/>
    <feature policy='disable' name='skinit'/>
    <feature policy='disable' name='wdt'/>
    <feature policy='disable' name='tce'/>
    <feature policy='disable' name='topoext'/>
    <feature policy='disable' name='perfctr_core'/>
    <feature policy='disable' name='perfctr_nb'/>
    <feature policy='disable' name='monitor'/>
    <feature policy='disable' name='sha-ni'/>
...


# virsh dumpxml vm1 --migratable
...
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>EPYC</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='osxsave'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='extapic'/>
    <feature policy='require' name='skinit'/>
    <feature policy='require' name='wdt'/>
    <feature policy='require' name='tce'/>
    <feature policy='require' name='topoext'/>
    <feature policy='require' name='perfctr_core'/>
    <feature policy='require' name='perfctr_nb'/>
    <feature policy='require' name='ibpb'/>
...


# virsh migrate --live vm1 qemu+ssh://target/system
error: internal error: Unknown CPU feature sha-ni


Could you please help to check this issue ? Thanks in advance for your reply!

Comment 7 Jiri Denemark 2018-01-26 15:06:46 UTC
Sigh, it looks like a never ending punishment for not storing the actual CPU model used to start a domain with host-model CPU in the XML from the moment we added support for host-model. We could possibly try to avoid adding CPU features which were not available in the old libvirt into the guest CPU definition when replacing host-model for a running domain. However, we need to do it in a very smart way to avoid breaking migration to new libvirt.

Could you file a separate bug for that and keep this one just for the CPU model name change?

Comment 8 Luyao Huang 2018-01-29 02:26:06 UTC
(In reply to Jiri Denemark from comment #7)
> Sigh, it looks like a never ending punishment for not storing the actual CPU
> model used to start a domain with host-model CPU in the XML from the moment
> we added support for host-model. We could possibly try to avoid adding CPU
> features which were not available in the old libvirt into the guest CPU
> definition when replacing host-model for a running domain. However, we need
> to do it in a very smart way to avoid breaking migration to new libvirt.
> 
> Could you file a separate bug for that and keep this one just for the CPU
> model name change?

Okay, I have filed a new bug 1539484 to track this new issue, and thanks for your reply.

And verify this bug with comment 6, since the libvirt update the guest cpu to a old qemu supported cpu model, this cpu-model won't broke the migration.

Comment 12 errata-xmlrpc 2018-04-10 11:00:58 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/RHEA-2018:0704


Note You need to log in before you can comment on or make changes to this bug.