From: Laszlo Ersek <lersek@redhat.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
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
Subject: Re: [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option
Date: Tue, 30 Jul 2013 13:14:10 +0200 [thread overview]
Message-ID: <51F7A002.3040807@redhat.com> (raw)
In-Reply-To: <1375169553-12099-3-git-send-email-gaowanlong@cn.fujitsu.com>
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.
I think this patch is good; if you adapt it to the ['UInt16'] ->
['uint16'] change I proposed for 01/11, you can add
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!
Laszlo
next prev parent reply other threads:[~2013-07-30 11:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 7:32 [Qemu-devel] [PATCH V6 00/11] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 01/11] NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions Wanlong Gao
2013-07-30 10:52 ` Laszlo Ersek
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option Wanlong Gao
2013-07-30 11:14 ` Laszlo Ersek [this message]
2013-07-31 2:10 ` Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 03/11] NUMA: move numa related code to numa.c Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 04/11] NUMA: Add numa_info structure to contain numa nodes info Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 05/11] NUMA: Add Linux libnuma detection Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 06/11] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 07/11] NUMA: set " Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 08/11] NUMA: add qmp command set-mem-policy to set memory policy for NUMA node Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 09/11] NUMA: add hmp command set-mem-policy Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 10/11] NUMA: add qmp command query-numa Wanlong Gao
2013-07-30 7:32 ` [Qemu-devel] [PATCH V6 11/11] NUMA: convert hmp command info_numa to use qmp command query_numa Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F7A002.3040807@redhat.com \
--to=lersek@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=bsd@redhat.com \
--cc=ehabkost@redhat.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=hutao@cn.fujitsu.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=y-goto@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).