Bug 658467

Summary: kvm clock breaks migration result stability - for unit test propose
Product: Red Hat Enterprise Linux 6 Reporter: Michael S. Tsirkin <mst>
Component: qemu-kvmAssignee: jason wang <jasowang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: flang, jasowang, juzhang, kcao, lihuang, michen, mkenneth, qzhang, tburke, virt-maint
Target Milestone: rc   
Target Release: 6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.188.el6 Doc Type: Bug Fix
Doc Text:
Cause: Qemu-kvm would query the the value of kvmclock every time when user do savevm even the vm have been stopped. Consequence: This would cause the two sequent savevm after vm is stopped produce a two different result which breaks the unit-test of migration. Fix: Introduce a new kvmclock device and register a vm state change notifier to record when the kvmclock value is valid. And query and save the kvmclock only the valid flag is set. Result: Kvmclock section is stable for migration unit-test.
Story Points: ---
Clone Of:
: 662386 (view as bug list) Environment:
Last Closed: 2011-12-06 15:43:57 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: 580954, 662386, 743047    

Description Michael S. Tsirkin 2010-11-30 13:21:51 UTC
Description of problem:
doing savevm twice when VM is stopped
should produce identical result.
This is useful e.g. for testing.

For kvm clock this is not so.

Three problems:
1. as the result stored changes on each savevm,
   results in the file are not stable
2. Disabling kvmclock in cpuid does not help
3. migration from host kernel which has kvmclock
   to host kernel which does not is broken
   even though -kvmclock is disabled in cpuid
   so cpu id flags are consistent

Comment 2 Glauber Costa 2010-12-01 14:39:30 UTC
Michael/Jason,

Just an update: I am working on it, and have patches that should be ready RSN.

From your usecase perspective, could you please let me know the relevance/importance of each of the 3 items?

As the patches are not ready yet, I don't know if it will be worth to separate this into different bugzillas or not. Maybe we should.

Thanks!

Comment 3 Michael S. Tsirkin 2010-12-01 14:48:10 UTC
Fixing either 1 or 2 is most important for me.

Comment 4 Glauber Costa 2010-12-06 15:58:02 UTC
Upstream patch at:

http://lists.gnu.org/archive/html/qemu-devel/2010-12/msg00443.html

Comment 5 Glauber Costa 2011-02-01 18:52:40 UTC
Setting conditional NAK upstream.

This is under heavy discussion , and the end result is unclear.

Comment 8 Michael S. Tsirkin 2011-02-06 11:28:28 UTC
To Comment 5: link to the discussion?

Comment 12 juzhang 2011-06-09 06:45:04 UTC
Hi,Mst/Jason

   Our qe don't very clear  what's this issue really means? would you please explain and give qe a efficient way to reproduce and verify this issue?

Comment 18 langfang 2011-09-21 07:58:07 UTC
verified this issue  with fixed version qemu-kvm-0.12.1.2-2.190.el6.x86_64 using steps as comment13
step:
1.boot guest which has kvmclock
 #/usr/libexec/qemu-kvm...-rtc base=localtime,clock=host,driftfix=slew
2.migrate -d tcp...

Result:
migrate successful,and the kvm clock result is stability and not clock drift.

Above all,this issue has been fixed.

Comment 19 langfang 2011-09-21 08:05:11 UTC
verified this issue  with fixed version qemu-kvm-0.12.1.2-2.190.el6.x86_64  kernel-2.6.32-198.el6.x86_64

Comment 21 jason wang 2011-11-18 02:37:37 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
Qemu-kvm would query the the value of kvmclock every time when user do savevm even the vm have been stopped.

Consequence:
This would cause the two sequent savevm after vm is stopped produce a two different result which breaks the unit-test of migration.

Fix:
Introduce a new kvmclock device and register a vm state change notifier to record when the kvmclock value is valid. And query and save the kvmclock only the valid flag is set.

Result:
Kvmclock section is stable for migration unit-test.

Comment 22 errata-xmlrpc 2011-12-06 15:43:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

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