qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: qemu-devel@nongnu.org
Cc: Haozhong Zhang <haozhong.zhang@intel.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the value from KVM
Date: Mon, 28 Sep 2015 13:38:30 +0800	[thread overview]
Message-ID: <1443418711-24106-3-git-send-email-haozhong.zhang@intel.com> (raw)
In-Reply-To: <1443418711-24106-1-git-send-email-haozhong.zhang@intel.com>

When creating a vcpu, we initialize its TSC rate to the value from
KVM (through ioctl KVM_GET_TSC_KHZ).

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 target-i386/kvm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7b0ba17..c2b161a 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -751,6 +751,13 @@ int kvm_arch_init_vcpu(CPUState *cs)
         }
     }
 
+    r = kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ);
+    if (r < 0) {
+        fprintf(stderr, "KVM_GET_TSC_KHZ failed\n");
+        return r;
+    }
+    env->tsc_khz = r;
+
     if (kvm_has_xsave()) {
         env->kvm_xsave_buf = qemu_memalign(4096, sizeof(struct kvm_xsave));
     }
-- 
2.4.8

  parent reply	other threads:[~2015-09-28  5:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28  5:38 [Qemu-devel] [PATCH 0/3] target-i386: save/restore vcpu's TSC rate during migration Haozhong Zhang
2015-09-28  5:38 ` [Qemu-devel] [PATCH 1/3] target-i386: add a subsection of vcpu's TSC rate in vmstate_x86_cpu Haozhong Zhang
2015-09-29 19:00   ` Dr. David Alan Gilbert
2015-09-30  1:17     ` Haozhong Zhang
2015-09-30  8:07       ` Dr. David Alan Gilbert
2015-10-06  1:24         ` Haozhong Zhang
2015-09-28  5:38 ` Haozhong Zhang [this message]
2015-09-28 16:17   ` [Qemu-devel] [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the value from KVM Eduardo Habkost
2015-09-29  1:23     ` Haozhong Zhang
2015-09-29  1:46       ` Haozhong Zhang
2015-09-28  5:38 ` [Qemu-devel] [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration Haozhong Zhang
2015-09-28 16:37   ` Eduardo Habkost
2015-09-29  3:43     ` Haozhong Zhang
2015-09-29 18:02       ` Eduardo Habkost
2015-09-30  0:32         ` Haozhong Zhang
2015-09-30 20:36           ` Eduardo Habkost
2015-10-06  1:20             ` Haozhong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443418711-24106-3-git-send-email-haozhong.zhang@intel.com \
    --to=haozhong.zhang@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).