Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Eric Blake
On 07/16/2014 09:38 PM, Martin Kletzander wrote:

>>  makes no difference here.  As the  has only one
>>  child, there is nothing to be interleaved.  I meant for it to
>> go one level higher, outside the , where it can also
>> interleave with .

>>
>> As penance, I'm proposing this followup:
>>

> Seeing this diff I see what I did wrong.  Completely wrong to be
> accurate.  It wasn't my day either, hopefully today will be better.
> 
> ACK from me.

Pushed, including the testsuite enhancement.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Martin Kletzander

On Wed, Jul 16, 2014 at 02:53:09PM -0600, Eric Blake wrote:

On 07/16/2014 02:43 PM, Martin Kletzander wrote:


Good point, is this OK to push as trivial (git diff -w):


Count this as my ACK :)



I pushed it then, thank you.


Not my day.  I was so focused on the 'diff -w' aspect that I completely
overlooked another aspect. The patch is wrong:





diff --git i/docs/schemas/domaincommon.rng
w/docs/schemas/domaincommon.rng
index a0ea300..fb5bdb3 100644
--- i/docs/schemas/domaincommon.rng
+++ w/docs/schemas/domaincommon.rng
@@ -790,6 +790,7 @@

  
  
+


 makes no difference here.  As the  has only one
 child, there is nothing to be interleaved.  I meant for it to
go one level higher, outside the , where it can also
interleave with .


  


I'm assuming the odd spacing here is due to pasting into the email body,
not how it actually looked in the diff.  That, and diff -w already plays
games with spacing.



diff -w looked OK when I pasted it in the mail body, but somewhere on
the way it got smudged.


As penance, I'm proposing this followup:

diff --git i/docs/schemas/domaincommon.rng w/docs/schemas/domaincommon.rng
index fb5bdb3..2caeef9 100644
--- i/docs/schemas/domaincommon.rng
+++ w/docs/schemas/domaincommon.rng
@@ -759,6 +759,7 @@
  
  

+  

  

@@ -790,7 +791,6 @@
  


-
  

  
@@ -806,8 +806,8 @@
  

  
-

+  

  



Seeing this diff I see what I did wrong.  Completely wrong to be
accurate.  It wasn't my day either, hopefully today will be better.

ACK from me.

Martin


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Eric Blake
On 07/16/2014 02:53 PM, Eric Blake wrote:

   
 +
> 
>  makes no difference here.  As the  has only one
>  child, there is nothing to be interleaved.  I meant for it to
> go one level higher, outside the , where it can also
> interleave with .
> 
   
>>>
>>> I'm assuming the odd spacing here is due to pasting into the email body,
>>> not how it actually looked in the diff.  That, and diff -w already plays
>>> games with spacing.
>>>
>>
>> diff -w looked OK when I pasted it in the mail body, but somewhere on
>> the way it got smudged.
> 
> As penance, I'm proposing this followup:

and also squashing in this change to the testsuite, to expose the
difference:

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
index 49b328c..440413b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
@@ -5,8 +5,8 @@
   24682468
   32
   
-
 
+
 
   
   

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Eric Blake
On 07/16/2014 02:43 PM, Martin Kletzander wrote:

>>> Good point, is this OK to push as trivial (git diff -w):
>>
>> Count this as my ACK :)
>>
> 
> I pushed it then, thank you.

Not my day.  I was so focused on the 'diff -w' aspect that I completely
overlooked another aspect. The patch is wrong:

> 
>>>
>>> diff --git i/docs/schemas/domaincommon.rng
>>> w/docs/schemas/domaincommon.rng
>>> index a0ea300..fb5bdb3 100644
>>> --- i/docs/schemas/domaincommon.rng
>>> +++ w/docs/schemas/domaincommon.rng
>>> @@ -790,6 +790,7 @@
>>> 
>>>   
>>>   
>>> +

 makes no difference here.  As the  has only one
 child, there is nothing to be interleaved.  I meant for it to
go one level higher, outside the , where it can also
interleave with .

>>>   
>>
>> I'm assuming the odd spacing here is due to pasting into the email body,
>> not how it actually looked in the diff.  That, and diff -w already plays
>> games with spacing.
>>
> 
> diff -w looked OK when I pasted it in the mail body, but somewhere on
> the way it got smudged.

As penance, I'm proposing this followup:

diff --git i/docs/schemas/domaincommon.rng w/docs/schemas/domaincommon.rng
index fb5bdb3..2caeef9 100644
--- i/docs/schemas/domaincommon.rng
+++ w/docs/schemas/domaincommon.rng
@@ -759,6 +759,7 @@
   
   
 
+  
 
   
 
@@ -790,7 +791,6 @@
   
 
 
-
   
 
   
@@ -806,8 +806,8 @@
   
 
   
-
 
+  
 
   



