From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X05iY-00025k-Dl for qemu-devel@nongnu.org; Thu, 26 Jun 2014 05:11:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X05iN-0005DO-Ik for qemu-devel@nongnu.org; Thu, 26 Jun 2014 05:11:42 -0400 Received: from [59.151.112.132] (port=14695 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X05iM-0005Cp-Mz for qemu-devel@nongnu.org; Thu, 26 Jun 2014 05:11:31 -0400 Date: Thu, 26 Jun 2014 17:09:25 +0800 From: Hu Tao Message-ID: <20140626090924.GA12168@G08FNSTD100614.fnst.cn.fujitsu.com> References: <20140623193310.GD4323@linux.vnet.ibm.com> <20140624004825.GE4323@linux.vnet.ibm.com> <20140624174038.GK4323@linux.vnet.ibm.com> <20140625132134.24b70a65@nial.usersys.redhat.com> <20140625161359.GA8698@linux.vnet.ibm.com> <20140625165256.GD3222@otherpad.lan.raisama.net> <20140625182317.GG16636@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20140625182317.GG16636@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH v3] numa: enable sparse node numbering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Eduardo Habkost , Alexey Kardashevskiy , Nishanth Aravamudan , qemu-devel@nongnu.org, Anton Blanchard , David Rientjes , Igor Mammedov On Wed, Jun 25, 2014 at 09:23:17PM +0300, Michael S. Tsirkin wrote: > On Wed, Jun 25, 2014 at 01:52:56PM -0300, Eduardo Habkost wrote: > > On Wed, Jun 25, 2014 at 09:13:59AM -0700, Nishanth Aravamudan wrote: > > > On 25.06.2014 [13:21:34 +0200], Igor Mammedov wrote: > > > > On Tue, 24 Jun 2014 10:40:38 -0700 > > > > Nishanth Aravamudan wrote: > > > > > > > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > > > > > index 277230d..b90bf66 100644 > > > > > --- a/include/sysemu/sysemu.h > > > > > +++ b/include/sysemu/sysemu.h > > > > > @@ -145,11 +145,13 @@ extern int mem_prealloc; > > > > > */ > > > > > #define MAX_CPUMASK_BITS 255 > > > > > > > > > > -extern int nb_numa_nodes; > > > > > +extern int nb_numa_nodes; /* Number of NUMA nodes */ > > > > > +extern int max_numa_node; /* Highest specified NUMA node ID */ > > > > > typedef struct node_info { > > > > > uint64_t node_mem; > > > > > DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS); > > > > > struct HostMemoryBackend *node_memdev; > > > > > + bool present; > > > > How about dropping 'present' and replacing array with a list > > > > of only present nodes? > > > > > > If that would be preferred, I can move to that. I assume a simple > > > linked-list is fine. Does qemu provide any infrastructure for defining > > > lists? I'll look through the source but any pointers would be helpful. > > > > > > Generally speaking, sparse NUMA nodes aren't that common and when they > > > exist, the gaps aren't large. But it does seem to make sense if we have > > > sparse IDs at all, we might as well move to a list. > > > > > > In any case, moving to the list means we'd have a nodeid as part of the > > > structure instead. > > > > > > > That way it will be one more step closer to converting numa > > > > infrastructure to a set of QOM objects. > > > > > > Sounds like a good idea to me. I'll respin the patch soon. > > > > Having a list makes sense, the only difference is that keeping a sparse > > array sorted is much easier than making a sorted list (because the ACPI > > tables are nodeid-ordered). That's why I suggested keeping the array > > initially. > > > > Adding a "present" field to the array is a trivial and easy-to-review > > change. Changing NodeInfo to use linked lists is a more complex change > > that I wouldn't want to include after soft freeze. > > > > In other words: > > * Having a list is better than a sparse array; but: > > * Having a small sparse array with the "present" field is better > > than broken sparse nodeid support (IMO). > > I agree here. This patchset is still RFC but if that's > the only issue I might apply it. I don't think it is ready for 2.1 since it lacks arch-specific changes. The patch itself only makes qemu be able to bring up guest with sparse numa nodes, without arch-specific changes, guest sees only one node(at least on x86). Hu