Bug 1449595

Summary: Check CPU cache for ABI stability
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Denemark <jdenemar>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: zhe peng <zpeng>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: dyuan, lhuang, rbalakri, xuzhang
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.2.0-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:08: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:

Description Jiri Denemark 2017-05-10 10:49:35 UTC
Description of problem:

It is possible to change CPU cache settings during migration (via the pre-migration hook or a custom XML) and libvirt won't complain about ABI incompatibility.

Version-Release number of selected component (if applicable):

libvirt-3.2.0-4.el7

How reproducible:

100%

Steps to Reproduce:
1. Start a new domain DOM
2. virsh dumpxml --migratable DOM >dom.xml
3. edit dom.xml and change CPU cache settings
4. virsh migrate --xml dom.xml DOM URI

Actual results:

Libvirt will successfully migrate the domain even though the CPU cache is different.

Expected results:

Libvirt should complain about target CPU cache not matching source.

Additional info:

See bug 1428952 which added the ability to set CPU cache.

Comment 1 Jiri Denemark 2017-05-10 10:59:12 UTC
Fixed upstream by

commit 1e9cf6e09ce242c94731bd21707dd3bcd41f854f
Refs: v3.3.0-21-g1e9cf6e09
Author:     Jiri Denemark <jdenemar>
AuthorDate: Tue May 9 16:03:19 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Wed May 10 11:20:07 2017 +0200

    conf: Check CPU cache for ABI stability

    Signed-off-by: Jiri Denemark <jdenemar>
    Reviewed-by: Daniel P. Berrange <berrange>

Comment 4 zhe peng 2017-06-13 03:32:01 UTC
verify with build:
libvirt-3.2.0-9.virtcov.el7.x86_64

step:
1. start a dom w/o cpu config
2.# virsh dumpxml --migratable rhel7 > dom.xml
3. edit xml and change CPU cache
 <cpu mode='host-model'>
    <model fallback='allow'/>
    <cache level='3' mode='emulate'/>
  </cpu>
4.do migrate
# virsh migrate rhel7 --xml dom.xml qemu+ssh://$targethost/system --verbose
error: unsupported configuration: Target CPU does not match source

5.edit xml 
disable + host-model
  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>
    <cache mode='disable'/>
  </cpu>
host-passthrough + l3
<cpu mode='host-passthrough' check='partial'>
    <cache level='3' mode='emulate'/>
  </cpu>
host-passthrough + passthrough
  <cpu mode='host-passthrough' check='partial'>
    <cache mode='passthrough'/>
  </cpu>
host-passthrough + disable
<cpu mode='host-passthrough' check='partial'>
    <cache mode='disable'/>
  </cpu>
all get error 
error: unsupported configuration: Target CPU does not match source

6. prepare a guest with cpu custom model
...
<cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>cpu64-rhel6</model>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='abm'/>
    <feature policy='disable' name='sse4a'/>
  </cpu>
...
repeat step 2 3
# virsh migrate rhel7 --xml dom.xml qemu+ssh://$targethost/system --verbose
error: unsupported configuration: Target CPU model Skylake-Client does not match source cpu64-rhel6

7. prepare a guest with cpu host model
start the guest
<cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Skylake-Client</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='pdpe1gb'/>
  </cpu>
repeat step 2 3
# virsh migrate rhel7 --xml dom.xml qemu+ssh://$targethost/system --verbose
error: unsupported configuration: Target CPU cache does not match source

move to verified.

Comment 5 errata-xmlrpc 2017-08-02 00:08: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/RHEA-2017:1846

Comment 6 errata-xmlrpc 2017-08-02 01:32:35 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-2017:1846