From: "Jan Beulich" Subject: Re: [PATCH] x86/numa: Adjust datatypes for node and pxm Date: Mon, 23 Feb 2015 14:47:17 +0000 Message-ID: <54EB4B8502000078000628B6@mail.emea.novell.com> References: <1424542459-2615-1-git-send-email-boris.ostrovsky@oracle.com> <54EB07B10200007800062614@mail.emea.novell.com> <54EB3C61.1060606@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54EB3C61.1060606@oracle.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: Boris Ostrovsky Cc: kevin.tian@intel.com, keir@xen.org, ian.campbell@citrix.com, Andrew.Cooper3@citrix.com, dario.faggioli@citrix.com, tim@xen.org, xen-devel@lists.xen.org, stefano.stabellini@citrix.com, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 23.02.15 at 15:42, wrote: > On 02/23/2015 04:57 AM, Jan Beulich wrote: >>>>> On 21.02.15 at 19:14, wrote: >>> --- a/xen/arch/x86/srat.c >>> +++ b/xen/arch/x86/srat.c >>> @@ -21,44 +21,55 @@ >>> #include >>> #include >>> >>> +#define MAX_PXM 255 >> Perhaps better (MAX_NUMNODES - 1) than a literal number? Or >> even do away with it altogether, use MAX_NUMNODES - 1 in the >> array definition and ARRAY_SIZE() elsewhere? > > I am not sure we can do this: PXMs are not guaranteed to be zero-based. > > And, in fact, the way we map PXMs to nodes is not quite right because of > this --- it just so happens that PXMs are usually under 255 (and > zero-based) and we can use them as index to 255-sized array. IIRC the > spec defines them as 32-bit values. Ah, yes, you're right. We may need to allocate the array dynamically as soon as we run into a system with large PXMs. Jan