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: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 4 of 4] Support new xl command cpupool-numa-split
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 8 Dec 2010 11:16:18 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Dec 2010 03:18:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <f31333fe3b3553c90419.1290755427@xxxxxxxxxxxxxxxxxxxxxxx>
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: Citrix Systems, Inc.
References: <f31333fe3b3553c90419.1290755427@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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?

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.

> +    /* 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...)

> +        }
> +    }
> +    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?

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

Ian.


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