Bug 972424 - qemu will prompt 'svm' flag related warning and quit with '-cpu Opteron_G*,enforce' on AMD host
qemu will prompt 'svm' flag related warning and quit with '-cpu Opteron_G*,en...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.5
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Eduardo Habkost
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-09 05:46 EDT by Sibiao Luo
Modified: 2013-07-15 15:29 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-15 15:29:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sibiao Luo 2013-06-09 05:46:36 EDT
Description of problem:
boot guest with '-cpu Opteron_G5,enforce' on AMD G5 host, qemu will quit with 'warning: host cpuid 8000_0001:ecx flag restricted to guest 'svm' [0x00000004]
Unable to support requested x86 CPU definition'. 
BTW, I also tried the AMD G2 host which also hit this issue, so this issue no only happen on G5 host but also other AMD host.
If boot guest with '-cpu SandyBridge,enforce' on INTEL SandyBridge host, it have no such issue.

Version-Release number of selected component (if applicable):
host info:
kernel-2.6.32-358.11.1.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.355.el6_4.5.x86_64

How reproducible:
100%

Steps to Reproduce:
1.check the G5 AMD host cpu flag.
# cat /proc/cpuinfo | grep svm
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core cpb npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1
2.check the cpuid.c file.
# vim /usr/src/debug/qemu-kvm-0.12.1.2/target-i386/cpuid.c
   {
        .name = "Opteron_G5",
...
        .ext3_features = CPUID_EXT3_TBM | CPUID_EXT3_FMA4 | CPUID_EXT3_XOP |
             CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_MISALIGNSSE |
             CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | CPUID_EXT3_SVM |
             CPUID_EXT3_LAHF_LM,
        .xlevel = 0x8000001A,
        .model_id = "AMD Opteron 63xx class CPU",
    },
...
3.boot guest with '-cpu Opteron_G5,enforce' on AMD G5 host.
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu Opteron_G5,enforce -vnc :11 -monitor stdio
warning: host cpuid 8000_0001:ecx flag restricted to guest 'svm' [0x00000004]
Unable to support requested x86 CPU definition
# 

Actual results:
after step 3, qemu will quit with 'warning: host cpuid 8000_0001:ecx flag restricted to guest 'svm' [0x00000004]
Unable to support requested x86 CPU definition'
If do not use 'force', it not quit just prompt.
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu Opteron_G5 -vnc :11 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) q
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu Opteron_G5,check -vnc :11 -monitor stdio
warning: host cpuid 8000_0001:ecx flag restricted to guest 'svm' [0x00000004]
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) q

Expected results:
Should remove the 'svm' flag from cpuid.c file for AMD, just like 'vmx' not exist in cpuid.c for SandyBridge.

Additional info:
Both vmx–(intel) and svm–(amd) should not be exposed to the guest. I also check the 'SVM' in my SandyBridge host, it have no such issue, and the 'VMX' flag not exist in the cpuid.c file.
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu SandyBridge -vnc :1 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) q
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu SandyBridge,check -vnc :1 -monitor stdio 
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) q
# /usr/libexec/qemu-kvm -M rhel6.4.0 -enable-kvm -cpu SandyBridge,enforce -vnc :1 -monitor stdio
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) q
Comment 1 Eduardo Habkost 2013-07-15 15:29:44 EDT
The "svm" flag is already part of what "Opteron_G*" means for qemu-kvm. If the user (or libvirt) doesn't want qemu-kvm to try to enable svm, they have to use the "-svm", for example: "-cpu Opteron_G5,-svm".

We could be forced to change the definition like in the case of the SEP flag (see bug 821741, bug 821463) if there was a risk that the flag get silently enabled in the case of a kernel upgrade. But the "svm" flag is available only if "-enable-nesting" is explicitly used, so the valid use-cases with "enforce" enabled would be either:

 $ qemu-kvm -cpu Opteron_G5,-svm,enforce
or:
 $ qemu-kvm -enable-nesting -cpu Opteron_G5,enforce

But -enable-nesting is not supported on RHEL-6 (see bug 738555), so only the first option is valid.

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