From: Anthony Liguori <anthony@codemonkey.ws>
To: Chris Wright <chrisw@sous-sol.org>
Cc: kvm-devel@lists.sourceforge.net, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: pinning, tsc and apic
Date: Thu, 15 May 2008 09:10:01 -0500 [thread overview]
Message-ID: <482C4439.4010601@codemonkey.ws> (raw)
In-Reply-To: <20080515065912.GE4017@sequoia.sous-sol.org>
Chris Wright wrote:
> * Anthony Liguori (anthony@codemonkey.ws) wrote:
>
>> From a quick look, I suspect that the number of wildly off TSC
>> calibrations correspond to the VMs that are misbehaving. I think this
>> may mean that we have to re-examine the tsc delta computation.
>>
>> 10_serial.log:time.c: Detected 1995.038 MHz processor.
>> 11_serial.log:time.c: Detected 2363.195 MHz processor.
>> 12_serial.log:time.c: Detected 2492.675 MHz processor.
>> 13_serial.log:time.c: Detected 1995.061 MHz processor.
>> 14_serial.log:time.c: Detected 1994.917 MHz processor.
>> 15_serial.log:time.c: Detected 4100.735 MHz processor.
>> 16_serial.log:time.c: Detected 2075.800 MHz processor.
>> 17_serial.log:time.c: Detected 2674.350 MHz processor.
>> 18_serial.log:time.c: Detected 1995.002 MHz processor.
>> 19_serial.log:time.c: Detected 1994.978 MHz processor.
>> 1_serial.log:time.c: Detected 4384.310 MHz processor.
>>
>
> Is this with pinning? We at least know we're losing small bits on
> migration. From my measurements it's ~3000 (outliers are 10-20k).
>
> Also, what happens if you roll back to kvm-userspace 7f5c4d15ece5?
>
> I'm using this:
>
> diff -up arch/x86/kvm/svm.c~svm arch/x86/kvm/svm.c
> --- arch/x86/kvm/svm.c~svm 2008-04-16 19:49:44.000000000 -0700
> +++ arch/x86/kvm/svm.c 2008-05-14 23:44:18.000000000 -0700
> @@ -621,6 +621,13 @@ static void svm_free_vcpu(struct kvm_vcp
> kmem_cache_free(kvm_vcpu_cache, svm);
> }
>
> +static void svm_tsc_update(void *arg)
> +{
> + struct vcpu_svm *svm = arg;
> + rdtscll(svm->vcpu.arch.host_tsc);
> +
> +}
> +
> static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
> {
> struct vcpu_svm *svm = to_svm(vcpu);
> @@ -633,6 +640,9 @@ static void svm_vcpu_load(struct kvm_vcp
> * Make sure that the guest sees a monotonically
> * increasing TSC.
> */
> + if (vcpu->cpu != -1)
> + smp_call_function_single(vcpu->cpu, svm_tsc_update,
> + svm, 0, 1);
>
I like this approach because of its simplicity although the IPI is not
wonderful. I was also thinking of using cpu_clock() to take a timestamp
on vcpu_put, then on vcpu_load, take another timestamp and use the
cyc2ns conversion to try and estimate the elapsed tsc ticks on the new cpu.
Regards,
Anthony Liguori
> rdtscll(tsc_this);
> delta = vcpu->arch.host_tsc - tsc_this;
> svm->vmcb->control.tsc_offset += delta;
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-05-15 14:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 19:19 pinning, tsc and apic Ryan Harper
2008-05-12 19:49 ` Anthony Liguori
2008-05-12 21:23 ` Ryan Harper
2008-05-12 21:44 ` Anthony Liguori
2008-05-13 18:56 ` Ryan Harper
2008-05-14 23:25 ` Marcelo Tosatti
2008-05-14 23:45 ` Anthony Liguori
2008-05-15 6:59 ` Chris Wright
2008-05-15 14:10 ` Anthony Liguori [this message]
2008-05-15 16:26 ` Ryan Harper
2008-06-18 13:12 ` [kvm-devel] " Avi Kivity
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=482C4439.4010601@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=chrisw@sous-sol.org \
--cc=kvm-devel@lists.sourceforge.net \
--cc=mtosatti@redhat.com \
/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.