Bug 998109 - Let's enable kvmclock in RHEL 7
Let's enable kvmclock in RHEL 7
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On: 998108
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-17 05:37 EDT by Richard W.M. Jones
Modified: 2014-06-17 22:00 EDT (History)
6 users (show)

See Also:
Fixed In Version: libguestfs-1.22.6-12.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 998108
Environment:
Last Closed: 2014-06-13 06:22:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2013-08-17 05:37:21 EDT
+++ This bug was initially created as a clone of Bug #998108 +++

+++ This bug was initially created as a clone of Bug #998065 +++

Upstream we switched over to using kvmclock (038ed0a08e & c53b459fdd).
We should do so in RHEL too since it would avoid most of
the trouble with clock instability.

https://github.com/libguestfs/libguestfs/commit/038ed0a08eaed33e62a27c9f91780a25de0bc08c
https://github.com/libguestfs/libguestfs/commit/c53b459fdd7fc340f48a76496b7e7e18256a2d64
Comment 3 Richard W.M. Jones 2013-10-03 10:22:22 EDT
Turns out we need:
216cb004aef8ad6cb554ecdb9d7c4eb7634fe678
otherwise libvirt doesn't actually enable kvmclock.
Comment 4 Richard W.M. Jones 2013-10-16 14:56:19 EDT
libguestfs-1.22.6-12.el7
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6429251
Comment 5 Lingfei Kong 2014-01-27 23:45:01 EST
Hi Rich,
I try to verify this bug with libguestfs-1.22.6-18.el7 according the steps recorded in https://bugzilla.redhat.com/show_bug.cgi?id=998108#c2 :

[root@rhel7libguestfs ~]# guestfish -x -v -N fs > boot.log 2>&1
[root@rhel7libguestfs ~]# cat boot.log | grep -Ei "kvmclock|kvm-clock"
libguestfs: libvirt XML:\n<?xml version="1.0"?>\n<domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">\n  <name>guestfs-m8wwuh1utchd0hnb</name>\n  <memory unit="MiB">500</memory>\n  <currentMemory unit="MiB">500</currentMemory>\n  <cpu mode="host-passthrough">\n    <model fallback="allow"/>\n  </cpu>\n  <vcpu>1</vcpu>\n  <clock offset="utc">\n    <timer name="kvmclock" present="yes"/>\n  </clock>\n  <os>\n    <type>hvm</type>\n    <kernel>/var/tmp/.guestfs-0/kernel.9501</kernel>\n    <initrd>/var/tmp/.guestfs-0/initrd.9501</initrd>\n    <cmdline>panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm</cmdline>\n  </os>\n  <on_reboot>destroy</on_reboot>\n  <devices>\n    <controller type="scsi" index="0" model="virtio-scsi"/>\n    <disk device="disk" type="file">\n      <source file="/root/test1.img"/>\n      <target dev="sda" bus="scsi"/>\n      <driver name="qemu" type="raw" cache="writeback"/>\n      <address type="drive" controller="0" bus="0" target="0" unit="0"/>\n    </disk>\n    <disk type="file" device="disk">\n      <source file="/tmp/libguestfsvzQGi1/snapshot1"/>\n      <target dev="sdb" bus="scsi"/>\n      <driver name="qemu" type="qcow2" cache="unsafe"/>\n      <address type="drive" controller="0" bus="0" target="1" unit="0"/>\n      <shareable/>\n    </disk>\n    <serial type="unix">\n      <source mode="connect" path="/tmp/libguestfsvzQGi1/console.sock"/>\n      <target port="0"/>\n    </serial>\n    <channel type="unix">\n      <source mode="connect" path="/tmp/libguestfsvzQGi1/guestfsd.sock"/>\n      <target type="virtio" name="org.libguestfs.channel.0"/>\n    </channel>\n  </devices>\n  <qemu:commandline>\n    <qemu:env name="TMPDIR" value="/var/tmp"/>\n  </qemu:commandline>\n</domain>\n

---------------------------------------------------------------------------------
But I can not find such lines in  boot.log:
"     -cpu host,+kvmclock \
    ...
    kvm-clock: Using msrs 4b564d01 and 4b564d00
    kvm-clock: cpu 0, msr 0:1c247c1, boot clock
    kvm-clock: cpu 0, msr 0:22167c1, primary cpu clock
    [    0.381003] Switching to clocksource kvm-clock
"'

Is there anything wrong with my steps? How can I make sure kvmclock is enabled in rhel7 and works well? 

Thanks and Best Regards,
Lingfei Kong
Comment 6 Richard W.M. Jones 2014-01-28 03:52:57 EST
A few points:

(1) "-cpu host,+kvmclock" is NOT necessary to enable kvm-clock.
It is enabled by default for KVM guests.

(2) You SHOULD see:
    Switching to clocksource kvm-clock
during boot.

(3) If you are testing this inside a RHEL 7 VM, it won't work.  kvm-clock
is only enabled for KVM guests, not for TCG guests.

Do you see another clocksource mentioned in the output of
libguestfs-test-tool?
Comment 7 bfan 2014-01-28 04:18:05 EST
(In reply to Richard W.M. Jones from comment #6)
> A few points:
> 
> (1) "-cpu host,+kvmclock" is NOT necessary to enable kvm-clock.
> It is enabled by default for KVM guests.
> 
> (2) You SHOULD see:
>     Switching to clocksource kvm-clock
> during boot.
> 
> (3) If you are testing this inside a RHEL 7 VM, it won't work.  kvm-clock
> is only enabled for KVM guests, not for TCG guests.
> 
> Do you see another clocksource mentioned in the output of
> libguestfs-test-tool?

Thanks, Rich, saw the "Switching to clocksource kvm-clock"

# cat libguestfs-test-tool.log | grep kvm-clock
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:1f071001, boot clock
[    0.000000] kvm-clock: cpu 0, msr 0:1f071001, primary cpu clock
[    0.377039] Switching to clocksource kvm-clock

Package version:
libguestfs-1.22.6-18.el7.x86_64
libvirt-1.1.1-19.el7.x86_64

So, verified this bug.
Comment 8 Ludek Smid 2014-06-13 06:22:00 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.