From: Paolo Bonzini <pbonzini@redhat.com>
To: Jintack Lim <jintack@cs.columbia.edu>
Cc: Christoffer Dall <christofferdall@gmail.com>,
KVM General <kvm@vger.kernel.org>,
Shih-Wei Li <shihwei@cs.columbia.edu>
Subject: Re: rdtsc() in kvm-unit-tests on x86
Date: Mon, 10 Aug 2015 16:47:44 +0200 [thread overview]
Message-ID: <55C8B990.7000600@redhat.com> (raw)
In-Reply-To: <CAHyh4xgZMzfzCa1j7vB8Wf71=LhwhrwfPT4KcSfcs02m5-Bh6g@mail.gmail.com>
On 10/08/2015 16:14, Jintack Lim wrote:
>> > Yes, you just use the TSC. :) However, you first have to check that the
>> > TSC is consistent across CPUs. On older machines it's not, but the
>> > kernel can detect it.
> Thanks, Paolo.
>
> What would be the best way to check if TSC is consistent across CPUs?
You need to have boot_cpu_has(X86_FEATURE_CONSTANT_TSC) and
boot_cpu_has(X86_FEATURE_NONSTOP_TSC).
However, I would just use TAI (ktime_get_clocktai). x86 KVM provides a
paravirtual interface that synchronizes CLOCK_TAI with the host, and
using it is the simplest way to get synchronized times between the host
and the guest.
Paolo
> Is it synchronized in nano second (or even cpu clock cycle) resolution?
>
> To get synchronized tsc across the host and the guest,
> just calling rdtscll() in host and guest would be enough?
next prev parent reply other threads:[~2015-08-10 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-07 19:19 rdtsc() in kvm-unit-tests on x86 Jintack Lim
2015-08-10 9:02 ` Paolo Bonzini
[not found] ` <CAEDV+g+hwvSqWUjNAKcJVcTf-6vXx5j+YiN=aaYKJbo=pmWcEw@mail.gmail.com>
2015-08-10 13:58 ` Paolo Bonzini
2015-08-10 14:14 ` Jintack Lim
2015-08-10 14:47 ` Paolo Bonzini [this message]
2015-08-10 15:38 ` Jintack Lim
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=55C8B990.7000600@redhat.com \
--to=pbonzini@redhat.com \
--cc=christofferdall@gmail.com \
--cc=jintack@cs.columbia.edu \
--cc=kvm@vger.kernel.org \
--cc=shihwei@cs.columbia.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.