xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Elena Ufimtseva <ufimtseva@gmail.com>
Cc: keir@xen.org, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, george.dunlap@eu.citrix.com,
	msw@linux.com, lccycc123@gmail.com, ian.jackson@eu.citrix.com,
	xen-devel@lists.xen.org, JBeulich@suse.com
Subject: Re: [PATCH v3 3/7] libxc: vnodes allocation on NUMA nodes.
Date: Tue, 19 Nov 2013 15:22:28 +0100	[thread overview]
Message-ID: <1384870948.19880.87.camel@Abyss> (raw)
In-Reply-To: <1384806262-12532-4-git-send-email-ufimtseva@gmail.com>


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

On lun, 2013-11-18 at 15:24 -0500, Elena Ufimtseva wrote:
> Signed-off-by: Elena Ufimtseva <ufimtseva@gmail.com>

> diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
> index e034d62..1839360 100644

> @@ -802,27 +802,47 @@ int arch_setup_meminit(struct xc_dom_image *dom)
>      else
>      {
>          /* try to claim pages for early warning of insufficient memory avail */
> +        rc = 0;
>          if ( dom->claim_enabled ) {
>              rc = xc_domain_claim_pages(dom->xch, dom->guest_domid,
>                                         dom->total_pages);
>              if ( rc )
> +            {
> +                xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
> +                             "%s: Failed to claim mem for dom\n",
> +                             __FUNCTION__);
>                  return rc;
> +            }
>
Mmm... here you're just adding some log output. I think it's a minor
thing, i.e., it's not terrible to have this in this patch. However,
ideally, this should happen in its own patch, as it is not much related
to vNUMA, is it?

>          /* allocate guest memory */
> -        for ( i = rc = allocsz = 0;
> -              (i < dom->total_pages) && !rc;
> -              i += allocsz )
> +        if ( dom->nr_vnodes > 0 )
>          {
> -            allocsz = dom->total_pages - i;
> -            if ( allocsz > 1024*1024 )
> -                allocsz = 1024*1024;
> -            rc = xc_domain_populate_physmap_exact(
> -                dom->xch, dom->guest_domid, allocsz,
> -                0, 0, &dom->p2m_host[i]);
> +            rc = arch_boot_numa_alloc(dom);
> +            if ( rc )
> +            {
> +                xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
> +                             "%s: Failed to allocate memory on NUMA nodes\n",
> +                             __FUNCTION__);
> +                return rc;
> +            }
> +        }
> +        else
> +        {
> +            for ( i = rc = allocsz = 0;
> +                  (i < dom->total_pages) && !rc;
> +                  i += allocsz )
> +            {
> +                allocsz = dom->total_pages - i;
> +                if ( allocsz > 1024*1024 )
> +                    allocsz = 1024*1024;
> +                rc = xc_domain_populate_physmap_exact(
> +                    dom->xch, dom->guest_domid, allocsz,
> +                    0, 0, &dom->p2m_host[i]);
> +            }
>          }
I think I agree with George's comment from last round: do unify the two
paths (yes, I saw it's on the TODO for this patch... so, go ahead and do
it :-) ).

> +int arch_boot_numa_alloc(struct xc_dom_image *dom)
> +{ 
> +    int rc;
> +    unsigned int n;
> +    unsigned long long guest_pages;
> +    unsigned long long allocsz = 0, node_pfn_base, i;
> +    unsigned long memflags;
> +
> +    rc = allocsz = node_pfn_base = 0;
>  
> +    allocsz = 0;
> +    for ( n = 0; n < dom->nr_vnodes; n++ )
> +    {
> +        memflags = 0;
> +        if ( dom->vnode_to_pnode[n] != VNUMA_NO_NODE )
> +        {
> +            memflags |= XENMEMF_exact_node(dom->vnode_to_pnode[n]);
> +            memflags |= XENMEMF_exact_node_request;
> +        }
> +        guest_pages = (dom->vnuma_memszs[n] << 20) >> PAGE_SHIFT_X86;
>
I probably would call this 'pages_node' (or 'node_pages', or
'guest_pages_node', etc.), but that's also something not that
important. :-)

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: 198 bytes --]

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

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

  reply	other threads:[~2013-11-19 14:22 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 20:24 [PATCH v3 0/7] vNUMA introduction Elena Ufimtseva
2013-11-18 20:24 ` [PATCH v3 1/7] xen: vNUMA support for PV guests Elena Ufimtseva
2013-11-19  7:41   ` Dario Faggioli
2013-11-19 14:01   ` Jan Beulich
2013-11-19 14:35     ` Dario Faggioli
2013-11-19 14:48       ` Jan Beulich
2013-11-19 15:42         ` Dario Faggioli
2013-11-19 15:54           ` Jan Beulich
2013-11-19 16:36             ` Dario Faggioli
2013-11-19 16:43               ` Jan Beulich
2013-11-26 21:59                 ` Elena Ufimtseva
2013-11-27  1:23                   ` Dario Faggioli
2013-11-27  8:14                   ` Jan Beulich
2013-12-02 17:06                     ` Elena Ufimtseva
2013-12-02 17:09                       ` Jan Beulich
2013-12-02 17:27                         ` Elena Ufimtseva
2013-11-18 20:24 ` [PATCH v3 2/7] libxc: Plumb Xen with vNUMA topology for domain Elena Ufimtseva
2013-11-19  8:37   ` Dario Faggioli
2013-11-19 14:03     ` Konrad Rzeszutek Wilk
2013-11-19 22:06       ` Elena Ufimtseva
2013-11-18 20:24 ` [PATCH v3 3/7] libxc: vnodes allocation on NUMA nodes Elena Ufimtseva
2013-11-19 14:22   ` Dario Faggioli [this message]
2013-11-18 20:24 ` [PATCH v3 4/7] libxl: vNUMA supporting interface Elena Ufimtseva
2013-11-19 18:37   ` Dario Faggioli
2013-11-21  9:59     ` Li Yechen
2013-11-26 22:14       ` Elena Ufimtseva
2013-11-26 23:21         ` Dario Faggioli
2013-12-02 18:14     ` Elena Ufimtseva
2013-11-18 20:24 ` [PATCH v3 5/7] libxl: vNUMA configuration parser Elena Ufimtseva
2013-11-19 17:20   ` Dario Faggioli
2013-11-20 22:48   ` Matthew Daley
2013-11-21  3:20     ` Elena Ufimtseva
2013-11-18 20:24 ` [PATCH v3 6/7] xen: adds vNUMA info debug-key u Elena Ufimtseva
2013-11-22 18:15   ` Dario Faggioli
2013-11-18 20:24 ` [PATCH v3 7/7] xl: docs for xl config vnuma options Elena Ufimtseva
2013-11-19 17:23   ` Dario Faggioli
2013-11-19 17:26     ` George Dunlap

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=1384870948.19880.87.camel@Abyss \
    --to=dario.faggioli@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=lccycc123@gmail.com \
    --cc=msw@linux.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=ufimtseva@gmail.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).