Bug 581396

Summary: [PATCH][RHEL5.5] Fix Time drift on KVM x86_64 RHEL5.5 Guest using PV clock
Product: Red Hat Enterprise Linux 5 Reporter: Teruaki Ishizaki <ishizaki.teruaki>
Component: kernelAssignee: Glauber Costa <gcosta>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: low    
Version: 5.5CC: mjenner, philippe.plouffe, tburke, virt-maint, ykaul
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 21:25:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 580949    
Attachments:
Description Flags
fixed for calculating cycles_per_tick none

Description Teruaki Ishizaki 2010-04-12 06:11:48 UTC
Description of problem:
 On KVM x86_64 RHEL5.5 Guest with clock=tsccount kernel parameter, time
is drift.
 I verified same problem with 2.6.18-164.2.1.el5 or later version.

 Jiffies are calculated with cycles_per_tick and
 cycles_per_tick is incorrect value in x86_64 KVM Guest using
clock=tsccount kernel parameter.

 I made a patch to fix this problem.

How reproducible:
Set x86_64 KVM Guest kernel parameter clocl=tsccount.

Steps to Reproduce:
1. set x86_64 KVM Guest kernel parameter clock=tsccount
2. date; sleep 2; date; sleep 2; ......
3. check speed of date command output

Additional info:
 There is not time drift with kerenel-2.6.18-164.el5.

Comment 1 Teruaki Ishizaki 2010-04-12 06:13:40 UTC
Created attachment 405894 [details]
fixed for calculating cycles_per_tick

Comment 2 Glauber Costa 2010-06-07 15:58:29 UTC
The problem is valid, but the patch is wrong.
It totally breaks kvmclock. I am cooking up a new one, and will submit for inclusion soon.

Comment 5 Jarod Wilson 2010-07-12 15:45:45 UTC
in kernel-2.6.18-206.el5
You can download this test kernel from http://people.redhat.com/jwilson/el5

Detailed testing feedback is always welcomed.

Comment 7 Teruaki Ishizaki 2010-07-22 01:54:54 UTC
I understand that it is the following thing, am I right?

==================================================
[when kernel version is kernel-2.6.18-164.2.1.el5 or later version]
1) use_kvm_time = 1 && timekeeping_use_tsc = 1
=> use hypervisor clock(cycles per tick = hv_clock cycle)
2) use_kvm_time = 0 && timekeeping_use_tsc = 1
=> use tsc directly(cycles per tick = cpu_khz(or tsc_khz))
==================================================

I tested using kernel-2.6.18-206.el5 and verified problem was fixed.

Comment 9 errata-xmlrpc 2011-01-13 21:25:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0017.html