Bug 846633

Summary: cannot export 'sse4_1 & sse4_2' flags to guest correctly on the rhel5.9 64bit host
Product: Red Hat Enterprise Linux 5 Reporter: Sibiao Luo <sluo>
Component: kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9CC: ehabkost, juzhang, michen, mkenneth, rhod, shuang, shu, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-15 10:23:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sibiao Luo 2012-08-08 10:01:57 UTC
Description of problem:
boot a guest with '-cpu qemu64,+sse4_1,+sse4_2' on rhel5.9 64bit host(SandyBridge host), 'sse4_1 & sse4_2' were not exported to guest correctly, both the rhel5.9 64bit and windows2k3 sp2 64bit guest can hit this issue.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q kvm
2.6.18-333.el5
kvm-83-258.el5
guest info:
windows_2k3_sp2_64bit
rhel5.9 64bit

How reproducible:
100%

Steps to Reproduce:
1.check the ‘sse4_1 & sse4_2’ is supported on host.
# cat /proc/cpuinfo
2.boot guest with 'qemu64,+sse4_1,+sse4_2'.
eg: # /usr/libexec/qemu-kvm -m 2G -smp 2,cores=2,threads=1,sockets=1 -M rhel5.6.0 -cpu qemu64,+sse4_1,+sse4_2 -name cpu_clustering_test -drive file=/home/RHEL-Server-5.9-64-virtio-sluo.qcow2,format=qcow2,media=disk,if=ide,cache=none,werror=stop,boot=on -net nic,vlan=0,model=e1000,macaddr=08:2E:5F:0A:0D:1A -net tap,sndbuf=0,vlan=0,script=/etc/qemu-ifup,downscript=no -balloon none -uuid `uuidgen` -monitor unix:/tmp/virt-nic-sluo,server,nowait -spice port=5931,disable-ticketing -qxl 1 -usbdevice tablet -soundhw ac97 -no-hpet -rtc-td-hack -no-kvm-pit-reinjection -boot c -monitor stdio
3.check 'sse4.1 & sse4.2' cpu flag on guest.
# cat /proc/cpuinfo  <--- for rhel guest
# x86info -a -f  <--- for windows guest

Actual results:
after the step 3,
can not find 'sse4_1 & sse4_2' flags in guest.

Expected results:
can export 'sse4_1 & sse4_2' flags to guest correctly.

Additional info:
host cpuinfo:
processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	:         Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
stepping	: 7
cpu MHz		: 1600.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id		: 3
cpu cores	: 4
apicid		: 7
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 syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
bogomips	: 6784.60
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management: [8]

