All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: xl: fix broken cpupool-numa-split
@ 2011-01-27 21:36 Andre Przywara
  2011-01-28  6:26 ` Juergen Gross
  0 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2011-01-27 21:36 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Juergen Gross, xen-devel

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]

Hi,

the implementation of xl cpupool-numa-split is broken. It basically 
deals with only one poolid, but there are two to consider: the one from 
the original root CPUpool, the other from the newly created one.
On my machine the current output looks like:

root@dosorca:/data/images# xl cpupool-numa-split
libxl: error: libxl.c:2803:libxl_create_cpupool Could not create cpupool
error on creating cpupool
root@dosorca:/data/images# xl cpupool-list
Name               CPUs   Sched     Active   Domain count
Pool-node0          42    credit       y          1
Pool-node1           0    credit       y          0
root@dosorca:/data/images# xl cpupool-list -c
Name               CPU list
Pool-node0 
0,1,2,3,4,5,6,7,8,9,10,11,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
Pool-node1

The patch fixes this by using two poolid variables, now it looks like:

root@dosorca:/data/images# xl cpupool-numa-split
root@dosorca:/data/images# xl cpupool-list
Name               CPUs   Sched     Active   Domain count
Pool-node0           6    credit       y          1
Pool-node1           6    credit       y          0
Pool-node2           6    credit       y          0
Pool-node3           6    credit       y          0
Pool-node4           6    credit       y          0
Pool-node5           6    credit       y          0
Pool-node6           6    credit       y          0
Pool-node7           6    credit       y          0
root@dosorca:/data/images# xl cpupool-list -c
Name               CPU list
Pool-node0         0,1,2,3,4,5
Pool-node1         6,7,8,9,10,11
Pool-node2         12,13,14,15,16,17
Pool-node3         18,19,20,21,22,23
Pool-node4         24,25,26,27,28,29
Pool-node5         30,31,32,33,34,35
Pool-node6         36,37,38,39,40,41
Pool-node7         42,43,44,45,46,47

Please apply to Xen 4.1.0-rc

Regards,
Andre.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany

[-- Attachment #2: xl_fix_cpupool_numasplit.patch --]
[-- Type: text/plain, Size: 2475 bytes --]

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5f2cab2..8ecc10b 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5716,7 +5716,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
     int p;
     int c;
     int n;
-    uint32_t poolid;
+    uint32_t poolid_root, poolid_new;
     int schedid;
     int n_pools;
     int node;
@@ -5743,7 +5743,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
         fprintf(stderr, "error getting cpupool info\n");
         return -ERROR_NOMEM;
     }
-    poolid = poolinfo[0].poolid;
+    poolid_root = poolinfo[0].poolid;
     schedid = poolinfo[0].sched_id;
     for (p = 0; p < n_pools; p++) {
         libxl_cpupoolinfo_destroy(poolinfo + p);
@@ -5768,13 +5768,13 @@ int main_cpupoolnumasplit(int argc, char **argv)
        a cpupool without cpus in between */
 
     node = topology.nodemap.array[0];
-    if (libxl_cpupool_cpuadd_node(&ctx, 0, node, &n)) {
+    if (libxl_cpupool_cpuadd_node(&ctx, poolid_root, node, &n)) {
         fprintf(stderr, "error on adding cpu to Pool 0\n");
         return -ERROR_FAIL;
     }
 
     snprintf(name, 15, "Pool-node%d", node);
-    ret = -libxl_cpupool_rename(&ctx, name, 0);
+    ret = -libxl_cpupool_rename(&ctx, name, poolid_root);
     if (ret) {
         fprintf(stderr, "error on renaming Pool 0\n");
         goto out;
@@ -5792,7 +5792,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
         }
 
         node = topology.nodemap.array[c];
-        ret = -libxl_cpupool_cpuremove_node(&ctx, 0, node, &n);
+        ret = -libxl_cpupool_cpuremove_node(&ctx, poolid_root, node, &n);
         if (ret) {
             fprintf(stderr, "error on removing cpu from Pool 0\n");
             goto out;
@@ -5800,13 +5800,15 @@ int main_cpupoolnumasplit(int argc, char **argv)
 
         snprintf(name, 15, "Pool-node%d", node);
         libxl_uuid_generate(&uuid);
-        ret = -libxl_create_cpupool(&ctx, name, schedid, cpumap, &uuid, &poolid);
+        poolid_new = 0;
+        ret = -libxl_create_cpupool(&ctx, name, schedid, cpumap, &uuid,
+            &poolid_new);
         if (ret) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out;
         }
 
-        ret = -libxl_cpupool_cpuadd_node(&ctx, 0, node, &n);
+        ret = -libxl_cpupool_cpuadd_node(&ctx, poolid_new, node, &n);
         if (ret) {
             fprintf(stderr, "error on adding cpus to cpupool\n");
             goto out;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH]: xl: fix broken cpupool-numa-split
  2011-01-27 21:36 [PATCH]: xl: fix broken cpupool-numa-split Andre Przywara
@ 2011-01-28  6:26 ` Juergen Gross
  2011-01-28 10:53   ` George Dunlap
  2011-01-29  0:35   ` [PATCH] xl: fix broken cpupool-numa-split (part 2) Andre Przywara
  0 siblings, 2 replies; 8+ messages in thread
