Bug 1056428 - "rdtscp" flag defined on Opteron_G5 model and cann't be exposed to guest
Summary: "rdtscp" flag defined on Opteron_G5 model and cann't be exposed to guest
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Eduardo Habkost
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-22 08:23 UTC by huiqingding
Modified: 2014-06-18 03:45 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-1.5.3-44.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 13:30:18 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description huiqingding 2014-01-22 08:23:13 UTC
Description of problem:
 CPUID_EXT2_RDTSCP present on the Opteron_G5 model from code target-i386/cpu.c, the host cpu has the flag "rdtscp", but this flag "rdtscp" cann't be exposed to guest. 

Version-Release number of selected component (if applicable):
host:
# uname -r
3.10.0-64.el7.x86_64
# rpm -qa|grep qemu
qemu-kvm-1.5.3-40.el7.x86_64

Additional
guest kernel:
# uname -r
3.10.0-64.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. boot guest
# /usr/libexec/qemu-kvm -M pc -cpu Opteron_G5 -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name rhel7 -uuid 6afa5f93-2d4f-420f-81c6-e5fdddbd1c83 -drive file=/home/huding/RHEL7-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,serial=40c061dd-5d60-4fc5-865f-55db700407f0,cache=none,werror=stop,rerror=stop,aio=threads -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:4a:42:0a:00,bus=pci.0,addr=0x3 -vnc :1  -monitor stdio

2.check cpuinfo in host and guest
# cat /proc/cpuinfo

3.check code target-i386/cpu.c  

Actual results:
After step2, the host has flag "rdtscp" but the guest has not "rdtscp"

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

Additional info:
1. the host is Opteron_G5 and the detailed info:
# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                32
On-line CPU(s) list:   0-31
Thread(s) per core:    2
Core(s) per socket:    8
Socket(s):             2
NUMA node(s):          4
Vendor ID:             AuthenticAMD
CPU family:            21
Model:                 2
Model name:            AMD Opteron(tm) Processor 6376
Stepping:              0
CPU MHz:               2294.311
BogoMIPS:              4587.97
Virtualization:        AMD-V
L1d cache:             16K
L1i cache:             64K
L2 cache:              2048K
L3 cache:              6144K
NUMA node0 CPU(s):     0,2,4,6,8,10,12,14
NUMA node1 CPU(s):     16,18,20,22,24,26,28,30
NUMA node2 CPU(s):     1,3,5,7,9,11,13,15
NUMA node3 CPU(s):     17,19,21,23,25,27,29,31

2. I check the code of rhel6 qemu-kvm, found "CPUID_EXT2_RDTSCP" has been removed as BZ 874400.

Comment 1 Eduardo Habkost 2014-01-22 19:23:35 UTC
Please test using "-cpu Opteron_G5,enforce", otherwise there is no guarantee that all flags are enabled because they will be disabled silently when the host kernel or host CPU don't support the flag.

Comment 2 huiqingding 2014-01-23 01:33:52 UTC
Hi Eduardo

(In reply to Eduardo Habkost from comment #1)
> Please test using "-cpu Opteron_G5,enforce", otherwise there is no guarantee
> that all flags are enabled because they will be disabled silently when the
> host kernel or host CPU don't support the flag.

I boot the guest with "-cpu Opteron_G5,enforce". qemu-kvm quits with the error info:
(qemu) warning: host doesn't support requested feature: CPUID.80000001H:EDX.rdtscp [bit 27]
qemu-kvm: Host's CPU doesn't support requested features

My host is "AMD Opteron(tm) Processor 6376" and the host's flags in "/proc/cpuinfo" are as following:
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 nopl nonstop_tsc extd_apicid amd_dcm 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 perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1

Comment 3 Eduardo Habkost 2014-01-23 17:14:24 UTC
So qemu-kvm is doing the right thing (aborting because KVM can't expose the rdtscp feature on AMD hosts).

But this means the CPU model is not very useful, if it can never be run as-is. It makes sense to remove the RDTSCP flag from the AMD CPU models.

Patch submitted:
Subject: [RHEL7 qemu-kvm PATCH 1/2] pc: Disable RDTSCP unconditionally on rhel6.* machine-types
Date: Wed, 22 Jan 2014 23:02:20 -0200
Message-Id: <1390438941-18726-2-git-send-email-ehabkost@redhat.com>

Comment 4 Eduardo Habkost 2014-01-23 17:15:13 UTC
Correct patch identification:
Subject: [RHEL7 qemu-kvm PATCH 2/2] pc: Disable RDTSCP on AMD CPU models
Date: Wed, 22 Jan 2014 23:02:21 -0200
Message-Id: <1390438941-18726-3-git-send-email-ehabkost@redhat.com>

(patch 1/1 is for bug 918907)

Comment 5 Miroslav Rezanina 2014-01-29 07:01:45 UTC
Fix included in qemu-kvm-1.5.3-44.el7

Comment 7 huiqingding 2014-02-08 02:38:45 UTC
Reproduce this bug using the following version:
qemu-kvm-1.5.3-40.el7.x86_64

The host is Opteron_G5.

Steps to Reproduce:
1. boot guest
# /usr/libexec/qemu-kvm -M pc -cpu Opteron_G5,enforce -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name rhel7 -uuid 6afa5f93-2d4f-420f-81c6-e5fdddbd1c83 -drive file=/home/huding/RHEL7-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,serial=40c061dd-5d60-4fc5-865f-55db700407f0,cache=none,werror=stop,rerror=stop,aio=threads -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:4a:42:0a:00,bus=pci.0,addr=0x3 -vnc :1  -monitor stdio

Actual results:
qemu-kvm quits with error information:
(qemu) warning: host doesn't support requested feature: CPUID.80000001H:EDX.rdtscp [bit 27]
qemu-kvm: Host's CPU doesn't support requested features

Verify this bug using the following version:
qemu-kvm-1.5.3-45.el7.x86_64

The host is Opteron_G5.

Steps to Verification:
1. boot guest
# /usr/libexec/qemu-kvm -M pc -cpu Opteron_G5,enforce -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name rhel7 -uuid 6afa5f93-2d4f-420f-81c6-e5fdddbd1c83 -drive file=/home/huding/RHEL7-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,serial=40c061dd-5d60-4fc5-865f-55db700407f0,cache=none,werror=stop,rerror=stop,aio=threads -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:4a:42:0a:00,bus=pci.0,addr=0x3 -vnc :1  -monitor stdio

Actual results:
The guest can boot and check "/proc/cpuinfo", there is no the flag "rdtscp".

Based on the above result, I think this bug has been fixed.

Comment 9 Ludek Smid 2014-06-13 13:30:18 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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