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] Re: [Patch] support of cpu pools in xl

To: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [Patch] support of cpu pools in xl
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Date: Fri, 17 Sep 2010 13:41:32 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 17 Sep 2010 04:43:06 -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=1284723707; x=1316259707; h=message-id:date:from:mime-version:to:cc:subject: references:in-reply-to; z=Message-ID:=20<4C9353EC.1060402@xxxxxxxxxxxxxx>|Date:=20 Fri,=2017=20Sep=202010=2013:41:32=20+0200|From:=20Juergen =20Gross=20<juergen.gross@xxxxxxxxxxxxxx>|MIME-Version: =201.0|To:=20Ian=20Campbell=20<Ian.Campbell@xxxxxxxxxxxxx >|CC:=20"xen-devel@xxxxxxxxxxxxxxxxxxx"=20<xen-devel@list s.xensource.com>|Subject:=20Re:=20[Xen-devel]=20Re:=20[Pa tch]=20support=20of=20cpu=20pools=20in=20xl|References: =20<4C930642.3080802@xxxxxxxxxxxxxx>=20<1284716808.16095. 3185.camel@xxxxxxxxxxxxxxxxxxxxxx>|In-Reply-To:=20<128471 6808.16095.3185.camel@xxxxxxxxxxxxxxxxxxxxxx>; bh=HATkG3BHJ+y+15VG+4ALz9wKDANZJ9pHRyP84XEnjwU=; b=kUjXCvmcyn5ArYd7a+43/LQngUDSAOPXWKlKW2IFIkKKxA6582NyC2Ak q5LDsS7WnTXdE8+YlKwzgsziUlpPQT0jsWSi0ImDi+PtCalwYWcnnGrFU 34ww+WF3s9sB7/SGnq58w8G1cAwkSj0cSKxPUka0CK/+l1aCuo4EjzOEg WsNm3hziWBfP6m/HXM4WGiHJIZMTmepbUiRcs4VfGvHXop/dO7k518hF+ 8RESOgRWCtmK8Twy/+1pPm13uHCTD;
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=Di77n6B/3JIGjwDUyYyV5Pd1WFaxk9o6ru3K6sz3TzWOKb2dbIVkFSQT 6MENCTXrtqA1ZFQbrm8tjr0gfEA7en8rmlHPvo6aSLrzaXgTiHesw2Wsn WBd/hlxaAS/Oeswbdjjk4acZGVqMChKY7NUq23aOVktszD9nEvMSM7ewq fIC5fdvdG46nGUC+OBIH0wX5YKmDbOaAjEBLrUnqQSf4dsNNR95RFg8rt 15/bFFPw/hjQ1SJfjmbhGHRbsYKT+;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1284716808.16095.3185.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: <4C930642.3080802@xxxxxxxxxxxxxx> <1284716808.16095.3185.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Iceowl/1.0b1 Icedove/3.0.6
On 09/17/10 11:46, Ian Campbell wrote:

On Fri, 2010-09-17 at 07:10 +0100, Juergen Gross wrote:

attached patch adds support of cpu pools in xl/libxl.
Ian, I didn't split up this patch, because the updated libxl_cpumask
structure requires changes to xl in any case.

That's fine.

BTW: I realized that libxlu_cfg_l.c seems to be in the repository.
Isn't this file generated by make? I think it should be removed there.

In an ideal world, yes. I think this was a workaround for buggy versions
of flex observed in the field or something.

How nice ;-)


Signed-off-by: juergen.gross@xxxxxxxxxxxxxx

Support of cpu pools in xl:
   library functions
   xl pool-create
   xl pool-list
   xl pool-destroy
   xl pool-cpu-add
   xl pool-cpu-remove
   xl pool-migrate

diff -r d978675f3d53 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Sep 16 18:29:26 2010 +0100
+++ b/tools/libxl/libxl.c       Fri Sep 17 07:42:30 2010 +0200
@@ -609,9 +609,17 @@ libxl_poolinfo * libxl_list_pool(libxl_c
  libxl_poolinfo * libxl_list_pool(libxl_ctx *ctx, int *nb_pool)
  {
      libxl_poolinfo *ptr;
-    int i, ret;
-    xc_cpupoolinfo_t info[256];
-    int size = 256;
+    int i, m;
+    xc_cpupoolinfo_t *info;
+    int size;
+    uint32_t poolid;
+    libxl_physinfo physinfo;
+
+    if (libxl_get_physinfo(ctx,&physinfo) != 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting phys info");
+        return NULL;
+    }
+    size = physinfo.max_cpu_id + 32;

Where does the number 32 come from?

I just wanted to be able to support some (inactive) cpupools without any
cpu allocated. It's just a number which should normally be large enough.


      ptr = calloc(size, sizeof(libxl_poolinfo));

      if (!ptr) {
@@ -619,16 +627,23 @@ libxl_poolinfo * libxl_list_pool(libxl_c
          return NULL;
      }

-    ret = xc_cpupool_getinfo(ctx->xch, 0, 256, info);
-    if (ret<0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting cpupool info");
-        return NULL;
+    poolid = 0;
+    for (i = 0; i<  size; i++) {
+        info = xc_cpupool_getinfo(ctx->xch, poolid);
+        if (info == NULL)
+            break;
+        ptr[i].poolid = info->cpupool_id;
+        ptr[i].sched_id = info->sched_id;
+        ptr[i].n_dom = info->n_dom;
+        if (libxl_cpumap_alloc(&ptr[i].cpumap, physinfo.max_cpu_id + 1))
+            break;
+        for (m = 0; m<  ptr[i].cpumap.size / sizeof(*ptr[i].cpumap.map); m++)
+            ptr[i].cpumap.map[m] = info->cpumap[m];

I guess if "physinfo.max_cpu_id + 1" does not correspond to
info->cpumap_size then that is a serious error but if it does happen
then you may run over the end of either ptr[i].cpumap.map or
info->cpumap.

Changed (introducing '0' when info->cpumap_size is too small).


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

Attachment: cpupools-xl.patch
Description: Text Data

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