Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 822616

Summary: -cpu enforce with wrong cpu flags does not cause qemu-kvm process quit
Product: Red Hat Enterprise Linux 7 Reporter: Eduardo Habkost <ehabkost>
Component: qemu-kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: areis, bcao, ehabkost, huding, juzhang, knoel, mkenneth, tburke, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: upstream qemu-1.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 692374
: 1055532 (view as bug list) Environment:
Last Closed: 2014-06-13 09:26:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 822148, 1055532    

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