Bug 1432588

Summary: Some compat_props properties override -cpu command-line options
Product: Red Hat Enterprise Linux 7 Reporter: Eduardo Habkost <ehabkost>
Component: qemu-kvm-rhevAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED ERRATA QA Contact: Guo, Zhiyi <zhguo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: ailan, bsd, chayang, jinzhao, juzhang, michen, mrezanin, virt-maint, xfu, zhguo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
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-02 03:39:56 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 Eduardo Habkost 2017-03-15 17:42:27 UTC
Description of problem:
Device properties set on machine-type's compat_props can't be overwritten by command-line options like "-cpu".

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-27.el7.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Boot VM with: /usr/libexec/qemu-kvm -machine pc-i440fx-rhel7.2.0,accel=kvm -cpu Westmere,arat=on,enforce [...]
2. Check guest /proc/cpuinfo

Actual results:
"arat" flag is not present on guest CPUID.

Expected results:
"arat" flag should be present when explicitly set on the command-line.

Additional info:
Fixed by upstream commit:

commit 0bcba41fe379e4c6834adcf1456d9099db31a5b2
Author: Eduardo Habkost <ehabkost>
Date:   Mon Dec 12 18:49:05 2016 -0200

    machine: Convert abstract typename on compat_props to subclass names

Comment 1 Eduardo Habkost 2017-03-15 17:43:40 UTC
Fixed by upstream commit:

commit 0bcba41fe379e4c6834adcf1456d9099db31a5b2
Author: Eduardo Habkost <ehabkost>
Date:   Mon Dec 12 18:49:05 2016 -0200

    machine: Convert abstract typename on compat_props to subclass names
    
    Original problem description by Greg Kurz:
    
    > Since commit "9a4c0e220d8a hw/virtio-pci: fix virtio
    > behaviour", passing -device virtio-blk-pci.disable-modern=off
    > has no effect on 2.6 machine types because the internal
    > virtio-pci.disable-modern=on compat property always prevail.
    
    The same bug also affects other abstract type names mentioned on
    compat_props by machine-types: apic-common, i386-cpu, pci-device,
    powerpc64-cpu, s390-skeys, spapr-pci-host-bridge, usb-device,
    virtio-pci, x86_64-cpu.
    
    The right fix for this problem is to make sure compat_props and
    -global options are always applied in the order they are
    registered, instead of reordering them based on the type
    hierarchy. But changing the ordering rules of -global is risky
    and might break existing configurations, so we shouldn't do that
    on a stable branch.
    
    This is a temporary hack that will work around the bug when
    registering compat_props properties: if we find an abstract class
    on compat_props, register properties for all its non-abstract
    subtypes instead. This will make sure -global won't be overridden
    by compat_props, while keeping the existing ordering rules on
    -global options.
    
    Note that there's one case that won't be fixed by this hack:
    "-global spapr-pci-vfio-host-bridge.<option>=<value>" won't be
    able to override compat_props, because spapr-pci-host-bridge is
    not an abstract class.
    
    Signed-off-by: Eduardo Habkost <ehabkost>
    Message-Id: <1481575745-26120-1-git-send-email-ehabkost>
    Reviewed-by: Cornelia Huck <cornelia.huck.com>
    Reviewed-by: Halil Pasic <pasic.ibm.com>
    Reviewed-by: Greg Kurz <groug>
    Tested-by: Greg Kurz <groug>
    Signed-off-by: Eduardo Habkost <ehabkost>

Comment 3 jingzhao 2017-05-09 02:37:57 UTC
Reproduce the bz on qemu-kvm-rhev-2.6.0-28.el7_3.9.x86_64

Verified the bz on qemu-kvm-rhev-2.6.0-28.el7_3.9.x86_64

The detailed steps:
1) Boot guest with qemu cli[1]

2) Check arat flag in guest through "cat /proc/cpuinfo"

[root@localhost ~]# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 44
model name	: Westmere E56xx/L56xx/X56xx (Nehalem-C)
stepping	: 1
microcode	: 0x1
cpu MHz		: 3392.162
cache size	: 4096 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm arat
bogomips	: 6784.32
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 44
model name	: Westmere E56xx/L56xx/X56xx (Nehalem-C)
stepping	: 1
microcode	: 0x1
cpu MHz		: 3392.162
cache size	: 4096 KB
physical id	: 1
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm arat
bogomips	: 6784.32
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 44
model name	: Westmere E56xx/L56xx/X56xx (Nehalem-C)
stepping	: 1
microcode	: 0x1
cpu MHz		: 3392.162
cache size	: 4096 KB
physical id	: 2
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm arat
bogomips	: 6784.32
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 44
model name	: Westmere E56xx/L56xx/X56xx (Nehalem-C)
stepping	: 1
microcode	: 0x1
cpu MHz		: 3392.162
cache size	: 4096 KB
physical id	: 3
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm arat
bogomips	: 6784.32
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:


[1]
/usr/libexec/qemu-kvm \
-machine pc-i440fx-rhel7.2.0,accel=kvm \
-cpu Westmere,arat=on,enforce \
-nodefaults -rtc base=utc \
-m 4G \
-smp 4,sockets=4,cores=1,threads=1 \
-enable-kvm \
-uuid 990ea161-6b67-47b2-b803-19fb01d30d12 \
-k en-us \
-nodefaults \
-serial unix:/tmp/serial0,server,nowait \
-boot menu=on \
-qmp tcp:0:6666,server,nowait \
-vga qxl \
-chardev file,path=/home/seabios.log,id=seabios -device isa-debugcon,chardev=seabios,iobase=0x402 \
-drive file=/home/rhel74.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0 \
-device virtio-net-pci,netdev=tap10,mac=9a:6a:6b:6c:6d:6e -netdev tap,id=tap10 \
-monitor stdio \
-vnc :0 \


According to the above steps, changed it to verified.

Thanks
Jing

Comment 5 errata-xmlrpc 2017-08-02 03:39:56 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