This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1250977 - Improve ppc64 CPU driver
Improve ppc64 CPU driver
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
ppc64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Andrea Bolognani
Virtualization Bugs
: Upstream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-06 07:38 EDT by Andrea Bolognani
Modified: 2015-11-19 01:49 EST (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.2.17-5.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 01:49:58 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andrea Bolognani 2015-08-06 07:38:13 EDT
Description of problem:

  The output of the command

    $ virsh cpu-models ppc64
    POWERPC_e6500
    POWERPC_e5500
    power8
    power8e
    power7+
    power7
    power6
    POWER8_v1.0
    POWER7+_v2.1
    POWER7_v2.3
    POWER7_v2.1
    POWER7

  includes some values, eg. POWER7_v2.1, that are not recognized by QEMU,
  and others, like power8e, that don't even look like proper CPU models.

  Moreover, even the values that *do* work are way too specific. Due to
  the way KVM works on POWER, you can only run a guest if its CPU model
  matches the host CPU model exactly; to make the situation manageable,
  more generic CPU models, eg. POWER8, have been introduced in QEMU and
  the recommended configuration is to use those instead of eg. the
  overspecific POWER8_v1.0.

  So libvirt should only advertise CPU models that can actually be used
  in the guest configuration, and should make sure that compatibility is
  reported correctly, eg. POWER7 guest can run on all POWER7* hosts but
  not on a POWER8* host.

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

  libvirt-daemon-1.2.17-3.el7.ppc64le

How reproducible:

  Always.

Steps to Reproduce:

  1. Configure a guest to use the power8e CPU model
  2. Start the guest

Actual results:

  error: Failed to start domain test
  error: internal error: process exited while connecting to monitor:
         Unable to find PowerPC CPU definition

Expected results:

  libvirt only advertises actual CPU models and handles compatibility
  between the guest and the host appropriately.

Additional info:

  None.
Comment 2 Andrea Bolognani 2015-08-11 09:58:47 EDT
This has been fixed upstream by the following commits:

    commit 96b2c7459cb689a27996c2d69131e245940bc533
    Author: Andrea Bolognani <abologna@redhat.com>
    Date:   Fri Aug 7 17:39:10 2015 +0200

        cpu: CPU model names have to match on ppc64
        
        Limitations of the POWER architecture mean that you can't run
        eg. a POWER7 guest on a POWER8 host when using KVM. This applies
        to all guests, not just those using VIR_CPU_MATCH_STRICT in the
        CPU definition; in fact, exact and strict CPU matching are
        basically the same on ppc64.
        
        This means, of course, that hosts using different CPUs have to be
        considered incompatible as well.
        
        Change ppc64Compute(), called by cpuGuestData(), to reflect this
        fact and update test cases accordingly.
        
        Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977

    commit d87359af5eb5b21848da1906f8e34f107bbea151
    Author: Andrea Bolognani <abologna@redhat.com>
    Date:   Fri Aug 7 17:39:15 2015 +0200

        cpu: Simplify ppc64 part of CPU map XML
        
        Use multiple PVRs per CPU model to reduce the number of models we
        need to keep track of.
        
        Remove specific CPU models (eg. POWER7+_v2.1): the corresponding
        generic CPU model (eg. POWER7) should be used instead to ensure
        the guest can be booted on any compatible host.
        
        Get rid of all the entries that did not match any of the CPU
        models supported by QEMU, like power8 and power8e.
        
        Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977

Complete series:

    https://www.redhat.com/archives/libvir-list/2015-August/msg00288.html
Comment 4 Dan Zheng 2015-08-13 03:52:57 EDT
Andrea,

Just briefly test using the scratch package on host POWER8E: 
libvirt-1.2.17-4.el7+abologna+bz1250977.ppc64le

Something need confirmation from you.
# virsh cpu-models ppc64le
POWERPC_e6500
POWERPC_e5500
POWER8
POWER7
POWER6

Using configuration below:
 <cpu><model>POWER8</model></cpu> can work
  <cpu><model>POWER7</model></cpu> can print error message as expected.

But a guest can start successfully using below two cpu configurations too.
    <cpu mode='host-model'>
    <model fallback='forbid'>power8</model>
  </cpu>
qemu ... -cpu host,compat=power8

or 
      <cpu mode='host-model'>
    <model fallback='allow'>power7</model>
  </cpu>
qemu ... -cpu host,compat=power7


Question :
'power7' and 'power8' did work before. But as now they are not listed in  virsh cpu-models ppc64 any more, it is a little inconsistent, right? What is your opinion?
Comment 5 Andrea Bolognani 2015-08-13 04:18:59 EDT
The thing about CPU models 'power7' and 'power8' is that they are
not actually CPU models: they are compatibility modes, and can
only be used inside

  <cpu mode='host-model'/>

Using the <model> tag to specify compatibility was IMHO a bad
choice, as it mixes the two concepts; adding a new <compat> tag
instead would have been much better. However, that's how it's
been implemented and we can't really change it now.

Compatibility modes will probably be advertised by libvirt at
some point, but not among actual CPU models.

Hopefully this explanation clears things up. It not, feel free
to ask more questions :)
Comment 7 Dan Zheng 2015-08-14 02:06:32 EDT
Test with below packages:
libvirt-1.2.17-5.el7.ppc64le
qemu-kvm-rhev-2.3.0-17.el7.ppc64le
kernel-3.10.0-302.el7.ppc64le

