Bug 1396536

Summary: qemu-kvm-rhev: POWER8 CPU model is listed twice in 'query-cpu-definitions' output
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Bolognani <abologna>
Component: qemu-kvm-rhevAssignee: David Gibson <dgibson>
Status: CLOSED ERRATA QA Contact: Xu Han <xuhan>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.3CC: knoel, michen, mrezanin, qzhang, thuth, virt-maint, xuhan, zhengtli
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:39:45 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 Andrea Bolognani 2016-11-18 15:08:54 UTC
When using TCG, QEMU reports each CPU model exactly once in the
output of query-cpu-definitions:

  $ /usr/libexec/qemu-kvm -M none,accel=tcg -qmp stdio
  {"QMP": {"version": {"qemu": {"micro": 0, "minor": 6, "major": 2}, "package": " (qemu-kvm-rhev-2.6.0-27.el7)"}, "capabilities": []}}
  VNC server running on '::1;5900'
  {'execute': 'qmp_capabilities'}
  {"return": {}}
  {'execute': 'query-kvm'}
  {"return": {"enabled": false, "present": true}}
  {'execute': 'query-cpu-definitions'}
  {"return": [{"name": "POWER8NVL"}, {"name": "POWER8"}, {"name": "POWER8E"}, {"name": "POWER7+"}, {"name": "POWER7"}, {"name": "POWER7+_v2.1"}, {"name": "POWER8E_v2.1"}, {"name": "POWER8_v2.0"}, {"name": "POWER8NVL_v1.0"}, {"name": "POWER7_v2.3"}]}
  ^Cqemu-kvm: terminating on signal 2
  {"timestamp": {"seconds": 1479481363, "microseconds": 855406}, "event": "SHUTDOWN"}

When using KVM, on the other hand, the POWER8 CPU model is
listed twice:

  $ /usr/libexec/qemu-kvm -M none,accel=kvm -qmp stdio
  {"QMP": {"version": {"qemu": {"micro": 0, "minor": 6, "major": 2}, "package": " (qemu-kvm-rhev-2.6.0-27.el7)"}, "capabilities": []}}
  VNC server running on '::1;5900'
  {'execute': 'qmp_capabilities'}
  {"return": {}}
  {'execute': 'query-kvm'}
  {"return": {"enabled": true, "present": true}}
  {'execute': 'query-cpu-definitions'}
  {"return": [{"name": "POWER8NVL"}, {"name": "POWER8"}, {"name": "POWER8E"}, {"name": "POWER7+"}, {"name": "POWER7"}, {"name": "POWER7+_v2.1"}, {"name": "POWER8E_v2.1"}, {"name": "POWER8"}, {"name": "host"}, {"name": "POWER8_v2.0"}, {"name": "POWER8NVL_v1.0"}, {"name": "POWER7_v2.3"}]}
  ^Cqemu-kvm: terminating on signal 2
  {"timestamp": {"seconds": 1479481323, "microseconds": 38849}, "event": "SHUTDOWN"}

My guess is that this is caused by the fact that the POWER8
model is redefined at runtime to use the same PVR as the
host.

This is not causing any issues for libvirt as we filter out
duplicated entries, but other QMP consumers might not do the
same. Moreover, it just looks weird :)


qemu-kvm-rhev-2.6.0-27.el7.ppc64le

Comment 2 David Gibson 2016-11-28 05:27:59 UTC
I've verified this happens on current upstream as well.  Looking at the code hasn't made it obvious why, so I'm starting more detailed debugging.

Comment 3 David Gibson 2016-11-28 06:13:29 UTC
Ok, I've tracked this down to 5b79b1c "target-ppc: Create versionless CPU class per family if KVM"; the "family" type it creates for KVM shadows one of the fixed aliases used in TCG.  Need to think further about how to fix it.

Comment 4 David Gibson 2016-11-29 04:20:35 UTC
Hm,

So my plan on how to fix it was to just not list aliases from the fixed table if they've been shadowed by an explicit cpu definition with the same name.  That would effectively make the special kvm "family" definition replace the TCG one instead of listing both in the query.

Then I realised that if I merge my patch in 2.9 which means we always go through core objects to construct CPUs, rather than falling back to constructing, then we may not need this "family" version of the host cpu type anyway.  We could then remove it, which will also fix this problem.

Comment 5 Thomas Huth 2017-01-31 13:17:35 UTC
David, not sure about the state of your fix that you mentioned in comment 4, but anyway, I've now also suggested a patch on qemu-devel that also fixes another problem (the bad CPU alias in the output of "-cpu ?"):
http://marc.info/?i=1485868319-16151-2-git-send-email-thuth@redhat.com