-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Martin Kletzander

On Wed, Jul 16, 2014 at 12:43:07PM -0600, Eric Blake wrote:

On 07/16/2014 12:33 PM, Martin Kletzander wrote:

On Wed, Jul 16, 2014 at 12:21:24PM -0600, Eric Blake wrote:

On 07/16/2014 08:42 AM, Martin Kletzander wrote:

Signed-off-by: Martin Kletzander 
---

[...]




Missing an  here ( and  should be swappable
with one another).



Oh!  My bad.  So sorry :-(

Good point, is this OK to push as trivial (git diff -w):


Count this as my ACK :)



I pushed it then, thank you.



diff --git i/docs/schemas/domaincommon.rng w/docs/schemas/domaincommon.rng
index a0ea300..fb5bdb3 100644
--- i/docs/schemas/domaincommon.rng
+++ w/docs/schemas/domaincommon.rng
@@ -790,6 +790,7 @@

  
  
+
  


I'm assuming the odd spacing here is due to pasting into the email body,
not how it actually looked in the diff.  That, and diff -w already plays
games with spacing.



diff -w looked OK when I pasted it in the mail body, but somewhere on
the way it got smudged.

Martin


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Eric Blake
On 07/16/2014 12:33 PM, Martin Kletzander wrote:
> On Wed, Jul 16, 2014 at 12:21:24PM -0600, Eric Blake wrote:
>> On 07/16/2014 08:42 AM, Martin Kletzander wrote:
>>> Signed-off-by: Martin Kletzander 
>>> ---
> [...]

>>
>> Missing an  here ( and  should be swappable
>> with one another).
>>
> 
> Oh!  My bad.  So sorry :-(
> 
> Good point, is this OK to push as trivial (git diff -w):

Count this as my ACK :)

> 
> diff --git i/docs/schemas/domaincommon.rng w/docs/schemas/domaincommon.rng
> index a0ea300..fb5bdb3 100644
> --- i/docs/schemas/domaincommon.rng
> +++ w/docs/schemas/domaincommon.rng
> @@ -790,6 +790,7 @@
> 
>   
>   
> +
>   

I'm assuming the odd spacing here is due to pasting into the email body,
not how it actually looked in the diff.  That, and diff -w already plays
games with spacing.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Martin Kletzander

On Wed, Jul 16, 2014 at 12:21:24PM -0600, Eric Blake wrote:

On 07/16/2014 08:42 AM, Martin Kletzander wrote:

Signed-off-by: Martin Kletzander 
---

[...]

+++ b/docs/schemas/domaincommon.rng
@@ -789,6 +789,23 @@
   
 
   
+  
+
+  
+
+  
+  
+
+  strict
+  preferred
+  interleave
+
+  
+  
+
+  
+
+  
 


Missing an  here ( and  should be swappable
with one another).



Oh!  My bad.  So sorry :-(

Good point, is this OK to push as trivial (git diff -w):

diff --git i/docs/schemas/domaincommon.rng w/docs/schemas/domaincommon.rng
index a0ea300..fb5bdb3 100644
--- i/docs/schemas/domaincommon.rng
+++ w/docs/schemas/domaincommon.rng
@@ -790,6 +790,7 @@

  
  
+
  

  
@@ -805,6 +806,7 @@
  

  
+
  

  
--

Martin


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Eric Blake
On 07/16/2014 08:42 AM, Martin Kletzander wrote:
> Signed-off-by: Martin Kletzander 
> ---
>  docs/formatdomain.html.in  |  15 ++
>  docs/schemas/domaincommon.rng  |  17 ++
>  src/conf/numatune_conf.c   | 187 
> +++--
>  .../qemuxml2argv-numatune-memnode-no-memory.xml|  30 
>  .../qemuxml2argv-numatune-memnode-nocpu.xml|  25 +++
>  .../qemuxml2argv-numatune-memnode.xml  |  33 
>  .../qemuxml2argv-numatune-memnodes-problematic.xml |  31 
>  tests/qemuxml2argvtest.c   |   2 +
>  .../qemuxml2xmlout-numatune-memnode.xml|  33 
>  tests/qemuxml2xmltest.c|   2 +
>  10 files changed, 362 insertions(+), 13 deletions(-)
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-nocpu.xml
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml
>  create mode 100644 
> tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 9f1082b..1301639 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -709,6 +709,8 @@
>...
>
>  
> +
> +

Ah, the ability to skip cellid's (for the cells that inherit the default
policies from  makes it essential to have ids for correlation in
the earlier patch in this series.

>
>...
>  
> @@ -745,6 +747,19 @@
> 
>  Since 0.9.3
>
> +  memnode
> +  
> +Optional memnode elements can specify memory allocation
> +policies per each guest NUMA node.  For those nodes having no
> +corresponding memnode element, the default from
> +element memory will be used.  Attribute 
> cellid
> +addresses guest NUMA node for which the settings are applied.
> +Attributes mode and nodeset have the same
> +meaning and syntax as in memory element.
> +
> +This setting is not compatible with automatic placement.
> +QEMU Since 1.2.7

Again, schema documentation looks okay to me.


> +++ b/docs/schemas/domaincommon.rng
> @@ -789,6 +789,23 @@
>
>  
>
> +  
> +
> +  
> +
> +  
> +  
> +
> +  strict
> +  preferred
> +  interleave
> +
> +  
> +  
> +
> +  
> +
> +  
>  

Missing an  here ( and  should be swappable
with one another).

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v3 08/16] conf, schema: add support for memnode elements