From: Juergen Gross @ 2011-01-28  6:26 UTC (permalink / raw)
  To: Andre Przywara; +Cc: xen-devel, Ian Jackson

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On 01/27/11 22:36, Andre Przywara wrote:
> Hi,
>
> the implementation of xl cpupool-numa-split is broken. It basically
> deals with only one poolid, but there are two to consider: the one from
> the original root CPUpool, the other from the newly created one.

Uhh, silly copy and paste error! I think it happened when I introduced
libxl_cpupool_cpuadd_node()...
The correction is much easier. The root poolid is always 0. See attached
patch.


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@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

[-- Attachment #2: cpupool-numa-split-corr.patch --]
[-- Type: text/x-patch, Size: 626 bytes --]

Correct copy&paste error: add node to the new pool instead of pool 0

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 9dca60d88c63 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Jan 25 14:06:52 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Fri Jan 28 07:21:53 2011 +0100
@@ -5806,7 +5806,7 @@ int main_cpupoolnumasplit(int argc, char
             goto out;
         }
 
-        ret = -libxl_cpupool_cpuadd_node(&ctx, 0, node, &n);
+        ret = -libxl_cpupool_cpuadd_node(&ctx, poolid, node, &n);
         if (ret) {
             fprintf(stderr, "error on adding cpus to cpupool\n");
             goto out;


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: xl: fix broken cpupool-numa-split
  2011-01-28  6:26 ` Juergen Gross
@ 2011-01-28 10:53   ` George Dunlap
  2011-01-28 11:01     ` Juergen Gross
  2011-01-28 17:41     ` Ian Jackson
  2011-01-29  0:35   ` [PATCH] xl: fix broken cpupool-numa-split (part 2) Andre Przywara
  1 sibling, 2 replies; 8+ messages in thread
From: George Dunlap @ 2011-01-28 10:53 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Andre Przywara, xen-devel, Ian Jackson

On Fri, Jan 28, 2011 at 6:26 AM, Juergen Gross
<juergen.gross@ts.fujitsu.com> wrote:
> On 01/27/11 22:36, Andre Przywara wrote:
>>
>> Hi,
>>
>> the implementation of xl cpupool-numa-split is broken. It basically
>> deals with only one poolid, but there are two to consider: the one from
>> the original root CPUpool, the other from the newly created one.
>
> Uhh, silly copy and paste error! I think it happened when I introduced
> libxl_cpupool_cpuadd_node()...
> The correction is much easier. The root poolid is always 0. See attached
> patch.

Re patch itself: Acked-by: George Dunlap <george.dunlap@citrix.com>

Re the cpupool interface:

Hang on; if the root poolid is always 0, why does xc_cpupool_create()
interpret a poolid of 0 as "XEN_SYSCTL_CPUPOOL_PAR_ANY"?  Doesn't that
mean that if you're trying to create a new cpupool from cpus in the
root pool, that you might get cpus from other pools?

If not, what's the point of the "CPUPOOL_PAR_ANY" parsing?

 -George

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: xl: fix broken cpupool-numa-split
  2011-01-28 10:53   ` George Dunlap
@ 2011-01-28 11:01     ` Juergen Gross
  2011-01-28 17:41     ` Ian Jackson
  1 sibling, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2011-01-28 11:01 UTC (permalink / raw)
  To: George Dunlap; +Cc: Andre Przywara, xen-devel, Ian Jackson

On 01/28/11 11:53, George Dunlap wrote:
> On Fri, Jan 28, 2011 at 6:26 AM, Juergen Gross
> <juergen.gross@ts.fujitsu.com>  wrote:
>> On 01/27/11 22:36, Andre Przywara wrote:
>>>
>>> Hi,
>>>
>>> the implementation of xl cpupool-numa-split is broken. It basically
>>> deals with only one poolid, but there are two to consider: the one from
>>> the original root CPUpool, the other from the newly created one.
>>
>> Uhh, silly copy and paste error! I think it happened when I introduced
>> libxl_cpupool_cpuadd_node()...
>> The correction is much easier. The root poolid is always 0. See attached
>> patch.
>
> Re patch itself: Acked-by: George Dunlap<george.dunlap@citrix.com>
>
> Re the cpupool interface:
>
> Hang on; if the root poolid is always 0, why does xc_cpupool_create()
> interpret a poolid of 0 as "XEN_SYSCTL_CPUPOOL_PAR_ANY"?  Doesn't that
> mean that if you're trying to create a new cpupool from cpus in the
> root pool, that you might get cpus from other pools?

No. It just creates a cpupool. As cpupool 0 is always created by the
hypervisor, it can't be created via libxc. So specifying 0 as poolid
selects the next free id.

The cpus are allocated later.

>
> If not, what's the point of the "CPUPOOL_PAR_ANY" parsing?

Perhaps you just don't care which poolid you get?


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@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH]: xl: fix broken cpupool-numa-split
  2011-01-28 10:53   ` George Dunlap
  2011-01-28 11:01     ` Juergen Gross
@ 2011-01-28 17:41     ` Ian Jackson
  1 sibling, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2011-01-28 17:41 UTC (permalink / raw)
  To: George Dunlap; +Cc: Andre Przywara, Juergen Gross, xen-devel

George Dunlap writes ("Re: [Xen-devel] [PATCH]: xl: fix broken cpupool-numa-split"):
> On Fri, Jan 28, 2011 at 6:26 AM, Juergen Gross
> > Uhh, silly copy and paste error! I think it happened when I introduced
> > libxl_cpupool_cpuadd_node()...
> > The correction is much easier. The root poolid is always 0. See attached
> > patch.
> 
> Re patch itself: Acked-by: George Dunlap <george.dunlap@citrix.com>

Thanks, all.  Applied.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] xl: fix broken cpupool-numa-split (part 2)
  2011-01-28  6:26 ` Juergen Gross
  2011-01-28 10:53   ` George Dunlap
@ 2011-01-29  0:35   ` Andre Przywara
  2011-01-31  6:56     ` Juergen Gross
  1 sibling, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2011-01-29  0:35 UTC (permalink / raw)
  To: Juergen Gross; +Cc: George Dunlap, xen-devel, Ian Jackson

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

On 01/28/2011 07:26 AM, Juergen Gross wrote:
> On 01/27/11 22:36, Andre Przywara wrote:
>> Hi,
>>
>> the implementation of xl cpupool-numa-split is broken. It basically
>> deals with only one poolid, but there are two to consider: the one from
>> the original root CPUpool, the other from the newly created one.
>
> Uhh, silly copy and paste error! I think it happened when I introduced
> libxl_cpupool_cpuadd_node()...
> The correction is much easier. The root poolid is always 0.
Why do you save this value then?
     poolid = poolinfo[0].poolid;
Reading this made me think it can be an arbitrary value.

> See attached patch.
Easier, but that only solves one part of the problem (not populating the 
newly created pool). The second bug still persists, because poolid is 
not zeroed out again after the first creation. So the second iteration 
will try to reuse the just assigned value and abort with an error.

Ian, please apply the attached patch on top of Jürgens one.

----------
Before the creation and population of a new CPU pool we have to clear 
the poolid variable, which still contains the value from the previous 
iteration.
This fixes the execution of xl cpupool-numa-split on machines with more 
than two nodes.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany


[-- Attachment #2: xl_fix_numasplit_missing_poolid_reset.patch --]
[-- Type: text/plain, Size: 502 bytes --]

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5af3c21..5c754fc 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5800,6 +5800,7 @@ int main_cpupoolnumasplit(int argc, char **argv)
 
         snprintf(name, 15, "Pool-node%d", node);
         libxl_uuid_generate(&uuid);
+        poolid = 0;
         ret = -libxl_create_cpupool(&ctx, name, schedid, cpumap, &uuid, &poolid);
         if (ret) {
             fprintf(stderr, "error on creating cpupool\n");

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] xl: fix broken cpupool-numa-split (part 2)
  2011-01-29  0:35   ` [PATCH] xl: fix broken cpupool-numa-split (part 2) Andre Przywara
@ 2011-01-31  6:56     ` Juergen Gross
  2011-02-01 19:07       ` Ian Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Juergen Gross @ 2011-01-31  6:56 UTC (permalink / raw)
  To: Andre Przywara; +Cc: George Dunlap, xen-devel, Ian Jackson

On 01/29/11 01:35, Andre Przywara wrote:
> On 01/28/2011 07:26 AM, Juergen Gross wrote:
>> On 01/27/11 22:36, Andre Przywara wrote:
>>> Hi,
>>>
>>> the implementation of xl cpupool-numa-split is broken. It basically
>>> deals with only one poolid, but there are two to consider: the one from
>>> the original root CPUpool, the other from the newly created one.
>>
>> Uhh, silly copy and paste error! I think it happened when I introduced
>> libxl_cpupool_cpuadd_node()...
>> The correction is much easier. The root poolid is always 0.
> Why do you save this value then?
> poolid = poolinfo[0].poolid;
> Reading this made me think it can be an arbitrary value.

Sorry, must be a relict...

>
>> See attached patch.
> Easier, but that only solves one part of the problem (not populating the
> newly created pool). The second bug still persists, because poolid is
> not zeroed out again after the first creation. So the second iteration
> will try to reuse the just assigned value and abort with an error.
>
> Ian, please apply the attached patch on top of Jürgens one.
>
> ----------
> Before the creation and population of a new CPU pool we have to clear
> the poolid variable, which still contains the value from the previous
> iteration.
> This fixes the execution of xl cpupool-numa-split on machines with more
> than two nodes.
>
> Signed-off-by: Andre Przywara <andre.przywara@amd.com>

Acked-by: juergen.gross@ts.fujitsu.com

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] xl: fix broken cpupool-numa-split (part 2)
  2011-01-31  6:56     ` Juergen Gross
@ 2011-02-01 19:07       ` Ian Jackson
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2011-02-01 19:07 UTC (permalink / raw)
  To: Juergen Gross; +Cc: George Dunlap, Andre Przywara, xen-devel

Juergen Gross writes ("Re: [Xen-devel] [PATCH] xl: fix broken cpupool-numa-split (part 2)"):
> On 01/29/11 01:35, Andre Przywara wrote:
> > Before the creation and population of a new CPU pool we have to clear
> > the poolid variable, which still contains the value from the previous
> > iteration.
> > This fixes the execution of xl cpupool-numa-split on machines with more
> > than two nodes.

Applied, thanks.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-01 19:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 21:36 [PATCH]: xl: fix broken cpupool-numa-split Andre Przywara
2011-01-28  6:26 ` Juergen Gross
2011-01-28 10:53   ` George Dunlap
2011-01-28 11:01     ` Juergen Gross
2011-01-28 17:41     ` Ian Jackson
2011-01-29  0:35   ` [PATCH] xl: fix broken cpupool-numa-split (part 2) Andre Przywara
2011-01-31  6:56     ` Juergen Gross
2011-02-01 19:07       ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.