Bug 73721

Summary: KVM hv-time
Product: Virtualization Reporter: Marcus Schmidt (anickname)
Component: kvmAssignee: virtualization_kvm
Status: RESOLVED CODE_FIX    
Severity: normal CC: bonzini, flyser42, fruitiex
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.14.0 Subsystem:
Regression: No Bisected commit-id:

Description Marcus Schmidt 2014-04-09 10:24:30 UTC
Hi,

I'm trying to start a Windows 8.1 x86_64 virtual machine and the system moves very slow. After the vm starts the log is full of :

Apr 05 21:20:51 kvm kernel: ------------[ cut here ]------------
Apr 05 21:20:51 kvm kernel: WARNING: CPU: 3 PID: 1919 at arch/x86/kvm/x86.c:1112 kvm_get_msr_common+0x793/0x960 [kvm]()
Apr 05 21:20:51 kvm kernel: Modules linked in: nls_utf8 cifs dns_resolver fscache bridge ebt_ip stp llc ebtable_filter ebtables x_tables nct6775 hwmon_vid coretemp iTCO_wdt iTCO_vendor_
Apr 05 21:20:51 kvm kernel:  raid1 md_mod sd_mod crc_t10dif atkbd libps2 crct10dif_pclmul crct10dif_common crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128
Apr 05 21:20:51 kvm kernel: CPU: 3 PID: 1919 Comm: windows_81 Tainted: G        W    3.14.0-3-mainline #2
Apr 05 21:20:51 kvm kernel: Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z77 Professional, BIOS P1.70B 11/12/2013
Apr 05 21:20:51 kvm kernel:  0000000000000009 ffff8808007f9c10 ffffffff814d563c 0000000000000000
Apr 05 21:20:51 kvm kernel:  ffff8808007f9c48 ffffffff81064f1d 0000000040000020 ffff8808007f9cd8
Apr 05 21:20:51 kvm kernel:  ffff880800b53ec0 ffff8808011b0000 ffff8808011b0040 ffff8808007f9c58
Apr 05 21:20:51 kvm kernel: Call Trace:
Apr 05 21:20:51 kvm kernel:  [<ffffffff814d563c>] dump_stack+0x4d/0x6f
Apr 05 21:20:51 kvm kernel:  [<ffffffff81064f1d>] warn_slowpath_common+0x7d/0xa0
Apr 05 21:20:51 kvm kernel:  [<ffffffff81064ffa>] warn_slowpath_null+0x1a/0x20
Apr 05 21:20:51 kvm kernel:  [<ffffffffa0101433>] kvm_get_msr_common+0x793/0x960 [kvm]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa02ef012>] vmx_get_msr+0x102/0x370 [kvm_intel]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa02ecfe8>] ? skip_emulated_instruction+0x58/0x60 [kvm_intel]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa02ef2aa>] handle_rdmsr+0x2a/0x140 [kvm_intel]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa02f48b5>] vmx_handle_exit+0xb5/0xa20 [kvm_intel]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa02ec360>] ? vmx_invpcid_supported+0x20/0x20 [kvm_intel]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa0106b20>] kvm_arch_vcpu_ioctl_run+0xc10/0x1130 [kvm]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa010283e>] ? kvm_arch_vcpu_load+0x4e/0x1e0 [kvm]
Apr 05 21:20:51 kvm kernel:  [<ffffffffa00ef5c2>] kvm_vcpu_ioctl+0x2b2/0x5b0 [kvm]
Apr 05 21:20:51 kvm kernel:  [<ffffffff811e4ab8>] ? fsnotify+0x228/0x2f0
Apr 05 21:20:51 kvm kernel:  [<ffffffff814dabe5>] ? _raw_spin_unlock_irq+0x25/0x30
Apr 05 21:20:51 kvm kernel:  [<ffffffff811b6180>] do_vfs_ioctl+0x2e0/0x4c0
Apr 05 21:20:51 kvm kernel:  [<ffffffff811bff9e>] ? __fget+0x6e/0xb0
Apr 05 21:20:51 kvm kernel:  [<ffffffff811b63e1>] SyS_ioctl+0x81/0xa0
Apr 05 21:20:51 kvm kernel:  [<ffffffff814e3069>] system_call_fastpath+0x16/0x1b
Apr 05 21:20:51 kvm kernel: ---[ end trace 4ce12a32c5d85c78 ]---
Apr 05 21:20:51 kvm kernel: ------------[ cut here ]------------

I'm using kernel 3.14.0 and qemu-git.
This happens only when qemu is started with "hv-time" suboption.

Same command line with "hv-time" worked without any problems with kernel 3.13.6.

My config is :
qemu-system-x86_64 \
    -daemonize \
    -pidfile "/run/qemu-$VM.pid" \
    -nodefconfig -nodefaults \
    -name "$VM",process="$VM" \
    -enable-kvm \
    -boot menu=on \
    -rtc base=localtime \
    -machine q35 \
    -balloon none \
    -m 8192 -mem-path /dev/hugepages -mem-prealloc \
    -cpu Haswell,hv-time \
    -smp sockets=1,cores=4,threads=1 \
    -bios bios-256k.bin \
    -chardev file,path="$VM-seabios.log",id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios \
    -vga none \
    -nographic \
    -monitor unix:/run/qemu-$VM.monitor,server,nowait \
    -serial none \
    -parallel none \
    -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
    -device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,romfile=$KVM_ROOT/roms/Sapphire_RadeonHD_7790.rom \
    -device vfio-pci,host=00:1b.0,bus=pcie.0 \
    -device vfio-pci,host=06:00.0,bus=pcie.0 \
    -device vfio-pci,host=09:00.0,bus=pcie.0 \
    -device vfio-pci,host=0b:00.0,bus=pcie.0

Thanks.
Comment 1 flyser42 2014-04-14 14:05:21 UTC
I can confirm the problem. It happens on my gentoo system as well. Let me know, if you want me to create debug logs or similar.
Comment 2 Rasmus Eskola 2014-04-14 14:45:55 UTC
I can also confirm this on my Arch Linux system. Near bare-metal performance on 3.13 kernel with hv-time, but getting these error messages in dmesg on 3.14.
Comment 3 Paolo Bonzini 2014-05-07 16:15:55 UTC
Already fixed by commit b351c39cc9e0151cee9b8d52a1e714928faabb38, but Marcelo forgot to CC stable.  I'll propose the patch myself.
Comment 4 Marcus Schmidt 2014-05-08 08:05:22 UTC
Thanks, now everything works good.