From mboxrd@z Thu Jan 1 00:00:00 1970 From: Raghavendra K T Subject: Re: [PATCH RFC V6 0/11] Paravirtualized ticketlocks Date: Fri, 30 Mar 2012 15:37:42 +0530 Message-ID: <4F7585EE.7060203@linux.vnet.ibm.com> References: <20120321102041.473.61069.sendpatchset@codeblue.in.ibm.com> <4F707C5F.1000905@redhat.com> <4F716E31.3000803@linux.vnet.ibm.com> <4F73568D.7000703@linux.vnet.ibm.com> <4F743247.5080407@redhat.com> <4F74A405.2040609@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F74A405.2040609@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org To: Avi Kivity Cc: Alan Meadows , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , Peter Zijlstra , the arch/x86 maintainers , LKML , Marcelo Tosatti , KVM , Andi Kleen , Xen Devel , Konrad Rzeszutek Wilk , Virtualization , Jeremy Fitzhardinge , Stephan Diestelhorst , Srivatsa Vaddagiri , Stefano Stabellini , Attilio Rao List-Id: xen-devel@lists.xenproject.org On 03/29/2012 11:33 PM, Raghavendra K T wrote: > On 03/29/2012 03:28 PM, Avi Kivity wrote: >> On 03/28/2012 08:21 PM, Raghavendra K T wrote: > I really like below ideas. Thanks for that!. > >> - from the PLE handler, don't wake up a vcpu that is sleeping because it >> is waiting for a kick > > How about, adding another pass in the beginning of kvm_vcpu_on_spin() > to check if any vcpu is already kicked. This would almost result in > yield_to(kicked_vcpu). IMO this is also worth trying. > > will try above ideas soon. > I have patch something like below in mind to try: diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index d3b98b1..5127668 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1608,15 +1608,18 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) * else and called schedule in __vcpu_run. Hopefully that * VCPU is holding the lock that we need and will release it. * We approximate round-robin by starting at the last boosted VCPU. + * Priority is given to vcpu that are unhalted. */ - for (pass = 0; pass < 2 && !yielded; pass++) { + for (pass = 0; pass < 3 && !yielded; pass++) { kvm_for_each_vcpu(i, vcpu, kvm) { struct task_struct *task = NULL; struct pid *pid; - if (!pass && i < last_boosted_vcpu) { + if (!pass && !vcpu->pv_unhalted) + continue; + else if (pass == 1 && i < last_boosted_vcpu) { i = last_boosted_vcpu; continue; - } else if (pass && i > last_boosted_vcpu) + } else if (pass == 2 && i > last_boosted_vcpu) break; if (vcpu == me) continue;