Below tests are done.
1. Check cpu-models output is updated with supported cpu models.
# virsh cpu-models ppc64
POWERPC_e6500
POWERPC_e5500
POWER8
POWER7
POWER6

2.Check model 'POWER8' can be supported for the guest. Guest can start successfully.  Qemu command line includes below option: '-cpu POWER8'
<cpu><model>POWER8</model></cpu>
or 
<cpu mode='custom' match='exact'>
    <model fallback='allow'>POWER8</model>
</cpu>

ALso test match='strict', 'minimum', the guest can start.

3.Check POWER7 guest can not run on a POWER8(POWER8E) host when using KVM
Edit XML like below, start the guest.
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>POWER7</model>
  </cpu>

# virsh start q2
error: Failed to start domain q2
error: unsupported configuration: guest and host CPU are not compatible: host CPU model does not match required CPU model POWER7

Try match='strict', 'minimum', and the error message should be same.

4. Test  compatibility mode.
Edit the guest XML like below and start the guest.
  <cpu mode='host-model'>
    <model fallback='forbid'>power8</model>
  </cpu>
The guest can be started successfully.
When power8,  '-cpu host,compat=power8' should be in qemu command line.
When power7,  '-cpu host,compat=power7' should be in qemu command line.


Change 'power8' to 'power7' to test, the result is same as above.

5.Check below configurations should always work like before.
The guest should be able to start successfully. Check qemu process, 
' -cpu host'  should be in qemu command line.

   <cpu mode='host-model'> </cpu>
or 
   <cpu mode='host-passthrough'> </cpu>

6. Check # virsh capabilities has new model displayed. '<model>POWER8</model>' is displayed instead of  '<model>power8e</model>'
# virsh capabilities
<capabilities>

  <host>
    <uuid>113bc7e1-c986-4f34-acc4-01dcfdce8678</uuid>
    <cpu>
      <arch>ppc64le</arch>
      <model>POWER8</model>
      <vendor>IBM</vendor>
...
</capabilities>


All above tests are passed.
Comment 8 Dan Zheng 2015-08-14 02:08:11 EDT
Andrea,

The tests in comment 7 are done. Do you think it is enough? Welcome your suggestions. Thanks.
Comment 9 Dan Zheng 2015-08-18 01:45:34 EDT
Due to no new comments, mark it verified.
Comment 10 Andrea Bolognani 2015-08-31 05:08:50 EDT
The tests listed in Comment 7 seem to cover all of the correct
configurations.

If you want to be more thorough, you could also check that
using invalid model names or compatibility modes, eg.

  <cpu mode='custom'>
    <model>POWER42</model>
  </cpu>

or

  <cpu mode='host-model'>
    <model>power42</model>
  </cpu>

prevents the guest from starting with an appropriate error
message.
Comment 12 errata-xmlrpc 2015-11-19 01:49:58 EST
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://rhn.redhat.com/errata/RHBA-2015-2202.html

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