Bug 1237025

Summary: Guest can not start with different combinations of <cpu> mode and <model>
Product: Red Hat Enterprise Linux 7 Reporter: Dan Zheng <dzheng>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 7.2CC: abologna, dyuan, gsun, lhuang, mzhan, rbalakri, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-31 09:17:31 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 Dan Zheng 2015-06-30 08:40:32 UTC
Description of problem:
Guest can not start with three combinations of cpu mode and model as below.

Scenarios tested and results:

Scenario a: host-model + power8, pass
Scenario b: custom + power8, fail
Scenario c: host-model + power8e, fail
Scenario d: custom + power8e, fail

Version-Release number of selected component (if applicable):
libvirt-1.2.16-1.el7.ppc64le
qemu-kvm-rhev-2.3.0-5.el7.ppc64le
kernel-3.10.0-282.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:
Scenario a: host-model + power8, Pass

1. Start guest with below setting, and guest can be started successfully.

# virsh dumpxml dzhengvm1
<cpu mode='host-model'>
<model fallback='allow'>power8</model>
</cpu>


2. Check qemu process, -cpu host,compat=power8 is included in qemu command line.
root@ibm-p8-kvm-02-qe ~]# ps -ef|grep dzheng
qemu 93149 1 93 04:00 ? 00:00:03 /usr/libexec/qemu-kvm -name dzhengvm1 -S -machine pseries-rhel7.2.0,accel=kvm,usb=off -cpu host,compat=power8 -m 4000 -realtime mlock=off -smp

3. Check in guest, POWER8 is displayed as cpu model.
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
cpu : POWER8 (architected), altivec supported
clock : 3425.000000MHz
revision : 2.1 (pvr 004b 0201)

processor : 1
cpu : POWER8 (architected), altivec supported
clock : 3425.000000MHz
revision : 2.1 (pvr 004b 0201)
...


********************************************************
Scenario b: custom + power8, Fail
1. Change cpu mode to custom, keep left things as it is.
<cpu mode='custom'>
<model fallback='allow'>power8</model>
</cpu>

2. Start guest and failed.
# virsh start dzhengvm1
error: Failed to start domain dzhengvm1
error: unsupported configuration: CPU model power8 is not supported by hypervisor

Actual result:
Guest can not start when custom mode and power8 model are set.

Expected result:
Guest should be able to start with custom mode and power8 model.


******************************************************
Scenario c: host-model + power8e , Fail
1. Edit guest with power8e model as below:
# virsh dumpxml dzhengvm1
<cpu mode='host-model'>
  <model fallback='allow'>power8e</model>
</cpu>
 
2. Start guest and fail.
# virsh start dzhengvm1
error: Failed to start domain dzhengvm1
error: internal error: process exited while connecting to monitor: 2015-06-30T06:16:12.138660Z qemu-kvm: Invalid compatibility mode "power8e"
Unable to find PowerPC CPU definition

Note: same error with POWER8E .

3. Check cpu_map.xml # cat /usr/share/libvirt/cpu_map.xml, power8/power8e is defined.
<arch name='ppc64'>
<!-- vendor definitions -->
<vendor name='IBM'/>
<vendor name='Freescale'/>
     ...
<model name='power8e'>
<vendor name='IBM'/>
<compat isa='2.07'/>
<pvr value='0x004b0000'/>
</model>

<model name='power8'>
<vendor name='IBM'/>
<compat isa='2.07'/>
<pvr value='0x004d0000'/>
</model>
...

4. Check qemu-kvm -cpu help
...
PowerPC POWER8E_v1.0     PVR 004b0100
PowerPC POWER8E          (alias for POWER8E_v1.0)
PowerPC POWER8_v1.0      PVR 004d0100
PowerPC POWER8           (alias for POWER8_v1.0)
...

Actual result:
Guest can not start when host-model and power8e are set.

Expected result:
Guest should be able to start correctly.

Additional information:
1.Start guest using setting and guest can be started successfully.
<cpu mode='host-model'>
<model fallback='allow'/>
</cpu>

2. Check qemu process, -cpu host is used.
qemu     156148      1 90 23:25 ?        00:00:05 /usr/libexec/qemu-kvm -name dzhengvm1 -S -machine pseries-rhel7.2.0,accel=kvm,usb=off -cpu host -m 4000 -realtime mlock=off -smp

3. Check capabilities XML, power8e is used as cpu model on host.
# virsh capabilities
<capabilities>

  <host>
    <uuid>a1f3ea1d-8893-4317-a152-e6bc0ee6caab</uuid>
    <cpu>
      <arch>ppc64le</arch>
      <model>power8e</model>
      <vendor>IBM</vendor>
      <topology sockets='1' cores='160' threads='1'/>
      <pages unit='KiB' size='64'/>
      <pages unit='KiB' size='16384'/>
      <pages unit='KiB' size='16777216'/>
    </cpu>
4. Check within guest
# cat /proc/cpuinfo
processor        : 0
cpu                : POWER8E (raw), altivec supported
clock                : 3425.000000MHz
revision        : 2.1 (pvr 004b 0201)
...
timebase        : 512000000
platform        : pSeries
model                : IBM pSeries (emulated by qemu)
machine                : CHRP IBM pSeries (emulated by qemu)



*******************************************************************
Scenario d: custom + power8e, Fail
1. Change mode from host-model to custom, guest fails to start, either.
<cpu mode='custom'>
<model fallback='allow'>power8e</model>
</cpu>

2.# virsh start dzhengvm1
error: Failed to start domain dzhengvm1
error: unsupported configuration: CPU model power8e is not supported by hypervisor

Actual result:
Guest fails to start when mode=custom and model=power8e

Expected result:
Guest should be started successfully when mode=custom and model=power8e because power8e is supported on host (in capabilities XML) and guest can run with power8e (see inside of guest)

Comment 2 Andrea Bolognani 2015-08-31 09:17:31 UTC
The failing cases where not supposed to be working in the
first place. Moreover, any confusion caused by listing
compatibility modes along with CPU models and reporting
the host CPU model as 'power8e' should have been removed
as part of

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

Closing this as NOTABUG.