Bug 99861

Summary: KVM: Linux host warns "user requested TSC rate below hardware speed" on the Baytrail-I platform when start a guest
Product: Virtualization Reporter: Zhou, Chao (chao.zhou)
Component: kvmAssignee: Lan Tianyu (tianyu.lan)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: tianyu.lan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.1.0-rc3+ Subsystem:
Regression: No Bisected commit-id:
Attachments: draft fix patch

Description Zhou, Chao 2015-06-12 05:59:49 UTC
Environment:
------------
Host OS (ia32/ia32e/IA64): ia32/ia64
Guest OS (ia32/ia32e/IA64): ia32/ia32e/IA64
Guest OS Type (Linux/Windows): Linux/Windows
kvm.git Commit: c0655fe9b0901a968800f56687be3c62b4cce5d2
qemu-kvm Commit: f053f6b83d01b47adf3b8f29eb0c0769755d1f9c
Host Kernel Version: 4.1.0-rc3+
Hardware: Baytrail-I platform

Bug detailed description:
--------------------------
Linux host warns "user requested TSC rate below hardware speed" on the Baytrail-I platform when start a guest.

The warning is caused by guest tsc setting mismatch with host tsc. KVM records tsc value during Arch init stage while the tsc value may be changed during tsc clock source driver is loaded and refine tsc freq calibration. KVM starts a guest with old tsc value and trigger the warning. Attach a draft patch to fix the issue.

Reproduce steps:
----------------
Run a guest

Current result:
----------------
Linux host produce warning 

Expected result:
----------------
No warning.


Basic root-causing log:
----------------------

[ 1042.255614] ------------[ cut here ]------------
[ 1042.260804] WARNING: CPU: 2 PID: 5232 at arch/x86/kvm/vmx.c:2272 vmx_set_tsc_khz+0x3e/0x50()
[ 1042.270266] user requested TSC rate below hardware speed
[ 1042.276222] Modules linked in:
[ 1042.279657] CPU: 2 PID: 5232 Comm: qemu-system-x86 Tainted: G      D W       4.1.0-rc3+ #2
[ 1042.288923] Hardware name: Huawei Technologies Co., Ltd. AR16XA OSP/Aptio CRB, BIOS 5.6.5 04/17/2015
[ 1042.299160]  ffffffff81f453f8 ffff88026655fbc8 ffffffff81b5eb8a 0000000000000000
[ 1042.307498]  ffff88026655fc18 ffff88026655fc08 ffffffff810e6f8a ffff880200000000
[ 1042.315834]  00000000001d3300 ffff880274100000 0000000000000001 ffff880274100000
[ 1042.324169] Call Trace:
[ 1042.326926]  [<ffffffff81b5eb8a>] dump_stack+0x45/0x57
[ 1042.332693]  [<ffffffff810e6f8a>] warn_slowpath_common+0x8a/0xc0
[ 1042.339432]  [<ffffffff810e7006>] warn_slowpath_fmt+0x46/0x50
[ 1042.345884]  [<ffffffff81253c9e>] ? alloc_pages_current+0x10e/0x1d0
[ 1042.352913]  [<ffffffff8101e48b>] ? kvm_arch_vcpu_init+0x6b/0x230
[ 1042.359754]  [<ffffffff8104676e>] vmx_set_tsc_khz+0x3e/0x50
[ 1042.366005]  [<ffffffff810112f7>] kvm_set_tsc_khz.part.106+0xa7/0xe0
[ 1042.373136]  [<ffffffff8101e628>] kvm_arch_vcpu_init+0x208/0x230
[ 1042.379877]  [<ffffffff81003bf9>] kvm_vcpu_init+0xc9/0x110
[ 1042.386037]  [<ffffffff81049fd0>] vmx_create_vcpu+0x70/0xc30
[ 1042.392390]  [<ffffffff8112a5c8>] ? pick_next_task_fair+0x1d8/0xc50
[ 1042.399420]  [<ffffffff8101dc9e>] kvm_arch_vcpu_create+0x3e/0x60
[ 1042.406157]  [<ffffffff81009f00>] kvm_vm_ioctl+0x1a0/0x770
[ 1042.412313]  [<ffffffff8129f395>] ? __fget+0x5/0x200
[ 1042.417886]  [<ffffffff81293448>] do_vfs_ioctl+0x308/0x540
[ 1042.424044]  [<ffffffff8129f301>] ? expand_files+0x1f1/0x280
[ 1042.430395]  [<ffffffff8147836b>] ? selinux_file_ioctl+0x5b/0x100
[ 1042.437231]  [<ffffffff81293701>] SyS_ioctl+0x81/0xa0
[ 1042.442900]  [<ffffffff81b6a72e>] system_call_fastpath+0x12/0x76
[ 1042.449639] ---[ end trace 93158310429e56fc ]---
Comment 1 Lan Tianyu 2015-06-12 06:40:09 UTC
Created attachment 179781 [details]
draft fix patch
Comment 2 Lan Tianyu 2015-06-17 08:43:01 UTC
Fix patch has been sent to maillist.
http://www.spinics.net/lists/kvm/msg117637.html