This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] Avoid endless loop for vcpu migration

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Avoid endless loop for vcpu migration
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2011 10:21:28 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 15 Mar 2011 02:22:42 -0700
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=juergen.gross@xxxxxxxxxxxxxx; q=dns/txt; s=s1536b; t=1300180891; x=1331716891; h=message-id:date:from:mime-version:to:cc:subject: references:in-reply-to; bh=ecUsZ5XttB5ebQWXUbgWWzHT0GnUgdmUAelMXNO6o8s=; b=dQR2LAkuSjv3G7FxpANNptS5Yi/TRHu7K1jLICqbgBZF32ShI7OBMdQ6 Xh73pTav7OB2LHY9KJQKOrGuG8Vmc27lviJy9GUajZcTuuTKaJHm4dSu4 HJVk3hGc+gBRbtlb0BCM3olGaAitfrOEg6kRnv+wULUOziAcOQLnYkazk ZwAYfpbLrlRGGZQVvQqxT0FkFF3PKFVjeL62oDs9cVzoGosy/hwOwRcHl H5K2+EO77uyWnovXiAn0PhTz8QJJS;
Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=lE0fjRGr6Edrb1TQa5VEiBUxzcwdC4Sbh06dYA5TokSNmUbAxmKGvtVC Il+pY6LcwTmbWrKMRcQATonBT/9MrRB6epxAhBY5X7kCrSLoWuXc3FjkM OsmESumm+ZVnAUxFj42F4UP+MbT/JaLbIkYvmk/xt4zr1/TKx7IZRZWGH W5QcrdnUWGkvtO1NojSLZHeV5PcZyJdH1i00fiegVHqXeyqKX3FgmCEtF yufjngl4dxe9AyF0jIU+znvGmy6CC;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D7F390D020000780003683C@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Fujitsu Technology Solutions
References: <9d164ce877a75cab847b.1300113594@nehalem1> <4D7E3C640200007800036564@xxxxxxxxxxxxxxxxxx> <4D7EFE43.7070900@xxxxxxxxxxxxxx> <4D7F29ED02000078000367F4@xxxxxxxxxxxxxxxxxx> <4D7F2750.4010607@xxxxxxxxxxxxxx> <4D7F390D020000780003683C@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101226 Iceowl/1.0b1 Icedove/3.0.11
On 03/15/11 10:01, Jan Beulich wrote:
On 15.03.11 at 09:46, Juergen Gross<juergen.gross@xxxxxxxxxxxxxx>  wrote:
On 03/15/11 08:57, Jan Beulich wrote:
On 15.03.11 at 06:50, Juergen Gross<juergen.gross@xxxxxxxxxxxxxx>   wrote:
On 03/14/11 16:03, Jan Beulich wrote:
On 14.03.11 at 15:39, Juergen Gross<juergen.gross@xxxxxxxxxxxxxx>    wrote:
On multi-thread multi-core systems an endless loop can occur in vcpu_migrate()
with credit scheduler. Avoid this loop by changing the interface of pick_cpu
to indicate a repeated call in this case.

But you're not changing in any way the loop that doesn't get
exited - did you perhaps read my original description as the
pick function itself looping (which - afaict - it doesn't)?

I'm changing the way the pick_cpu function is reacting on multiple calls in
a loop. If I've understood the idle_bias correctly, updating it in each
loop iteration did result in returning another cpu for each call.
By updating idle_bias only once, it should return the same cpu in subsequent
calls. This should exit the loop in vcpu_migrate.

You're only decreasing the likelihood of a live lock, as the return
value of pick_cpu not only depends on idle_bias.

Hmm, then another solution would be to let pick_cpu really return the
proposed cpu from the first iteration, if it doesn't contradict the
allowed settings. It could be sub-optimal, but I don't think this is
critical, as vcpu_migrate is called rarely.

Patch attached.

That candidate-is-valid check seems absolutely independent of the
particular scheduler used, and hence could be done in the (sole)
caller, thus not requiring any change to the scheduler interface.

Which at once would eliminate unnecessary calls into pick_cpu (i.e.
you'd call it a second time only if the previously selected CPU really
is no longer valid to be used for that vCPU).


The patch seems to become smaller :-)


Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@xxxxxxxxxxxxxx
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

Attachment: vcpu_migrate.patch
Description: Text Data

Xen-devel mailing list