Bug 1103245

Summary: libvirt reset rtc interrupt backlog after guest-set-time
Product: Red Hat Enterprise Linux 7 Reporter: Marcelo Tosatti <mtosatti>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, honzhang, mkalinin, mprivozn, mzhan, rbalakri, zhwang
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:36:57 UTC Type: Bug
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: 1049038    

Description Marcelo Tosatti 2014-05-30 14:18:04 UTC
libvirt should execute QMP's rtc_reset_reinjection command after 
executing guest-set-time guest agent command.

This is necessary to avoid the problem described in the rtc_reset_reinjection 
patchset:

http://www.mail-archive.com/qemu-devel@nongnu.org/msg236435.html

Comment 2 Michal Privoznik 2014-08-13 12:52:22 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2014-August/msg00576.html

Comment 3 Michal Privoznik 2014-08-20 12:33:47 UTC
Moving to POST:

commit b606bbb416e264466a3f5af62a13163e432d0f49
Author:     Michal Privoznik <mprivozn>
AuthorDate: Wed Aug 13 14:28:24 2014 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Aug 20 14:20:05 2014 +0200

    qemu: Issue rtc-reset-reinjection command after guest-set-time
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1103245
    
    An advice appeared there on the qemu-devel list [1]. When a domain is
    suspended and then resumed guest kernel is not aware of this. So we've
    introduced virDomainSetTime API that resets the time within guest
    using qemu-ga. On the other hand, qemu itself is trying to make RTC
    beat faster to catch the difference. But if we don't tell qemu that
    guest's time was reset via the other method, both mechanisms are
    applied resulting in again wrong guest time. In order to avoid summing
    both corrections we need to tell qemu that it should not use the RTC
    injection if the guest time is set via guest agent.
    
    1: http://www.mail-archive.com/qemu-devel@nongnu.org/msg236435.html
    
    Signed-off-by: Michal Privoznik <mprivozn>


v1.2.7-184-gb606bbb

Comment 5 zhenfeng wang 2014-10-13 10:00:23 UTC
Try to set guest time with qemu-ga with libvirt-1.2.7-2, didn't see any event or logs about rtc_reset_reinjection in libvirt log, even set the log_level =1 in /etc/libvirt/libvirtd.log, so this bug reproduced. And after update the libvirt to the latest one libvirt-1.2.8-5.el7, i could catch the log that libvirt execute QMP's rtc_reset_reinjection command after executing guest-set-time guest agent command. so this bug can be markd verified. the following was the verify steps

pkginfo
libvirt-1.2.8-5.el7.x86_64

steps
1.Prepare a guest with qemu-ga installed
2.Setting logs for libvirt
#cat /etc/libvirt/libvirtd.log
log_level = 1
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
#service libvirtd restart

3.Set the time to the guest with the qemu-ga
#virsh domtime rhel6 --time 12345

4.check the logs, could see the log that libvirt have executed QMP's rtc_reset_reinjection command after excuing guest-set-time guest agent command
#cat /var/log/libvirt/libvirtd.log
--
2014-10-13 08:01:33.259+0000: 10545: debug : qemuAgentCommand:1104 : Send command '{"execute":"guest-set-time","arguments":{"time":90121345000000000}}' for write, seconds = -2
--
--
2014-10-13 07:46:16.575+0000: 6314: debug : virJSONValueToString:1303 : result={"execute":"rtc-reset-reinjection","id":"libvirt-10"}

2014-10-13 07:46:16.575+0000: 6314: debug : qemuMonitorJSONCommandWithFd:286 : Send command '{"execute":"rtc-reset-reinjection","id":"libvirt-10"}' for write with FD -1
2014-10-13 07:46:16.575+0000: 6314: debug : qemuMonitorSend:976 : QEMU_MONITOR_SEND_MSG: mon=0x7f6f280079e0 msg={"execute":"rtc-reset-reinjection","id":"libvirt-10"}^M
 fd=-1
2014-10-13 07:46:16.575+0000: 6310: debug : qemuMonitorIOWrite:507 : QEMU_MONITOR_IO_WRITE: mon=0x7f6f280079e0 buf={"execute":"rtc-reset-reinjection","id":"libvirt-10"}^M
 len=55 ret=55 errno=11

Comment 7 errata-xmlrpc 2015-03-05 07:36: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.

https://rhn.redhat.com/errata/RHSA-2015-0323.html