Bug 1128638 - erms cpu feature is not exposed to guest correctly
Summary: erms cpu feature is not exposed to guest correctly
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Eduardo Habkost
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-11 09:15 UTC by Xu Han
Modified: 2014-08-17 04:41 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-08-16 17:07:33 UTC

Attachments (Terms of Use)

Description Xu Han 2014-08-11 09:15:21 UTC
Description of problem:
erms cpu feature is not exposed to guest correctly with rhel6 QEMU.
The feature bit has been set in CPUID level 0x7 EBX[9],
eax in: 0x00000007, eax = 00000000 ebx = 00000200 ecx = 00000000 edx = 00000000
but the cpuinfo did not report it.
# cat /proc/cpuinfo | grep flags | uniq 
flags		: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc unfair_spinlock pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm

However, the rhel7 QEMU has no this issue.
Please help me correct the component if this is a KVM issue. Thanks.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. launch VM with '-cpu Westmere,+erms' or '-cpu Haswell'
2. Check erms cpu feature on guest
# x86info --registers | grep '0x00000007' | uniq
# cat /proc/cpuinfo | grep flags | uniq

Actual results:
The feature bit has been set, but the cpuinfo did not report it.

Expected results:
erms cpu feature should be exposed to guest correctly.

Additional info:
host cpu info:
# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Stepping:              4
CPU MHz:               2500.050
BogoMIPS:              4999.31
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              10240K
NUMA node0 CPU(s):     0,2,4,6
NUMA node1 CPU(s):     1,3,5,7

# tail -26 /proc/cpuinfo 
processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 62
model name	: Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz
stepping	: 4
microcode	: 1045
cpu MHz		: 2500.050
cache size	: 10240 KB
physical id	: 1
siblings	: 4
core id		: 3
cpu cores	: 4
apicid		: 38
initial apicid	: 38
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 4999.31
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

Comment 2 Eduardo Habkost 2014-08-16 15:22:17 UTC
If you can see the flag on x86info but not on /proc/cpuinfo, that means that just the guest kernel doesn't know what's the flag name.

Please include full steps (full command-line and guest OS version) to reproduce the bug, as I don't know what's the guest OS you are running.

Comment 3 Eduardo Habkost 2014-08-16 17:07:33 UTC
Found the bug: it is not on the CPUID data (which is correct), but a missing MSR that makes the Linux guest ignore the CPU feature (and not show it on /proc/cpuinfo).

Fixed in QEMU 1.0 by upstream commit:

commit 21e87c4625f290824f4f05d098e576cda40421ce
Author: Avi Kivity <avi@redhat.com>
Date:   Tue Oct 4 16:26:35 2011 +0200

    i386: wire up MSR_IA32_MISC_ENABLE
    It's needed for its default value - bit 0 specifies that "rep movs" is
    good enough for memcpy, and Linux may use a slower memcpu if it is not set,
    depending on cpu family/model.
    Signed-off-by: Avi Kivity <avi@redhat.com>
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Not serious enough to fix in RHEL-6. Closing as WONTFIX.

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