WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 4 of 4] Support new xl command cpupool-numa-split

To: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 4 of 4] Support new xl command cpupool-numa-split
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Date: Wed, 08 Dec 2010 13:20:34 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Dec 2010 04:21:30 -0800
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=juergen.gross@xxxxxxxxxxxxxx; q=dns/txt; s=s1536b; t=1291810837; x=1323346837; h=message-id:date:from:mime-version:to:cc:subject: references:in-reply-to:content-transfer-encoding; z=Message-ID:=20<4CFF7812.4050506@xxxxxxxxxxxxxx>|Date:=20 Wed,=2008=20Dec=202010=2013:20:34=20+0100|From:=20Juergen =20Gross=20<juergen.gross@xxxxxxxxxxxxxx>|MIME-Version: =201.0|To:=20Ian=20Campbell=20<Ian.Campbell@xxxxxxxxxx> |CC:=20"xen-devel@xxxxxxxxxxxxxxxxxxx"=20<xen-devel@lists .xensource.com>|Subject:=20Re:=20[Xen-devel]=20[PATCH=204 =20of=204]=20Support=20new=20xl=20command=09cpupool-numa- split|References:=20<f31333fe3b3553c90419.1290755427@mera no1.osd.mch.fsc.net>=20<1291806978.13966.4529.camel@zakaz .uk.xensource.com>|In-Reply-To:=20<1291806978.13966.4529. camel@xxxxxxxxxxxxxxxxxxxxxx>|Content-Transfer-Encoding: =207bit; bh=oNrFI1WqKrDyE/AoMcqcikpeAlWzLc3PGmO4VVbge3w=; b=Lez/I5DkOjfsDJ2F6yJE1qAlYUV1GwS9vMD2yCvMVTZ4Ta+RH/NE1AuU ng6xmEjMNibIhKGhduWZIcQWomozMzt8UUA/uXtWEwHMX22Z0yC8xvQAe wGIldD4EkFEbVfmTye9ObjUQbh59U++ITfsbAOKIZeZMDFFMYokfLJydo ipnBrd0H7ByqrbuUpXw8h3moF/7pNNgmOxFvJ99AHjtdd3wQ2whEeER7j /Yw7vPJ8UGHQRcxLBqIUfK6pyUP4y;
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:Content-Transfer-Encoding; b=TPJOuXC7Woq6hazmJFJ8/w938OP8nRy2EXMsxVXZoMPQ8QEGpnNCyRml 8fcDIbMZJ9nz5UkUib16K9fEAG+pkGPPXjYGENxkZo7jwFsWXn5LMOKIC sKLDkk9QkwNXEscVetDwJZV0cV6o3jNzoGImrgszcJmHlg6tyQPH/x0/d yodR7Vur6yYGzgboJTrA2hwlp2Ju3YmqR07I3RixFMZxKwS9NOZkYEmkw E4AzdFQDxzraviz4nhcmJcSZwn5GT;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1291806978.13966.4529.camel@xxxxxxxxxxxxxxxxxxxxxx>
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: <f31333fe3b3553c90419.1290755427@xxxxxxxxxxxxxxxxxxxxxxx> <1291806978.13966.4529.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101030 Iceowl/1.0b1 Icedove/3.0.10
On 12/08/10 12:16, Ian Campbell wrote:
On Fri, 2010-11-26 at 07:10 +0000, Juergen Gross wrote:
+
+    if (libxl_cpumap_alloc(&ctx,&cpumap)) {
+        fprintf(stderr, "Failed to allocate cpumap\n");
+        return -ERROR_FAIL;
+    }
+
+    poolinfo = libxl_list_cpupool(&ctx,&n_pools);
+    if (!poolinfo) {
+        fprintf(stderr, "error getting cpupool info\n");
+        return -ERROR_NOMEM;
+    }
+    poolid = poolinfo[0].poolid;
+    schedid = poolinfo[0].sched_id;
+    libxl_for_each_cpu(c, poolinfo[0].cpumap)
+        if (libxl_cpumap_test(&poolinfo[0].cpumap, c))
+            libxl_cpumap_set(&cpumap, c);

Can the libxl_cpumap_alloc and this loop be deferred until after the
check and bail for n_pools>  1?

Sure.


There seems to be no way to find out the number of pools without also
getting all the info about them, which is a shame.

Taking a quick look I couldn't spot any way how to find out the number
of domains without also getting all the info about them, too...


+    /* Reset Pool-0 to 1st node */
+    node = topology->nodemap.array[0];
+    libxl_for_each_cpu(c, cpumap) {
+        if (!libxl_cpumap_test(&cpumap, c)&&  (c<  topology->nodemap.entries)&&
+            (topology->nodemap.array[c] == node)) {
+            ret = -libxl_cpupool_cpuadd(&ctx, poolid, c);
+            if (ret) {
+                fprintf(stderr, "error on adding cpu to Pool-0\n");
+                goto out;
+            }
+            libxl_cpumap_reset(&freemap, c);

(nt really related to this series but I wish this was called
libxl_cpumap_clear, I had to go check it wasn't resetting the whole map
or something...)

Hmm, do you really think so?
It would make me to check whether it is clearing the whole map :-)
I think the second parameter is a strong hint :-)


+        }
+    }
+    libxl_for_each_cpu(c, cpumap) {
+        if (libxl_cpumap_test(&cpumap, c)&&  (c<  topology->nodemap.entries)&&
+            (topology->nodemap.array[c] != node)) {
+            ret = -libxl_cpupool_cpuremove(&ctx, poolid, c);
+            if (ret) {
+                fprintf(stderr, "error on removing cpu from Pool-0\n");
+                goto out;
+            }
+            libxl_cpumap_set(&freemap, c);
+        }
+    }

Can this loop be merged with the preceding loop, with the body being the
else case of the if?

No. I have to add new cpus first to avoid a cpupool without cpus in between.


+    for (;;) {
+        node = -1;
+        libxl_for_each_cpu(c, freemap) {
+            if (libxl_cpumap_test(&freemap, c)&&  (node == -1)) {
+                node = topology->nodemap.array[c];
+            }
+            libxl_cpumap_reset(&cpumap, c);
+            if ((node>= 0)&&  libxl_cpumap_test(&freemap, c)&&
+                (c<  topology->nodemap.entries)&&  (topology->nodemap.array[c] 
== node)) {
+                libxl_cpumap_reset(&freemap, c);
+                libxl_cpumap_set(&cpumap, c);
+            }
+        }
+        if (node == -1)
+            break;
+
+        snprintf(name, 15, "Pool-node%d", node);

Do we want to rename Pool-0 at some point too or do we rely on that name
elsewhere?

Good question. There is a hard coded "Pool-0" reference in libxl, but this
could easily be changed.
I'm not sure about implications in xm/xend. I'll check this.


Juergen

--
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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel