Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 619259 - qemu "-cpu [check | enforce ]" should work even when a model name is not specified on the command line
qemu "-cpu [check | enforce ]" should work even when a model name is not spec...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
All Linux
low Severity medium
: beta
: 6.1
Assigned To: john cooper
Virtualization Bugs
: RHELNAK
Depends On: 601540
Blocks: 580953
  Show dependency treegraph
 
Reported: 2010-07-29 00:54 EDT by john cooper
Modified: 2014-07-24 23:46 EDT (History)
8 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.144.el6
Doc Type: Bug Fix
Doc Text:
Cause Launching qemu with "-cpu check" doesn't do as expected if a valid cpu model name isn't provided. Consequence "check" and "enforce" actions on the default model don't work and qemu falters with a CLI parsing error. Fix Due to qemu's current CLI argument parsing structure a cpu model name must be provided. So the pseudo name "default" is now recognized which allows "check" and "enforce" to function as expected on both default and "-M" implied cpu models. Result Intuitive and expected behavior for these options is maintained.
Story Points: ---
Clone Of: 601540
Environment:
Last Closed: 2011-05-19 07:33:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to resolve case. (2.32 KB, patch)
2011-01-26 22:56 EST, john cooper
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 07:20:36 EDT

  None (edit)
Comment 2 RHEL Product and Program Management 2010-07-29 01:27:42 EDT
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Comment 4 john cooper 2010-07-29 20:45:14 EDT
I'd envisioned it to be a 6.1 issue when I opened it.
But if sufficient justification exists from other
users to move it into 6.0 that wouldn't be unreasonable.
Comment 5 john cooper 2010-11-19 14:46:02 EST
Update: due to the internal structure of qemu's arg parsing, adding
this seemingly trivial feature is far more complex/ugly than it
should be.  Let's leave this on the table for now and I'll have
another look to see if some simpler solution exists.
Comment 7 john cooper 2011-01-26 22:55:04 EST
(In reply to comment #0)
> Description of problem:
> 
> Launching qemu with "-cpu check" doesn't do as expected
> if a valid cpu model name isn't provided.
> 
> Expected results:
> 
> This should work in cases where a model is being chosen
> implicitly, such as when launching via "-M <machine name>"
> in order to launder flags pulled in by the implied model.

Due to qemu's CLI argument parsing structure and the fact cpu models
are initialized depending on build configuration, supporting the
above is far more clunky than it ought to be.

The problem is omitting the cpu model "name" and allowing only feature
flags and modifiers breaks the existing parsing logic, which is
difficult to circumvent given the current implementation.  So as a
minor concession to a far more simple solution we add a pseudo model
name of "default" which expands internally to qemu's build
configuration default and is then interpreted conventionally.  The
result is then the following example usage:


    # x86_64-softmmu/qemu-system-x86_64 ../rhel6.0-beta.img -net nic -net user -m 1024 
    Using CPU model "cpu64-rhel6"
      :

    # 86_64-softmmu/qemu-system-x86_64 ../rhel6.0-beta.img -net nic -net user -m 1024 -cpu default,check
    Using CPU model "cpu64-rhel6,check"
    warning: host cpuid 8000_0001 lacks requested flag 'abm' [0x00000020]
    warning: host cpuid 8000_0001 lacks requested flag 'sse4a' [0x00000040]
      :

    # x86_64-softmmu/qemu-system-x86_64 ../rhel6.0-beta.img -net nic -net user -m 1024 -M rhel6.0.0 -cpu default,enforce,+sse4.1,+sse4.2,-abm
    Using CPU model "cpu64-rhel6,enforce,+sse4.1,+sse4.2,-abm"
    warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
    warning: host cpuid 8000_0001 lacks requested flag 'sse4a' [0x00000040]
    Unable to support requested x86 CPU definition

etc..  allowing both the ability here to "check|enforce" the default
model, as well as accepting arbitrary feature flags due to fan into the
existing flag parsing.  The resulting rhel6.1 patch (to follow) is fairly
trivial.   Upstream patch under way.
Comment 8 john cooper 2011-01-26 22:56:38 EST
Created attachment 475522 [details]
Patch to resolve case.
Comment 15 Suqin Huang 2011-02-17 22:25:06 EST
fix on qemu-kvm-0.12.1.2-2.145.el6.x86_64

1. qemu-kvm-0.12.1.2-2.132.el6.x86_64
1). /usr/libexec/qemu-kvm /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.0-32.raw

can boot without worning

2). check
/usr/libexec/qemu-kvm /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.0-32.raw -cpu default,check
Unknown cpu model: default
Unable to support requested x86 CPU definition

/usr/libexec/qemu-kvm /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.0-32.raw -cpu check
Unknown cpu model: check
Unable to support requested x86 CPU definition
3). enforce
[root@amd-4450b-4-2 ~]# /usr/libexec/qemu-kvm /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.0-32.raw -cpu enforce
Unknown cpu model: enforce
Unable to support requested x86 CPU definition
[root@amd-4450b-4-2 ~]# /usr/libexec/qemu-kvm /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.0-32.raw -cpu default,enforce
Unknown cpu model: default
Unable to support requested x86 CPU definition

2. qemu-kvm-0.12.1.2-2.145.el6.x86_64

1). /usr/libexec/qemu-kvm /home/shuang/images/rhel5.test
Using CPU model "cpu64-rhel6"

2). /usr/libexec/qemu-kvm /home/shuang/images/rhel5.test -cpu default,check
Using CPU model "cpu64-rhel6,check"
warning: host cpuid 8000_0001:ecx flag restricted to guest 'svm' [0x00000004]
warning: host cpuid 8000_0001:ecx lacks requested flag 'abm' [0x00000020]
warning: host cpuid 8000_0001:ecx lacks requested flag 'sse4a' [0x00000040]

3). /usr/libexec/qemu-kvm /home/shuang/images/rhel5.test -cpu default,enforce
Using CPU model "cpu64-rhel6,enforce"
warning: host cpuid 8000_0001:ecx flag restricted to guest '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

/usr/libexec/qemu-kvm /home/shuang/images/rhel5.test -cpu default,enforce,+svm,+abm,+sse4a
Using CPU model "cpu64-rhel6,enforce,+svm,+abm,+sse4a"
warning: host cpuid 8000_0001:ecx flag restricted to guest '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
Comment 16 john cooper 2011-02-18 15:37:23 EST
Looks good.  Incidentally you might consider adding unit test to
validate we're picking up other built-in defaults when the "-M"
flag is specified, as a regression check of sorts.  For example:

    # x86_64-softmmu/qemu-system-x86_64 -M rhel5.4.4
    Using CPU model "cpu64-rhel5"
      :

    # x86_64-softmmu/qemu-system-x86_64 -M rhel5.4.4 -cpu default,check
    Using CPU model "cpu64-rhel5,check"
    warning: host cpuid 8000_0001:edx lacks requested flag '3dnowext' [0x40000000]
    warning: host cpuid 8000_0001:edx lacks requested flag '3dnow' [0x80000000]
    warning: host cpuid 8000_0001:ecx lacks requested flag 'svm' [0x00000004]

Note the warnings above in the case of "check" are of no general concern.
The cpu64-rhel* models intentionally request a wider set of features than
they typically will receive and are not guaranteed to be migration portable
models.
Comment 17 Suqin Huang 2011-04-13 03:49:02 EDT
test the default cpu model when the "-M" flag is specified ==> PASS

qemu-kvm-0.12.1.2-2.156.el6.x86_64

[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M pc -cpu default,check -vnc :1
Using CPU model "cpu64-rhel6,check"
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]


[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M rhel6.1.0 -cpu default,check -vnc :1
Using CPU model "cpu64-rhel6,check"
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]


[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M rhel6.0.0 -cpu default,check -vnc :1
Using CPU model "cpu64-rhel6,check"
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]


[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M rhel5.5.0 -cpu default,check -vnc :1
Using CPU model "cpu64-rhel5,check"
warning: host cpuid 8000_0001:edx lacks requested flag '3dnowext' [0x40000000]
warning: host cpuid 8000_0001:edx lacks requested flag '3dnow' [0x80000000]
warning: host cpuid 8000_0001:ecx lacks requested flag 'svm' [0x00000004]


[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M rhel5.4.0 -cpu default,check -vnc :1
Using CPU model "cpu64-rhel5,check"
warning: host cpuid 8000_0001:edx lacks requested flag '3dnowext' [0x40000000]
warning: host cpuid 8000_0001:edx lacks requested flag '3dnow' [0x80000000]
warning: host cpuid 8000_0001:ecx lacks requested flag 'svm' [0x00000004]


[root@intel-e5620-12-1 ~]# /usr/libexec/qemu-kvm test.qcow2 -M rhel5.4.4 -cpu default,check -vnc :1
Using CPU model "cpu64-rhel5,check"
warning: host cpuid 8000_0001:edx lacks requested flag '3dnowext' [0x40000000]
warning: host cpuid 8000_0001:edx lacks requested flag '3dnow' [0x80000000]
warning: host cpuid 8000_0001:ecx lacks requested flag 'svm' [0x00000004]
Comment 18 Miya Chen 2011-04-14 07:16:06 EDT
move it to verified based on comment#15 and comment#17
Comment 19 john cooper 2011-05-05 10:57:59 EDT
Add CCFR.
Comment 20 john cooper 2011-05-05 10:57:59 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    Launching qemu with "-cpu check" doesn't do as expected
if a valid cpu model name isn't provided.

Consequence
    "check" and "enforce"  actions on the default model don't work
and qemu falters with a CLI parsing error.

Fix
    Due to qemu's current CLI argument parsing structure a cpu model
name must be provided.  So the pseudo name "default" is now recognized
which allows  "check" and "enforce" to function as expected
on both default and "-M" implied cpu models.

Result
    Intuitive and expected behavior for these options is maintained.
Comment 21 errata-xmlrpc 2011-05-19 07:33:13 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html
Comment 22 errata-xmlrpc 2011-05-19 08:46:48 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

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