Bug 1250977 - Improve ppc64 CPU driver
Summary: Improve ppc64 CPU driver
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: ppc64
OS: Linux
Target Milestone: rc
: ---
Assignee: Andrea Bolognani
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2015-08-06 11:38 UTC by Andrea Bolognani
Modified: 2018-03-22 10:49 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.17-5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-11-19 06:49:58 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Andrea Bolognani 2015-08-06 11:38:13 UTC
Description of problem:

  The output of the command

    $ virsh cpu-models ppc64

  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):


How reproducible:


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:


Comment 2 Andrea Bolognani 2015-08-11 13:58:47 UTC
This has been fixed upstream by the following commits:

    commit 96b2c7459cb689a27996c2d69131e245940bc533
    Author: Andrea Bolognani <abologna>
    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>
    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:


Comment 4 Dan Zheng 2015-08-13 07:52:57 UTC

Just briefly test using the scratch package on host POWER8E: 

Something need confirmation from you.
# virsh cpu-models ppc64le

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>
qemu ... -cpu host,compat=power8

      <cpu mode='host-model'>
    <model fallback='allow'>power7</model>
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 08:18:59 UTC
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 06:06:32 UTC
Test with below packages:

Below tests are done.
1. Check cpu-models output is updated with supported cpu models.
# virsh cpu-models ppc64

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

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>

# 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>
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>
   <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


All above tests are passed.

Comment 8 Dan Zheng 2015-08-14 06:08:11 UTC

The tests in comment 7 are done. Do you think it is enough? Welcome your suggestions. Thanks.

Comment 9 Dan Zheng 2015-08-18 05:45:34 UTC
Due to no new comments, mark it verified.

Comment 10 Andrea Bolognani 2015-08-31 09:08:50 UTC
The tests listed in Comment 7 seem to cover all of the correct

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

  <cpu mode='custom'>


  <cpu mode='host-model'>

prevents the guest from starting with an appropriate error

Comment 12 errata-xmlrpc 2015-11-19 06:49: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.


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