Comment 1 RHEL Program Management 2012-08-08 10:08:04 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 2 Sibiao Luo 2012-08-08 10:41:44 UTC
(In reply to comment #0)
> Description of problem:
> boot a guest with '-cpu qemu64,+sse4_1,+sse4_2' on rhel5.9 64bit
> host(SandyBridge host), 'sse4_1 & sse4_2' were not exported to guest
> correctly, both the rhel5.9 64bit and windows2k3 sp2 64bit guest can hit
> this issue.
> 

Hi all,

   I also tried rhel5.9 64bit guest on the rhel6.4 64bit host(kernel-2.6.32-294.el6.x86_64) with the same steps, the 'sse4_1 & sse4_2' flags can be exported to the guest correctly.

Best wish.
sluo

Comment 3 Suqin Huang 2012-08-10 06:52:21 UTC
pls try with sse4.1|sse4.2, the instruction name in guest and host are not the samw

Comment 4 Suqin Huang 2012-08-10 07:11:48 UTC
and also check sse4.1(bit[19]) and sse4.2(bit[20]) in rhrl5 guest with x86info, seems they are not recognized by rhel5 kernel.

Comment 5 Sibiao Luo 2012-08-13 11:31:24 UTC
(In reply to comment #3)
> pls try with sse4.1|sse4.2, the instruction name in guest and host are not
> the samw
(In reply to comment #4)
> and also check sse4.1(bit[19]) and sse4.2(bit[20]) in rhrl5 guest with
> x86info, seems they are not recognized by rhel5 kernel.


Hi all,

   If i use '-cpu qemu64,+sse4.1,+sse4.2' to boot the guest, they can be exported to the guest correctly. btw i check the qemu-kvm code, should we make a choice "sse4.1|sse4_1", "sse4.2|sse4_2" or all of them can make sense ?

static const char *ext_feature_name[] = {
    "pni|sse3" /* Intel,AMD sse3 */, "pclmulqdq|pclmuldq", "dtes64", "monitor",
    "ds_cpl", "vmx", "smx", "est",
    "tm2", "ssse3", "cid", NULL,
    "fma", "cx16", "xtpr", "pdcm",
    NULL, "pcid", "dca", "sse4.1|sse4_1",
    "sse4.2|sse4_2", "x2apic", "movbe", "popcnt",
    "tsc-deadline", "aes", "xsave", "osxsave",
    "avx", NULL, NULL, "hypervisor",
};

run '# x86info -a -f' in guest.
--------------------------------------------------------------------------
CPU #2
eax in: 0x00000000, eax = 00000004 ebx = 756e6547 ecx = 6c65746e edx = 49656e69
eax in: 0x00000001, eax = 00000663 ebx = 01020800 ecx = 80180001 edx = 178bfbfd
eax in: 0x00000002, eax = 00000001 ebx = 00000000 ecx = 00000000 edx = 002c307d
eax in: 0x00000003, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x00000004, eax = 04000121 ebx = 01c0003f ecx = 0000003f edx = 00000001

check sse4.1(bit[19]) and sse4.2(bit[20]) has exported to guest which can be seen by 'eax in: 0x00000001, eax = 00000663 ebx = 01020800 ecx = 80180001 edx = 178bfbfd'.

Best wish.
sluo

Comment 6 Eduardo Habkost 2012-08-13 14:21:37 UTC
(In reply to comment #5)
>    If i use '-cpu qemu64,+sse4.1,+sse4.2' to boot the guest, they can be
> exported to the guest correctly. btw i check the qemu-kvm code, should we
> make a choice "sse4.1|sse4_1", "sse4.2|sse4_2" or all of them can make sense
> ?

For qemu-kvm, both sse4.X and sse4_X formats are synonyms and should have exactly the same results (that's what the "|" entries on the feature_name arrays mean).

Comment 7 Sibiao Luo 2012-08-13 15:08:54 UTC
(In reply to comment #6)
> (In reply to comment #5)
> >    If i use '-cpu qemu64,+sse4.1,+sse4.2' to boot the guest, they can be
> > exported to the guest correctly. btw i check the qemu-kvm code, should we
> > make a choice "sse4.1|sse4_1", "sse4.2|sse4_2" or all of them can make sense
> > ?
> 
> For qemu-kvm, both sse4.X and sse4_X formats are synonyms and should have
> exactly the same results (that's what the "|" entries on the feature_name
> arrays mean).

when boot a rhel5.9 64bit guest with '-cpu qemu64,+sse4_1,+sse4_2' on rhel5.9 64bit host, run 'x86info -a -f' in the guest as following, from 'ecx = 80000001', we can see that the 'sse4_1 & sse4_2' flags fail to export to guest correctly.
--------------------------------------------------------------------------
CPU #2
eax in: 0x00000000, eax = 00000004 ebx = 756e6547 ecx = 6c65746e edx = 49656e69
eax in: 0x00000001, eax = 00000663 ebx = 01020800 ecx = 80000001 edx = 178bfbfd
eax in: 0x00000002, eax = 00000001 ebx = 00000000 ecx = 00000000 edx = 002c307d
eax in: 0x00000003, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x00000004, eax = 04000121 ebx = 01c0003f ecx = 0000003f edx = 00000001

eax in: 0x80000000, eax = 8000000a ebx = 68747541 ecx = 444d4163 edx = 69746e65
eax in: 0x80000001, eax = 078bfbfd ebx = 00000000 ecx = 00000002 edx = 2191abfd
eax in: 0x80000002, eax = 554d4551 ebx = 72695620 ecx = 6c617574 edx = 55504320
eax in: 0x80000003, eax = 72657620 ebx = 6e6f6973 ecx = 392e3020 edx = 0000312e
eax in: 0x80000004, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x80000005, eax = 01ff01ff ebx = 01ff01ff ecx = 40020140 edx = 40020140
eax in: 0x80000006, eax = 00000000 ebx = 42004200 ecx = 02008140 edx = 00000000
eax in: 0x80000007, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x80000008, eax = 00003028 ebx = 00000000 ecx = 00000001 edx = 00000000
eax in: 0x80000009, eax = 00000000 ebx = 00000000 ecx = 00000000 edx = 00000000
eax in: 0x8000000a, eax = 00000001 ebx = 00000010 ecx = 00000000 edx = 00000000

Family: 6 Model: 6 Stepping: 3 Type: 0 Brand: 0
CPU Model: Celeron / Mobile Pentium II Original OEM
Feature flags:
 fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflsh mmx fxsr sse sse2 ht sse3
Extended feature flags:
 SYSCALL xd em64t

    According to the Comment #5 and above all, we can see that 'sse4_1 & sse4_2' flags fail to export to guest when boot guest with '-cpu qemu64,+sse4_1,+sse4_2', but successfully if boot guest with '-cpu qemu64,+sse4.1,+sse4.2'.

Best wish.
sluo

Comment 8 Sibiao Luo 2012-08-15 07:36:14 UTC
(In reply to comment #5)
> 
>    If i use '-cpu qemu64,+sse4.1,+sse4.2' to boot the guest, they can be
> exported to the guest correctly. btw i check the qemu-kvm code, should we
> make a choice "sse4.1|sse4_1", "sse4.2|sse4_2" or all of them can make sense
> ?
> 
> static const char *ext_feature_name[] = {
>     "pni|sse3" /* Intel,AMD sse3 */, "pclmulqdq|pclmuldq", "dtes64",
> "monitor",
>     "ds_cpl", "vmx", "smx", "est",
>     "tm2", "ssse3", "cid", NULL,
>     "fma", "cx16", "xtpr", "pdcm",
>     NULL, "pcid", "dca", "sse4.1|sse4_1",
>     "sse4.2|sse4_2", "x2apic", "movbe", "popcnt",
>     "tsc-deadline", "aes", "xsave", "osxsave",
>     "avx", NULL, NULL, "hypervisor",
> };
> 
this code is from the latest qemu upstream, I check them in our rhel5 qemu code as following:
   static const char *ext_feature_name[] = {
       "pni" /* Intel,AMD sse3 */, NULL, NULL, "monitor", "ds_cpl", "vmx", NULL /* Linux smx */, "est",
       "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
       NULL, NULL, "dca", "sse4.1", "sse4.2", NULL, NULL, "popcnt",
       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    };

There is only "sse4.1" & "sse4.2" in rhel5 qemu code, would developer like to update them to "sse4.1|sse4_1" & "sse4.2|sse4_2" ? 

Thanks.
sluo

Comment 9 Eduardo Habkost 2012-08-15 09:18:00 UTC
(In reply to comment #8)
> There is only "sse4.1" & "sse4.2" in rhel5 qemu code, would developer like
> to update them to "sse4.1|sse4_1" & "sse4.2|sse4_2" ? 
> 

There's no need to add them, unless there's some other code that depend on them. I have just checked the RHEL-5 libvirt code, and it doesn't seem to use them.

Comment 10 Eduardo Habkost 2012-08-15 10:23:57 UTC
Closing as NOTABUG, as the "see4_X" flag names are simply no supported in the RHEL-5 qemu-kvm code.