2014-07-16 Thread Martin Kletzander
Signed-off-by: Martin Kletzander 
---
 docs/formatdomain.html.in  |  15 ++
 docs/schemas/domaincommon.rng  |  17 ++
 src/conf/numatune_conf.c   | 187 +++--
 .../qemuxml2argv-numatune-memnode-no-memory.xml|  30 
 .../qemuxml2argv-numatune-memnode-nocpu.xml|  25 +++
 .../qemuxml2argv-numatune-memnode.xml  |  33 
 .../qemuxml2argv-numatune-memnodes-problematic.xml |  31 
 tests/qemuxml2argvtest.c   |   2 +
 .../qemuxml2xmlout-numatune-memnode.xml|  33 
 tests/qemuxml2xmltest.c|   2 +
 10 files changed, 362 insertions(+), 13 deletions(-)
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-nocpu.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9f1082b..1301639 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -709,6 +709,8 @@
   ...
   
 
+
+
   
   ...
 
@@ -745,6 +747,19 @@

 Since 0.9.3
   
+  memnode
+  
+Optional memnode elements can specify memory allocation
+policies per each guest NUMA node.  For those nodes having no
+corresponding memnode element, the default from
+element memory will be used.  Attribute 
cellid
+addresses guest NUMA node for which the settings are applied.
+Attributes mode and nodeset have the same
+meaning and syntax as in memory element.
+
+This setting is not compatible with automatic placement.
+QEMU Since 1.2.7
+  
 


diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 155a33e..0b31261 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -789,6 +789,23 @@
   
 
   
+  
+
+  
+
+  
+  
+
+  strict
+  preferred
+  interleave
+
+  
+  
+
+  
+
+  
 
   

diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
index 6ce1e2d..a39c028 100644
--- a/src/conf/numatune_conf.c
+++ b/src/conf/numatune_conf.c
@@ -42,17 +42,140 @@ VIR_ENUM_IMPL(virDomainNumatunePlacement,
   "static",
   "auto");

+typedef struct _virDomainNumatuneNode virDomainNumatuneNode;
+typedef virDomainNumatuneNode *virDomainNumatuneNodePtr;
+
 struct _virDomainNumatune {
 struct {
+bool specified;
 virBitmapPtr nodeset;
 virDomainNumatuneMemMode mode;
 virDomainNumatunePlacement placement;
 } memory;   /* pinning for all the memory */

+struct _virDomainNumatuneNode {
+virBitmapPtr nodeset;
+virDomainNumatuneMemMode mode;
+} *mem_nodes;   /* fine tuning per guest node */
+size_t nmem_nodes;
+
 /* Future NUMA tuning related stuff should go here. */
 };


+static int
+virDomainNumatuneNodeParseXML(virDomainDefPtr def,
+  xmlXPathContextPtr ctxt)
+{
+char *tmp = NULL;
+int n = 0;;
+int ret = -1;
+size_t i = 0;
+xmlNodePtr *nodes = NULL;
+
+if ((n = virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+   _("Cannot extract memnode nodes"));
+goto cleanup;
+}
+
+if (!n)
+return 0;
+
+if (def->numatune && def->numatune->memory.specified &&
+def->numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) 
{
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("Per-node binding is not compatible with "
+ "automatic NUMA placement."));
+goto cleanup;
+}
+
+if (!def->cpu || !def->cpu->ncells) {
+virReportError(VIR_ERR_XML_ERROR, "%s",
+   _("Element 'memnode' is invalid without "
+ "any guest NUMA cells"));
+goto cleanup;
+}
+
+if (!def->numatune && VIR_ALLOC(def->numatune) < 0)
+goto cleanup;
+
+VIR_FREE(def->numatune->mem_nodes);
+if (VIR_ALLOC_N(def->numatune->mem_nodes, def->cpu->ncells) < 0)
+goto cleanup;
+
+def->numatune->nmem_nodes = def->cpu->ncells;
+
+for (i = 0; i < n; i++) {
+int mode = 0;
+unsigned int cellid = 0;
+virDomainNum