Bug 783921 - libvirt cannot disable kvmclock
Summary: libvirt cannot disable kvmclock
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2012-01-23 09:22 UTC by Paolo Bonzini
Modified: 2012-06-20 06:47 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.9.10-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-06-20 06:47:00 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Paolo Bonzini 2012-01-23 09:22:30 UTC
Description of problem:
kvmclock is disabled using a fake CPU feature, but this feature obviously does not appear in libvirt's cpuid data files.

Version-Release number of selected component (if applicable):

None of these XML snippets work:

   <cpu mode='host-model'>
     <feature policy='disable' name='kvmclock'/>

   <cpu mode='host-passthrough'>
     <feature policy='disable' name='kvmclock'/>

     <feature policy='disable' name='kvmclock'/>

A better fit is anyway the <timer> element:

     <timer name='kvmclock' present='yes'/>

Comment 3 Jiri Denemark 2012-01-27 16:37:26 UTC
This feature is now implemented upstream by v0.9.9-140-gb66d1be and v0.9.9-139-g5a137f3:

commit b66d1bef14739ab56ed9f430b4c4e5b89ed5ed12
Author: Paolo Bonzini <pbonzini>
Date:   Fri Jan 27 14:49:52 2012 +0100

    qemu: parse and create -cpu ...,-kvmclock
    QEMU supports a bunch of CPUID features that are tied to the kvm CPUID
    nodes rather than the processor's.  They are "kvmclock",
    "kvm_nopiodelay", "kvm_mmu", "kvm_asyncpf".  These are not known to
    libvirt and their CPUID leaf might move if (for example) the Hyper-V
    extensions are enabled. Hence their handling would anyway require some
    However, among these the most useful is kvmclock; an additional
    "property" of this feature is that a <timer> element is a better model
    than a CPUID feature.  Although, creating part of the -cpu command-line
    from something other than the <cpu> XML element introduces some

commit 5a137f3620af4f6fd4a4484c6d79af0748aec85e
Author: Paolo Bonzini <pbonzini>
Date:   Fri Jan 27 14:49:51 2012 +0100

    conf: add kvmclock timer
    Add kvmclock timer to documentation, schema and parsers.  Keep the
    platform timer first since it is kind of special, and alphabetize
    the others when possible (i.e. when it does not change the ABI).

Comment 6 Min Zhan 2012-02-15 02:58:49 UTC
Verified this bug with libvirt-0.9.10-1.el6
1. For a shutdown guest,
# virsh edit guest
  <clock offset='utc'>
    <timer name='kvmclock' present='yes'/>

2. # virsh start guest
   # ps -ef |grep kvm
   qemu     12826     1 43 04:56 ?        00:00:20 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -cpu qemu64,+kvmclock -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel62......

You can find '-cpu qemu64,+kvmclock' from qemu cmd. Also login the guest and check
# dmesg|grep kvm
kvm-clock: Using msrs 4b564d01 and 4b564d00
kvm-clock: cpu 0, msr 0:1c1df41, boot clock
kvm-clock: cpu 0, msr 0:2215f41, primary cpu clock
Switching to clocksource kvm-clock

3. # virsh destroy guest
   # virsh edit guest
  <clock offset='utc'>
    <timer name='kvmclock' present='no'/>

4. # virsh start guest
   # ps -ef |grep kvm
qemu     13115     1 13 04:58 ?        00:00:00 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -cpu qemu64,-kvmclock -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel62

You can find '-cpu qemu64,-kvmclock' from qemu cmd. Also login the guest and check
# dmesg|grep kvm
nothing return.

Comment 8 errata-xmlrpc 2012-06-20 06:47:00 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.


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