Bug 822616 - -cpu enforce with wrong cpu flags does not cause qemu-kvm process quit
Summary: -cpu enforce with wrong cpu flags does not cause qemu-kvm process quit
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Eduardo Habkost
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 822148 1055532
TreeView+ depends on / blocked
 
Reported: 2012-05-17 15:44 UTC by Eduardo Habkost
Modified: 2014-06-18 03:16 UTC (History)
10 users (show)

Fixed In Version: upstream qemu-1.4.0
Doc Type: Bug Fix
Doc Text:
Clone Of: 692374
: 1055532 (view as bug list)
Environment:
Last Closed: 2014-06-13 09:26:47 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Eduardo Habkost 2012-05-17 15:44:08 UTC
Cloning this for RHEL7, to make sure we fix it on RHEL7 too.

+++ This bug was initially created as a clone of Bug #692374 +++

Description of problem:


Version-Release number of selected component (if applicable):
# uname -r
2.6.32-128.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.153.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.<commandline> -cpu Penryn,+ace,enforce ( ace is the flag on Westmere cpu model)
2.<commandLine> -cpu Conroe,+smx,enforce ( smx is the flag on Westmere cpu model)
3.<commandLine> -cpu Nehalem,+ace,enforce

Actual results:
QEMU runs in both cases

Expected results:
QEMU does not run

Additional info:
#<commandLine> -cpu host,+ace,enforce
CPU feature ace not found
warning: host cpuid 0000_0001:ecx flag restricted to guest 'vmx' [0x00000020]
Unable to support requested x86 CPU definition

#<commandLine> -cpu cpu64-rhel6,+ace,enforce
CPU feature ace not found
warning: host cpuid 8000_0001:ecx lacks requested flag 'svm' [0x00000004]
warning: host cpuid 8000_0001:ecx lacks requested flag 'abm' [0x00000020]
warning: host cpuid 8000_0001:ecx lacks requested flag 'sse4a' [0x00000040]
Unable to support requested x86 CPU definition

--- Additional comment from john.cooper@redhat.com on 2011-04-05 20:40:47 EDT ---

Yes that is the default "-cpu" flag parsing of qemu, namely it doesn't
bail if unknown flags are present:

# x86_64-softmmu/qemu-system-x86_64 -smp 1 -netic -net user ../../winxp-64.img \
    -m 1024 -cpu Penryn,+popcnt,+ou812,+sse4_2,check 
Using CPU model "Penryn,+popcnt,+ou812,+sse4_2,check"
CPU feature ou812 not found
warning: host cpuid 0000_0001:ecx lacks requested flag 'sse4.2|sse4_2' [0x00100000]
warning: host cpuid 0000_0001:ecx lacks requested flag 'popcnt' [0x00800000]

<guest launches>


But you're right "enforce" semantics should be held (in addition to
complaining) and qemu should error exit.  It's a nit and should be
cleaned up the next time we're in that section of the code.

--- Additional comment from ehabkost@redhat.com on 2012-03-27 15:56:03 EDT ---

Not only non-existing flags are not rejected properly, but also flags that exist, are supported by the host, but unsupported by the kernel. e.g.:

-cpu Opteron_G3,+ht,-svm,enforce

HT is not supported by the KVM kernel module and gets disabled, but Qemu continues to run without aborting.

--- Additional comment from ehabkost@redhat.com on 2012-04-20 16:46:49 EDT ---

*** Bug 813132 has been marked as a duplicate of this bug. ***

Comment 2 huiqingding 2014-01-20 09:24:46 UTC
Reproduce this bug using the following version:
kernel-3.7.0-0.36.el7.x86_64
qemu-kvm-1.3.0-6.el7.x86_64

On SandyBridge host, add the flags of Haswell to the guest

Steps to Reproduce:
1.<commandline> -cpu Penryn,+fma,enforce ( fma is the flag on Haswell cpu model)
2.<commandLine> -cpu Conroe,+hle,enforce ( hle is the flag on Haswell cpu model)
3.<commandLine> -cpu Nehalem,+avx2,enforce ( avx2 is the flag on Haswell cpu model)

Actual results:
After step1, 2, 3, the guest can boot and qemu-kvm is not quit.

Verify this bug using the following version:
kernel-3.10.0-67.el7.x86_64
qemu-kvm-1.5.3-38.el7.x86_64

Verification steps:
1.<commandline> -cpu Penryn,+fma,enforce ( fma is the flag on Haswell cpu model)
2.<commandLine> -cpu Conroe,+hle,enforce ( hle is the flag on Haswell cpu model)
3.<commandLine> -cpu Nehalem,+avx2,enforce ( avx2 is the flag on Haswell cpu model)

Actual results:
After step1, qemu-kvm quits with the info:
(qemu) warning: host doesn't support requested feature: CPUID.01H:ECX.fma [bit 12]
qemu-kvm: Host's CPU doesn't support requested features
After step2, qemu-kv quits with the info:
(qemu) warning: host doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
qemu-kvm: Host's CPU doesn't support requested features
After step3, qemu-kvm quits with the info:
(qemu) warning: host doesn't support requested feature: CPUID.07H:EBX.avx2 [bit 5]
qemu-kvm: Host's CPU doesn't support requested features

Comment 3 huiqingding 2014-01-20 09:31:46 UTC
Hi, Eduardo,

I also test a non-existing flag like "aaa" using qemu-kvm-1.5.3-38.el7.x86_64

The steps is:
1.<commandline> -cpu Penryn,+aaa,enforce

The result is that qemu-kvm will not quit, guest can boot and qemu-kvm outputs the following info:
(qemu) CPU feature aaa not found

I think qemu-kvm should quit. If I'm wrong, please fix me. Thanks a lot.

Best regards
Huiqing

Comment 4 Eduardo Habkost 2014-01-20 13:50:13 UTC
(In reply to huiqingding from comment #3)
> Hi, Eduardo,
> 
> I also test a non-existing flag like "aaa" using qemu-kvm-1.5.3-38.el7.x86_64
> 
> The steps is:
> 1.<commandline> -cpu Penryn,+aaa,enforce
> 
> The result is that qemu-kvm will not quit, guest can boot and qemu-kvm
> outputs the following info:
> (qemu) CPU feature aaa not found
> 
> I think qemu-kvm should quit. If I'm wrong, please fix me. Thanks a lot.

qemu-kvm should quit, but this doesn't affect libvirt because libvirt never does that (and we don't support running qemu-kvm directly). So I opened a new bug for that: bug 1055532.

Comment 6 Ludek Smid 2014-06-13 09:26:47 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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