From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4LsE-000231-1r for qemu-devel@nongnu.org; Tue, 30 Jul 2013 22:10:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4Ls7-0001g3-UZ for qemu-devel@nongnu.org; Tue, 30 Jul 2013 22:10:45 -0400 Received: from [222.73.24.84] (port=17605 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4Ls7-0001eH-C0 for qemu-devel@nongnu.org; Tue, 30 Jul 2013 22:10:39 -0400 Message-ID: <51F87226.9080309@cn.fujitsu.com> Date: Wed, 31 Jul 2013 10:10:46 +0800 From: Wanlong Gao MIME-Version: 1.0 References: <1375169553-12099-1-git-send-email-gaowanlong@cn.fujitsu.com> <1375169553-12099-3-git-send-email-gaowanlong@cn.fujitsu.com> <51F7A002.3040807@redhat.com> In-Reply-To: <51F7A002.3040807@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option Reply-To: gaowanlong@cn.fujitsu.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: aliguori@us.ibm.com, ehabkost@redhat.com, hutao@cn.fujitsu.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, bsd@redhat.com, y-goto@jp.fujitsu.com, pbonzini@redhat.com, peter.huangpeng@huawei.com, afaerber@suse.de, Wanlong Gao On 07/30/2013 07:14 PM, Laszlo Ersek wrote: > On 07/30/13 09:32, Wanlong Gao wrote: > >> +static int numa_node_parse(NumaNodeOptions *opts) >> +{ >> + uint16_t nodenr; >> + UInt16List *cpus = NULL; >> + >> + if (opts->has_nodeid) { >> + nodenr = opts->nodeid; >> + if (nodenr >= MAX_NODES) { >> + fprintf(stderr, "qemu: Max number of NUMA nodes reached: %" >> + PRIu16 "\n", nodenr); >> + return -1; >> + } >> + } else { >> + nodenr = nb_numa_nodes; >> + } >> + >> + for (cpus = opts->cpus; cpus; cpus = cpus->next) { >> + bitmap_set(node_cpumask[nodenr], cpus->value->u16, 1); >> + } >> + >> + if (opts->has_mem) { >> + int64_t mem_size; >> + char *endptr; >> + mem_size = strtosz(opts->mem, &endptr); >> + if (mem_size < 0 || *endptr) { >> + fprintf(stderr, "qemu: invalid numa mem size: %s\n", opts->mem); >> + return -1; >> + } >> + node_mem[nodenr] = mem_size; >> + } >> + >> + return 0; >> +} >> + >> +static int numa_mem_parse(NumaMemOptions *opts) >> +{ >> + uint16_t nodenr; >> + uint64_t mem_size; >> + >> + if (opts->has_nodeid) { >> + nodenr = opts->nodeid; >> + if (nodenr >= MAX_NODES) { >> + fprintf(stderr, "qemu: Max number of NUMA nodes reached: %" >> + PRIu16 "\n", nodenr); >> + return -1; >> + } >> + } else { >> + nodenr = nb_numa_mem_nodes; >> + } >> + >> + if (opts->has_size) { >> + mem_size = opts->size; >> + node_mem[nodenr] = mem_size; >> + } >> + >> + return 0; >> +} > > Unless I'm missing something: > > Just like "NumaMemOptions.size" (which has type 'size' in the JSON), > OptsVisitor could parse "NumaNodeOptions.mem" for you as well, if you > switched the latter's type to 'size' too. > > ... Hm, not really. This is probably a compatibility thing. Without any > specific suffix, strtosz() passes STRTOSZ_DEFSUFFIX_MB to > strtosz_suffix() (ie. the legacy optarg is expressed in megabytes, if > the user doesn't specify a suffix him/herself), while opts_type_size() > passes STRTOSZ_DEFSUFFIX_B. Yeah, right. > > I think this patch is good; if you adapt it to the ['UInt16'] -> > ['uint16'] change I proposed for 01/11, you can add Done, thank you. Wanlong Gao > > Reviewed-by: Laszlo Ersek > > Thanks! > Laszlo >