RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 998109 - Let's enable kvmclock in RHEL 7
Summary: Let's enable kvmclock in RHEL 7
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 998108
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-17 09:37 UTC by Richard W.M. Jones
Modified: 2014-06-18 02:00 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.22.6-12.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 998108
Environment:
Last Closed: 2014-06-13 10:22:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-08-17 09:37:21 UTC
+++ 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 14:22:22 UTC
Turns out we need:
216cb004aef8ad6cb554ecdb9d7c4eb7634fe678
otherwise libvirt doesn't actually enable kvmclock.

Comment 4 Richard W.M. Jones 2013-10-16 18:56:19 UTC
libguestfs-1.22.6-12.el7
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6429251

Comment 5 Lingfei Kong 2014-01-28 04:45:01 UTC
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 08:52:57 UTC
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 09:18:05 UTC
(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 10:22:00 UTC
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.