From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2) Date: Thu, 02 Dec 2010 17:33:40 +0200 Message-ID: <4CF7BC54.2080909@redhat.com> References: <1291220718.32004.1696.camel@laptop> <20101201172953.GF8073@linux.vnet.ibm.com> <1291225502.32004.1787.camel@laptop> <20101201180040.GH8073@linux.vnet.ibm.com> <1291230582.32004.1927.camel@laptop> <4CF76440.30500@redhat.com> <20101202114700.GA18445@linux.vnet.ibm.com> <4CF793FF.4010504@redhat.com> <20101202131312.GC18445@linux.vnet.ibm.com> <4CF7A3F8.1010802@redhat.com> <20101202152716.GA16411@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Peter Zijlstra , Anthony Liguori , qemu-devel@nongnu.org, kvm@vger.kernel.org, Chris Wright , Ingo Molnar , Mike Galbraith To: vatsa@linux.vnet.ibm.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21500 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932118Ab0LBPeQ (ORCPT ); Thu, 2 Dec 2010 10:34:16 -0500 In-Reply-To: <20101202152716.GA16411@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/02/2010 05:27 PM, Srivatsa Vaddagiri wrote: > > >Even that would require some precaution in directed yield to ensure that it > > >doesn't unduly inflate vruntime of target, hurting fairness for other guests on > > >same cpu as target (example guest code that can lead to this situation > > >below): > > > > > >vcpu0: vcpu1: > > > > > > spinlock(A); > > > > > >spinlock(A); > > > > > > while(1) > > > ; > > > > > > spin_unlock(A); > > > > directed yield should preserve the invariant that sum(vruntime) does > > not change. > > Hmm don't think I understand this invariant sum() part. Lets take a simple > example as below: > > > p0 -> A0 B0 A1 > > p1 -> B1 C0 C1 > > A/B/C are VMs and A0 etc are virtual cpus. p0/1 are physical cpus > > Let's say A0/A1 hit AB-BA spin-deadlock (which one can write in userspace > delibrately). When A0 spins and exits (due to PLE) what does its directed yield > do? Going by your statement, it can put target before current, leading to > perhaps this arrangement in runqueue: > > p0 -> A1 B0 A0 > > Now A1 spins and wants to do a directed yield back to A0, leading to : > > p0 -> A0 B0 A1 > > This can go back and forth, starving B0 (iow leading to some sort of DoS > attack). > > Where does the "invariant sum" part of directed yield kick in to avoid such > nastiness? A0 and A1's vruntime will keep growing, eventually B will become leftmost and become runnable (assuming leftmost == min vruntime, not sure what the terminology is). -- error compiling committee.c: too many arguments to function