Bug 1275596 - [kvm-qe]Cpu flag nonstop_tsc cannot pass through from host to guest with "-cpu host" option
[kvm-qe]Cpu flag nonstop_tsc cannot pass through from host to guest with "-cp...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.2
x86_64 Linux
urgent Severity urgent
: rc
: 7.3
Assigned To: Marcelo Tosatti
Guo, Zhiyi
:
Depends On:
Blocks: 1018952
  Show dependency treegraph
 
Reported: 2015-10-27 06:01 EDT by Guo, Zhiyi
Modified: 2016-08-30 13:23 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-08-30 13:23:12 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 Guo, Zhiyi 2015-10-27 06:01:01 EDT
Description of problem:
Cpu flag nonstop_tsc cannot pass through from host to guest with "-cpu host" option

Version-Release number of selected component (if applicable):
kernel version(host&guest):3.10.0-326.el7.x86_64
qemu version: qemu-kvm-rhev-2.3.0-31.el7.x86_64

How reproducible:
100% reproduce rate.

Steps to Reproduce:
1. qemu-kvm command: qemu-kvm -name rhel7.2 -m 6144 \
        -cpu host\
        -smp 2,cores=1,threads=2,sockets=2,maxcpus=4 \
         -vga qxl\
        -spice port=3001,disable-ticketing \
        -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent \
        -serial unix:/tmp/m,server,nowait \
        -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
        -drive file=rhev7_2_gpu_test.qcow2,if=none,id=drive-scsi-disk0,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-hd,drive=drive-scsi-disk0,bus=scsi0.0,scsi-id=0,lun=0,id=scsi-disk0,bootindex=1 \
        -monitor stdio \
        -netdev tap,id=idinWyYp,vhost=on -device virtio-net-pci,mac=42:ce:a9:d2:4d:d7,id=idlbq7eA,netdev=idinWyYp \

2. login into rhev 7.2 system and check cpu flag by cat /proc/cpuinfo

Actual results:
nonstop_tsc doesn't exist in flags of /proc/cpuinfo

Expected results:
nonstop_tsc exists in flags of /proc/cpuinfo

Additional info:
Comment 2 djdumas 2016-06-30 16:23:27 EDT
This also happens for me with <cpu mode='custom' match='exact'> on a SandyBridge 2-socket.

When I try to force with <feature policy='require' name='nonstop_tsc'/> I get
error: internal error: Unknown CPU feature nonstop_tsc

Need this feature as part of a SAP HANA/KVM certification effort going on now.
Same version as submitter: qemu-kvm-rhev 2.3.0-31

Thanks,
Dave
Comment 3 Marcelo Tosatti 2016-07-01 20:15:08 EDT
(In reply to Guo, Zhiyi from comment #0)
> Description of problem:
> Cpu flag nonstop_tsc cannot pass through from host to guest with "-cpu host"
> option
> 
> Version-Release number of selected component (if applicable):
> kernel version(host&guest):3.10.0-326.el7.x86_64
> qemu version: qemu-kvm-rhev-2.3.0-31.el7.x86_64
> 
> How reproducible:
> 100% reproduce rate.
> 
> Steps to Reproduce:
> 1. qemu-kvm command: qemu-kvm -name rhel7.2 -m 6144 \
>         -cpu host\
>         -smp 2,cores=1,threads=2,sockets=2,maxcpus=4 \
>          -vga qxl\
>         -spice port=3001,disable-ticketing \
>         -device virtio-serial -chardev
> spicevmc,id=vdagent,debug=0,name=vdagent \
>         -serial unix:/tmp/m,server,nowait \
>         -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
>         -drive
> file=rhev7_2_gpu_test.qcow2,if=none,id=drive-scsi-disk0,format=qcow2,
> cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device
> scsi-hd,drive=drive-scsi-disk0,bus=scsi0.0,scsi-id=0,lun=0,id=scsi-disk0,
> bootindex=1 \
>         -monitor stdio \
>         -netdev tap,id=idinWyYp,vhost=on -device
> virtio-net-pci,mac=42:ce:a9:d2:4d:d7,id=idlbq7eA,netdev=idinWyYp \
> 
> 2. login into rhev 7.2 system and check cpu flag by cat /proc/cpuinfo
> 
> Actual results:
> nonstop_tsc doesn't exist in flags of /proc/cpuinfo
> 
> Expected results:
> nonstop_tsc exists in flags of /proc/cpuinfo
> 
> Additional info:

-cpu host,+invtsc,migratable=no

exposes nonstop_tsc on

qemu-kvm-rhev-2.3.0-31.el7_2.17.x86_64

for me.
Comment 4 Marcelo Tosatti 2016-07-01 20:42:07 EDT
(In reply to djdumas from comment #2)
> This also happens for me with <cpu mode='custom' match='exact'> on a
> SandyBridge 2-socket.
> 
> When I try to force with <feature policy='require' name='nonstop_tsc'/> I get
> error: internal error: Unknown CPU feature nonstop_tsc
> 
> Need this feature as part of a SAP HANA/KVM certification effort going on
> now.
> Same version as submitter: qemu-kvm-rhev 2.3.0-31
> 
> Thanks,
> Dave

Dave,

I haven't tried it myself, but this is what the libvirt commit which introduced 
support for invtsc says:

commit fba6bc47cbcabbe08d42279691efb0dff3b9c997
Author: Ján Tomko <jtomko@redhat.com>
Date:   Tue May 6 13:55:44 2014 +0200

    Add invariant TSC cpu flag
    
    Add suport for invariant TSC flag (CPUID 0x80000007, bit 8 of EDX).
    If this flag is enabled, the TSC ticks at a constant rate across
    all ACPI P-, C- and T-states.
    
    This can be enabled by adding:
    <feature name='invtsc'/>
    to the <cpu> element.
    
    Migration and saving the domain does not work with this flag.
    
    QEMU support: http://git.qemu.org/?p=qemu.git;a=commitdiff;h=303752a
    
    The feature name "invtsc" differs from the name "" used by the linux kernel:
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/cpu/powerflags.c?id=30321c7b#n18

Perhaps you can try adding that option?
Comment 5 djdumas 2016-07-05 14:02:01 EDT
(In reply to Marcelo Tosatti from comment #4)

>     This can be enabled by adding:
>     <feature name='invtsc'/>
>     to the <cpu> element.
>     

....

> Perhaps you can try adding that option?

Hi Marcelo,

Nice call there - that worked, thank you.  I have nonstop_tsc in the guest now.

Dave
Comment 6 Karen Noel 2016-08-30 13:23:12 EDT
(In reply to djdumas from comment #5)
> (In reply to Marcelo Tosatti from comment #4)
> 
> >     This can be enabled by adding:
> >     <feature name='invtsc'/>
> >     to the <cpu> element.
> >     
> 
> ....
> 
> > Perhaps you can try adding that option?
> 
> Hi Marcelo,
> 
> Nice call there - that worked, thank you.  I have nonstop_tsc in the guest
> now.
> 
> Dave

Looks like this was not a bug afterall. Closing. 

Please reopen if there is still an issue. Thanks.

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