Bug 874400

Summary: "rdtscp" flag defined on Opteron_G5 model and cann't be exposed to guest
Product: Red Hat Enterprise Linux 6 Reporter: FuXiangChun <xfu>
Component: qemu-kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: acathrow, areis, bsarathy, dyasny, flang, juzhang, michen, mkenneth, qzhang, shuang, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.338.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:44:12 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 FuXiangChun 2012-11-08 05:32:32 UTC
Description of problem:
 CPUID_EXT2_RDTSCP present on the Opteron_G5 model from code target-i386/cpuid.c
and it cann't be exposed to guest. according to bug 814426. It should be removed from G5 model.

Version-Release number of selected component (if applicable):
host:
# uname -r
2.6.32-339.el6.x86_64
# rpm -qa|grep qemu
qemu-kvm-0.12.1.2-2.334.el6.x86_64

Additional, host cpu is AMD Seoul, and 16 cores.  

guest kernel:
# uname -r
2.6.32-339.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. boot guest
usr/libexec/qemu-kvm -M rhel6.4.0 -cpu Opteron_G5 -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1,maxcpus=16 -usb -device usb-tablet,id=input0 -name Opteron_G5 -uuid 990ea161-6b67-47b2-b803-19fb01d30d31 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=/root/fuxc/rhel6.4-64.qcow2,if=none,id=drive-ide-disk0,format=qcow2,cache=none,werror=stop,rerror=stop -device ide-drive,drive=drive-ide-disk0,id=ide-disk0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device e1000,netdev=hostnet0,id=e1000-net-pci0,mac=00:1B:21:A8:0D:B1,bus=pci.0,addr=0x5 -spice port=5932,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.vram_size=67108864 -nodefaults -qmp tcp:0:7777,server,nowait -boot menu=on -monitor stdio -device sga -chardev socket,id=serial0,path=/var/test1,server,nowait -device isa-serial,chardev=serial0

2.check register and cpuinfo in host and guest

3.check code target-i386/cpuid.c  
  output of G5 model is in additional info.

Actual results:
host:
register values(rdtscp location is Function 80000001.EDX[27])
eax in: 0x80000001, eax = 00600f20 ebx = 50000000 ecx = 01ebbfff edx = 2fd3fbff
 
rdtscp present in /proc/cpuinfo

guest:
eax in: 0x80000001, eax = 00600f20 ebx = 00000000 ecx = 002109e3 edx = 2593fbfd
rdtscp not present in /proc/cpuinfo

Expected results:
remove the flag from Opteron_G5 model or enable it

Additional info:
       .name = "Opteron_G5",
        .level = 0xd,
        .vendor1 = CPUID_VENDOR_AMD_1,
        .vendor2 = CPUID_VENDOR_AMD_2,
        .vendor3 = CPUID_VENDOR_AMD_3,
        .family = 21,
        .model = 2,
        .stepping = 0,
        .features = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
             CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
             CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
             CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
             CPUID_DE | CPUID_FP87,
        .ext_features = CPUID_EXT_F16C | CPUID_EXT_AVX | CPUID_EXT_XSAVE |
             CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 |
             CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_FMA |
             CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
        .ext2_features = CPUID_EXT2_LM | CPUID_EXT2_RDTSCP |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
             CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL | CPUID_EXT2_APIC |
             CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR |
             CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU,
        .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",

Comment 2 juzhang 2012-11-08 06:01:06 UTC
*** Bug 874398 has been marked as a duplicate of this bug. ***

Comment 8 FuXiangChun 2012-12-17 03:21:39 UTC
Verify this issue with qemu-kvm-0.12.1.2-2.346.el6.x86_64

verify to steps as Description

result:
1.flag cann't be exported to guest. qemu have removed it from code.

2.cpuid.c code.
{
        .name = "Opteron_G5",
        .level = 0xd,
        .vendor1 = CPUID_VENDOR_AMD_1,
        .vendor2 = CPUID_VENDOR_AMD_2,
        .vendor3 = CPUID_VENDOR_AMD_3,
        .family = 21,
        .model = 2,
        .stepping = 0,
        .features = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
             CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
             CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
             CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
             CPUID_DE | CPUID_FP87,
        .ext_features = CPUID_EXT_F16C | CPUID_EXT_AVX | CPUID_EXT_XSAVE |
             CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 |
             CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_FMA |
             CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
        .ext2_features = CPUID_EXT2_LM |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
             CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL | CPUID_EXT2_APIC |
             CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR |
             CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU,
        .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. guest register
eax in: 0x80000001, eax = 00600f20 ebx = 00000000 ecx = 002109e3 edx = 2593fbfd

4. not find this flag form cpuinfo in guest

so base on this test result as above, I think this bug is fixed.

Comment 10 errata-xmlrpc 2013-02-21 07:44:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0527.html