From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VErtp-0001tf-Dw for qemu-devel@nongnu.org; Wed, 28 Aug 2013 22:23:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VErtf-0000nZ-Ds for qemu-devel@nongnu.org; Wed, 28 Aug 2013 22:23:53 -0400 Received: from [222.73.24.84] (port=20221 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VErtf-0000n1-2H for qemu-devel@nongnu.org; Wed, 28 Aug 2013 22:23:43 -0400 Message-ID: <521EB076.2080604@cn.fujitsu.com> Date: Thu, 29 Aug 2013 10:22:46 +0800 From: Wanlong Gao MIME-Version: 1.0 References: <1377231003-2816-1-git-send-email-gaowanlong@cn.fujitsu.com> <1377231003-2816-7-git-send-email-gaowanlong@cn.fujitsu.com> <433635292.2972869.1377247246639.JavaMail.root@redhat.com> <521AB2C1.40306@cn.fujitsu.com> <588686645.448144.1377503181634.JavaMail.root@redhat.com> <521B0EF7.2050203@cn.fujitsu.com> <298159858.481798.1377506599931.JavaMail.root@redhat.com> <521DFEBC.30502@redhat.com> In-Reply-To: <521DFEBC.30502@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH V9 06/12] NUMA: Add Linux libnuma detection Reply-To: gaowanlong@cn.fujitsu.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Andrew Jones , ehabkost@redhat.com, hutao@cn.fujitsu.com, qemu-devel@nongnu.org, peter huangpeng , bsd@redhat.com, aliguori@us.ibm.com, y-goto@jp.fujitsu.com, lcapitulino@redhat.com, lersek@redhat.com, afaerber@suse.de, Wanlong Gao On 08/28/2013 09:44 PM, Paolo Bonzini wrote: > Il 26/08/2013 10:43, Andrew Jones ha scritto: >> >> ----- Original Message ----- >>>> On 08/26/2013 03:46 PM, Andrew Jones wrote: >>>>>>>>>> Is this patch still necessary? I thought that dropping the >>>>>>>>>>>>>> numa_num_configured_nodes() calls from patch 8/12 got rid >>>>>>>>>>>>>> of the need for this library. Maybe I missed other uses? >>>>>>>>>> >>>>>>>>>> Yes, in 08/12 we also use mbind(), >>>>>> You don't need a whole library for mbind(), it's a syscall. See syscall(2). >>>>>> >>>>>>>>>> and in 09/12 we use max_numa_node(). >>>>>> Really? I didn't see it there. And anyway, that goes back to our discussion >>>>>> about setting qemu's MAX_NODES to whatever we think qemu should support, >>>>>> and then just checking that we don't blow that limit whenever reading >>>>>> host node info, i.e. >>>>>> >>>>>> maxnode = 0; >>>>>> while (host_nodes[maxnode] && maxnode < MAX_NODES) >>>>>> node_read(&info[maxnode++]); >>>>>> >>>>>> type of a thing. >>>>>> >>>>>> And, if there's a place you really need to know the current online number >>>>>> of host nodes, then, like I said earlier, you should just go to sysfs >>>>>> yourself. libnuma:numa_max_node() returns an int that it only initializes >>>>>> at library load time, so it's not going to adapt to onlining/offlining. >>>> >>>> OK, thank you. >>>> Then I should define MPOL_* macros in QEMU and use mbind(2) syscall directly, >>>> right? >> Hmm, yeah, that's too bad that numaif.h is part of libnuma, and not a more >> general lib. Whether or not we want to redefine those symbols within >> qemu, in order to avoid the dependency on installing numactl-devel, isn't >> something I can answer. That's a better question for Anthony. Anthony? Paolo, >> any opinions? Maybe we should pick up uapi/linux/mempolicy.h with the >> linux-header synch script? >> > > I think using libnuma is fine. In principle this could be used on other > OSes than Linux, I think? But seems that mbind(2) is Linux-specific syscall, right? Thanks, Wanlong Gao > > Paolo >