From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1q5j-0004wg-57 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 01:59:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1q5f-00018Z-QN for qemu-devel@nongnu.org; Mon, 08 Jun 2015 01:59:23 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:51727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1q5f-00017H-6R for qemu-devel@nongnu.org; Mon, 08 Jun 2015 01:59:19 -0400 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Jun 2015 15:59:16 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 02CD7357804C for ; Mon, 8 Jun 2015 15:59:12 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t585x41q2359656 for ; Mon, 8 Jun 2015 15:59:12 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t585wdFL021488 for ; Mon, 8 Jun 2015 15:58:39 +1000 Date: Mon, 8 Jun 2015 11:28:18 +0530 From: Bharata B Rao Message-ID: <20150608055818.GE25832@in.ibm.com> References: <1430982264-25497-1-git-send-email-bharata@linux.vnet.ibm.com> <20150513180607.GK25766@thinpad.lan.raisama.net> <55546D3A.8010509@redhat.com> <20150525074757.GE32383@in.ibm.com> <20150525174240.GP17796@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150525174240.GP17796@thinpad.lan.raisama.net> Subject: Re: [Qemu-devel] [RFC PATCH v0] numa: API to lookup NUMA node by address Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Paolo Bonzini , david@gibson.dropbear.id.au, qemu-devel@nongnu.org, imammedo@redhat.com On Mon, May 25, 2015 at 02:42:40PM -0300, Eduardo Habkost wrote: > On Mon, May 25, 2015 at 01:17:57PM +0530, Bharata B Rao wrote: > > On Thu, May 14, 2015 at 11:39:06AM +0200, Paolo Bonzini wrote: > > > On 13/05/2015 20:06, Eduardo Habkost wrote: > > > > Also, this introduces a circular dependency between pc-dimm.c and > > > > numa.c. Instead of that, pc-dimm could simply notify us when a new > > > > device is realized (with just (addr, end, node) as arguments), so we can > > > > save the list of memory ranges inside struct node_info. > > > > > > > > I wonder if the memory API already provides something that would help > > > > us. Paolo, do you see a way we could simply use a MemoryRegion as input > > > > to lookup the NUMA node? > > > > > > No, but I guess you could add a numa_get/set_memory_region_node_id API > > > that uses a hash table. That's a variant of the "pc-dimm could simply > > > notify" numa.c that you propose above. > > > > While you say we can't use MemoryRegion as input to lookup the NUMA node, > > you suggest that we add numa_get/set_memory_region_node_id. Does this API > > get/set NUMA node id for the given MemoryRegion ? > > I was going to suggest that, but it would require changing the > non-memdev code path to create a MemoryRegion for each node, too. So > having a numa_set_mem_node_id(start_addr, end_addr, node_id) API would > be simpler. In order to save the list of memory ranges inside node_info, I tried this approach where I call numa_set_mem_node_id(dimm.addr, dimm.size, dimm.node) from pc_dimm_realize(), but the value of dimm.addr is finalized only later in ->plug(). So we would have to call this API from arch code like pc_dimm_plug(). Is that acceptable ? Regards, Bharata.