All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Juergen Gross <jgross@suse.com>,
	xen-devel@lists.xenproject.org,
	Anshul Makkar <anshul.makkar@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	George Dunlap <george.dunlap@citrix.com>
Subject: Re: [PATCH] libxl: avoid considering pCPUs outside of the cpupool during NUMA placement
Date: Fri, 21 Oct 2016 14:52:05 +0200	[thread overview]
Message-ID: <1477054325.24930.112.camel@citrix.com> (raw)
In-Reply-To: <20161021102923.GT2639@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 2711 bytes --]

On Fri, 2016-10-21 at 11:29 +0100, Wei Liu wrote:
> On Fri, Oct 21, 2016 at 11:56:14AM +0200, Dario Faggioli wrote:
> > diff --git a/tools/libxl/libxl_numa.c b/tools/libxl/libxl_numa.c
> > index 33289d5..f2a719d 100644
> > --- a/tools/libxl/libxl_numa.c
> > +++ b/tools/libxl/libxl_numa.c
> > @@ -186,9 +186,12 @@ static int nr_vcpus_on_nodes(libxl__gc *gc,
> > libxl_cputopology *tinfo,
> >  {
> >      libxl_dominfo *dinfo = NULL;
> >      libxl_bitmap dom_nodemap, nodes_counted;
> > +    libxl_cpupoolinfo cpupool_info;
> >      int nr_doms, nr_cpus;
> >      int i, j, k;
> >  
> > +    libxl_cpupoolinfo_init(&cpupool_info);
> > +
> 
> Please move this into the loop below, see (*).
> 
Seems unnecessary, but I certainly can do that. I guess it makes the
code less dependent from the actual implementation
of libxl_cpupoolinfo_dispose(), which is probably a good thing.

> > 
> >      dinfo = libxl_list_domain(CTX, &nr_doms);
> >      if (dinfo == NULL)
> >          return ERROR_FAIL;
> > @@ -205,12 +208,18 @@ static int nr_vcpus_on_nodes(libxl__gc *gc,
> > libxl_cputopology *tinfo,
> >      }
> >  
> >      for (i = 0; i < nr_doms; i++) {
> > -        libxl_vcpuinfo *vinfo;
> > -        int nr_dom_vcpus;
> > +        libxl_vcpuinfo *vinfo = NULL;
> 
> This is not necessary because vinfo is written right away.
> 
Is it? It was before this patch, but with it, if this [*] fails...

> > 
> > +        int cpupool, nr_dom_vcpus;
> > +
> > +        cpupool = libxl__domain_cpupool(gc, dinfo[i].domid);
> > +        if (cpupool < 0)

[*]

> > +            goto next;

... we go to next which does libxl_vcpuinfo_list_free() on a non-
initialised pointer

> > @@ -236,7 +252,10 @@ static int nr_vcpus_on_nodes(libxl__gc *gc,
> > libxl_cputopology *tinfo,
> >              }
> >          }
> >  
> > + next:
> > +        libxl_cpupoolinfo_dispose(&cpupool_info);
> >          libxl_vcpuinfo_list_free(vinfo, nr_dom_vcpus);
> > +        vinfo = NULL;
> 
> This is not necessary as vinfo is rewritten at the beginning of every
> loop.

Actually, I do agree that this is not necessary, iff I keep the
assignment there, at the beginning of the loop... or am I missing
something?

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-10-21 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  9:56 [PATCH] libxl: avoid considering pCPUs outside of the cpupool during NUMA placement Dario Faggioli
2016-10-21 10:29 ` Wei Liu
2016-10-21 10:50   ` Juergen Gross
2016-10-21 10:56     ` Wei Liu
2016-10-21 12:52   ` Dario Faggioli [this message]
2016-10-21 10:51 ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477054325.24930.112.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.