From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v4 02/21] xen: make two memory hypercalls vNUMA-aware Date: Fri, 23 Jan 2015 16:17:41 +0000 Message-ID: <54C282350200007800058FCD@mail.emea.novell.com> References: <1422011632-22018-1-git-send-email-wei.liu2@citrix.com> <1422011632-22018-3-git-send-email-wei.liu2@citrix.com> <54C257B30200007800058CF7@mail.emea.novell.com> <20150123144627.GC1801@zion.uk.xensource.com> <54C278DF0200007800058F0F@mail.emea.novell.com> <20150123154306.GD1801@zion.uk.xensource.com> <20150123160615.GE1801@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150123160615.GE1801@zion.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.campbell@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org >>> On 23.01.15 at 17:06, wrote: > So the logic of translation now is (take into consideration the second > point of how we should enforce exact_node flag, I think that flag should > be preserved if it was requested at the beginning): Yes, and the code looks right now. Jan > +static int translate_vnode_to_pnode(struct domain *d, > + struct xen_memory_reservation *r, > + struct memop_args *a) > +{ > + int rc = 0; > + unsigned int vnode, pnode; > + > + if ( r->mem_flags & XENMEMF_vnode ) > + { > + a->memflags &= ~MEMF_node(XENMEMF_get_node(r->mem_flags)); > + a->memflags &= ~MEMF_exact_node; > + > + read_lock(&d->vnuma_rwlock); > + if ( d->vnuma ) > + { > + vnode = XENMEMF_get_node(r->mem_flags); > + > + if ( vnode < d->vnuma->nr_vnodes ) > + { > + pnode = d->vnuma->vnode_to_pnode[vnode]; > + > + if ( pnode != NUMA_NO_NODE ) > + { > + a->memflags |= MEMF_node(pnode); > + if ( r->mem_flags & XENMEMF_exact_node_request ) > + a->memflags |= MEMF_exact_node; > + } > + } > + else > + rc = -EINVAL; > + } > + read_unlock(&d->vnuma_rwlock); > + } > + > + return rc; > +} > >> Wei. >> >> > Jan