linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Xiantao" <xiantao.zhang@intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"Yang, Xiaowei" <xiaowei.yang@intel.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	"Li, Xin" <xin.li@intel.com>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Mike Galbraith <efault@gmx.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: RE: VM performance issue in KVM guests.
Date: Fri, 16 Apr 2010 10:27:14 +0800	[thread overview]
Message-ID: <EB8593BCECAB3D40A8248BE0B6400A38469C71EB@shzsmsx502.ccr.corp.intel.com> (raw)
In-Reply-To: <4BC57949.2090003@redhat.com>

Avi Kivity wrote:
> On 04/14/2010 06:24 AM, Zhang, Xiantao wrote:
>> 
>>>>> Spin loops need to be addressed first, they are known to kill
>>>>> performance in overcommit situations.
>>>>> 
>>>>> 
>>>> Even in overcommit case, if vcpu threads of one qemu are not
>>>> scheduled or pulled to the same logical processor, the performance
>>>> drop is tolerant like Xen's case today. But for KVM, it has to
>>>> suffer from additional performance loss, since host's scheduler
>>>> actively pulls these vcpu threads together.
>>>> 
>>>> 
>>>> 
>>> Can you quantify this loss?  Give examples of what happens?
>>> 
>> For example, one machine is configured with 2 pCPUs and there are
>> two Windows guests running on the machine, and each guest is
>> cconfigured with 2 vcpus and one webbench server runs in it.  
>> If use host's default scheduler, webbench's performance is very bad,
>> but if pin each geust's vCPU0 to pCPU0 and vCPU1 to pCPU1, we can
>> see 5-10X performance improvement with same CPU utilization.  
>> In addition, we also see kvm's perf scalability is also impacted in
>> large systems, for some performance experiments, kvm's perf begins
>> to drop when vCPU is overcommitted and pCPU are saturated, but once
>> the wake_up_affine feature is switched off in scheduler, kvm's perf
>> can keep rising in this case.    
>> 
> 
> Ok.  This is probably due to spinlock contention.

Yes, exactly. 

> When vcpus are pinned to pcpus, there is a 50% chance that a guest's
> vcpus will be co-scheduled and spinlocks will perform will.
> 
> When vcpus are not pinned, but affine wakeups are disabled, there is a
> 33% chance that vcpus will be co-scheduled.
> 
> When vcpus are not pinned and affine wakeups are enabled there is a 0%
> chance that vcpus will be co-scheduled.
> 
> Keeping both vcpus on the same core actually makes sense since they
> can communicate through the local cache faster than across cores. 
> What we need is to make sure that they don't spin.
> 
> Windows 2008 can report spinlock spinning through a hypercall.  Can
> you hook to that interface and see if it happens regularly? 
> Altenatively use a PLE capable host and trace the kvm_vcpu_on_spin()
> function. 
We only tried windows 2003 for the experiments, and have no data related to windows 2008. 
But maybe we can have  a try later.  Anyway, the key point is we have to enhance the scheduler to let it 
Know which threads are vcpu threads to avoid perf loss in this case.
Xiantao

  reply	other threads:[~2010-04-16  2:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <EB8593BCECAB3D40A8248BE0B6400A3846903F4C@shzsmsx502.ccr.corp.intel.com>
2010-04-10 19:27 ` VM performance issue in KVM guests Avi Kivity
2010-04-12  2:04   ` Zhang, Xiantao
2010-04-12  6:40     ` Avi Kivity
2010-04-13  0:50       ` Zhang, Xiantao
2010-04-13  6:46         ` Avi Kivity
2010-04-14  3:24           ` Zhang, Xiantao
2010-04-14  8:14             ` Avi Kivity
2010-04-16  2:27               ` Zhang, Xiantao [this message]
2010-04-17 19:02                 ` Avi Kivity
     [not found]       ` <p2o2eae271004142158xaa5da968ueff0c2afe6894f9d@mail.gmail.com>
2010-04-15  8:18         ` Avi Kivity
2010-04-15 13:33           ` Peter Zijlstra
2010-04-15 16:43             ` Srivatsa Vaddagiri
2010-04-16 10:40               ` Peter Zijlstra
2010-04-19  1:32               ` Zhang, Xiantao
2010-04-17 19:04             ` 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=EB8593BCECAB3D40A8248BE0B6400A38469C71EB@shzsmsx502.ccr.corp.intel.com \
    --to=xiantao.zhang@intel.com \
    --cc=avi@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=efault@gmx.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mtosatti@redhat.com \
    --cc=peterz@infradead.org \
    --cc=xiaowei.yang@intel.com \
    --cc=xin.li@intel.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).