Comment 6 David Gibson 2017-02-09 00:13:35 UTC
This is merged upstream, so we should get it in the rebase to 2.9.

Comment 7 Zhengtong 2017-04-25 02:52:40 UTC
The bug can be reproduced easily with qemu-kvm-rhev-2.6.0-27.el7 build version. the output is exactly the same with that in comment 0.

The issue was fixed in my testing with the new qemu-kvm-rhev-2.9.0-1.el7 build version. my testing output is as follows:


[root@ibm-p8-kvm-02-qe normal_guest]# /usr/libexec/qemu-kvm -M none,accel=tcg -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 9, "major": 2}, "package": "(qemu-kvm-rhev-2.9.0-1.el7)"}, "capabilities": []}}
VNC server running on ::1:5900
{'execute': 'qmp_capabilities'}
{"return": {}}
{'execute': 'query-kvm'}
{"return": {"enabled": false, "present": true}}
{'execute': 'query-cpu-definitions'}
{"return": [{"name": "POWER8NVL", "typename": "POWER8NVL_v1.0-powerpc64-cpu", "static": false}, {"name": "POWER8", "typename": "POWER8_v2.0-powerpc64-cpu", "static": false}, {"name": "POWER8E", "typename": "POWER8E_v2.1-powerpc64-cpu", "static": false}, {"name": "POWER7+", "typename": "POWER7+_v2.1-powerpc64-cpu", "static": false}, {"name": "POWER7", "typename": "POWER7_v2.3-powerpc64-cpu", "static": false}, {"name": "POWER8_v2.0", "typename": "", "static": false}, {"name": "POWER8NVL_v1.0", "typename": "", "static": false}, {"name": "POWER8E_v2.1", "typename": "", "static": false}, {"name": "POWER7_v2.3", "typename": "", "static": false}, {"name": "POWER7+_v2.1", "typename": "", "static": false}]}
^Cqemu-kvm: terminating on signal 2
{"timestamp": {"seconds": 1493088532, "microseconds": 544903}, "event": "SHUTDOWN"}
[root@ibm-p8-kvm-02-qe normal_guest]# /usr/libexec/qemu-kvm -M none,accel=kvm -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 9, "major": 2}, "package": "(qemu-kvm-rhev-2.9.0-1.el7)"}, "capabilities": []}}
VNC server running on ::1:5900
{'execute': 'qmp_capabilities'}
{"return": {}}
{'execute': 'query-kvm'}
{"return": {"enabled": true, "present": true}}
{'execute': 'query-cpu-definitions'}
{"return": [{"name": "POWER8NVL", "typename": "POWER8NVL_v1.0-powerpc64-cpu", "static": false}, {"name": "POWER8", "typename": "POWER8E_v2.1-powerpc64-cpu", "static": false}, {"name": "POWER8E", "typename": "POWER8E_v2.1-powerpc64-cpu", "static": false}, {"name": "POWER7+", "typename": "POWER7+_v2.1-powerpc64-cpu", "static": false}, {"name": "POWER7", "typename": "POWER7_v2.3-powerpc64-cpu", "static": false}, {"name": "POWER8_v2.0", "typename": "", "static": false}, {"name": "host", "typename": "", "static": false}, {"name": "POWER8NVL_v1.0", "typename": "", "static": false}, {"name": "POWER8E_v2.1", "typename": "", "static": false}, {"name": "POWER7_v2.3", "typename": "", "static": false}, {"name": "POWER7+_v2.1", "typename": "", "static": false}]}
^Cqemu-kvm: terminating on signal 2
{"timestamp": {"seconds": 1493088586, "microseconds": 113879}, "event": "SHUTDOWN"}


The number of cpu properties for each cpu type is more. But all are different with each other.  

So this bug was fixed on the version qemu-kvm-rhev-2.9.0-1.el7

Comment 9 errata-xmlrpc 2017-08-01 23:39:45 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-2017:2392

Comment 10 errata-xmlrpc 2017-08-02 01:17:23 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-2017:2392

Comment 11 errata-xmlrpc 2017-08-02 02:09:23 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-2017:2392

Comment 12 errata-xmlrpc 2017-08-02 02:50:09 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-2017:2392

Comment 13 errata-xmlrpc 2017-08-02 03:14:52 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-2017:2392

Comment 14 errata-xmlrpc 2017-08-02 03:35:00 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-2017:2392