[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option
From: |
Laszlo Ersek |
Subject: |
Re: [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option |
Date: |
Tue, 30 Jul 2013 13:14:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130621 Thunderbird/17.0.7 |
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 <address@hidden>
Thanks!
Laszlo
- [Qemu-devel] [PATCH V6 00/11] Add support for binding guest numa nodes to host numa nodes, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 01/11] NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 03/11] NUMA: move numa related code to numa.c, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option, Wanlong Gao, 2013/07/30
- Re: [Qemu-devel] [PATCH V6 02/11] NUMA: split -numa option,
Laszlo Ersek <=
- [Qemu-devel] [PATCH V6 05/11] NUMA: Add Linux libnuma detection, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 04/11] NUMA: Add numa_info structure to contain numa nodes info, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 07/11] NUMA: set guest numa nodes memory policy, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 06/11] NUMA: parse guest numa nodes memory policy, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 09/11] NUMA: add hmp command set-mem-policy, Wanlong Gao, 2013/07/30
- [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
- [Qemu-devel] [PATCH V6 11/11] NUMA: convert hmp command info_numa to use qmp command query_numa, Wanlong Gao, 2013/07/30
- [Qemu-devel] [PATCH V6 10/11] NUMA: add qmp command query-numa, Wanlong Gao, 2013/07/30