kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH QEMU-KVM 6/7] test: Add ipi_halt benchmark
Date: Tue, 22 Sep 2009 09:12:12 +0300	[thread overview]
Message-ID: <4AB86ABC.3040205@redhat.com> (raw)
In-Reply-To: <20090922015411.GA1967@amt.cnet>

On 09/22/2009 04:54 AM, Marcelo Tosatti wrote:
> On Mon, Sep 21, 2009 at 11:55:37AM +0300, Avi Kivity wrote:
>    
>> Wait for 2000 cycles after the IPI to allow the host to schedule out.
>> Measures wake-from-idle overhead.
>>
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>> ---
>>   kvm/user/test/x86/vmexit.c |   11 +++++++++++
>>   1 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/kvm/user/test/x86/vmexit.c b/kvm/user/test/x86/vmexit.c
>> index 29bb32a..5088dc9 100644
>> --- a/kvm/user/test/x86/vmexit.c
>> +++ b/kvm/user/test/x86/vmexit.c
>> @@ -66,6 +66,16 @@ static void ipi(void)
>>   	on_cpu(1, nop, 0);
>>   }
>>
>> +static void ipi_halt(void)
>> +{
>> +	unsigned long long t;
>> +
>> +	on_cpu(1, nop, 0);
>> +	t = rdtsc() + 2000;
>> +	while (rdtsc()<  t)
>> +		;
>>      
> I don't get the 2000 cycle thing. Since vcpu1 is on hlt by default, just
> IPI'ing it to do nop() already includes wake-from-idle overhead?
>    

Without the delay, by the time vcpu1 gets to schedule() it will already 
have been woken up by vcpu0.  So it never switches to the idle thread.

The purpose of this test was to measure the just-in-time MSR switching, 
and that only helps if a context switch takes place.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2009-09-22  6:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21  8:55 [PATCH QEMU-KVM 0/7] test: more IPI tests Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 1/7] test: issue EOI after IPI Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 2/7] test: set up per-cpu area Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 3/7] test: optimize smp_id() Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 4/7] test: add conditional execution for vmexit tests Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 5/7] test: add ipi latency test Avi Kivity
2009-09-21  8:55 ` [PATCH QEMU-KVM 6/7] test: Add ipi_halt benchmark Avi Kivity
2009-09-22  1:54   ` Marcelo Tosatti
2009-09-22  6:12     ` Avi Kivity [this message]
2009-09-21  8:55 ` [PATCH QEMU-KVM 7/7] test: Auto-tune vmexit test 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=4AB86ABC.3040205@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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 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).