qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping
Date: Wed, 3 May 2017 13:35:43 -0300
User-agent: Mutt/1.8.0 (2017-02-23)

On Wed, May 03, 2017 at 02:57:17PM +0200, Igor Mammedov wrote:
[...]
> diff --git a/numa.c b/numa.c
> index 40e9f44..61521f5 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -227,6 +227,7 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error 
> **errp)
>      NumaOptions *object = NULL;
>      MachineState *ms = opaque;
>      Error *err = NULL;
> +    CpuInstanceProperties cpu;
>  
>      {
>          Visitor *v = opts_visitor_new(opts);
> @@ -246,6 +247,30 @@ static int parse_numa(void *opaque, QemuOpts *opts, 
> Error **errp)
>          }
>          nb_numa_nodes++;
>          break;
> +    case NUMA_OPTIONS_TYPE_CPU:
> +        if (!object->u.cpu.has_node_id) {
> +            error_setg(&err, "Missing mandatory node-id property");
> +            goto end;
> +        }
> +        if (!numa_info[object->u.cpu.node_id].present) {
> +            error_setg(&err, "Invalid node-id=%" PRId64 ", NUMA node must be 
> "
> +                "defined with -numa node,nodeid=ID before it's used with "
> +                "-numa cpu,node-id=ID", object->u.cpu.node_id);
> +            goto end;
> +        }
> +
> +        memset(&cpu, 0, sizeof(cpu));
> +        cpu.has_node_id = object->u.cpu.has_node_id;
> +        cpu.node_id = object->u.cpu.node_id;
> +        cpu.has_socket_id = object->u.cpu.has_socket_id;
> +        cpu.socket_id = object->u.cpu.socket_id;
> +        cpu.has_core_id = object->u.cpu.has_core_id;
> +        cpu.core_id = object->u.cpu.core_id;
> +        cpu.has_thread_id = object->u.cpu.has_thread_id;
> +        cpu.thread_id = object->u.cpu.thread_id;

We don't have a way to avoid copying each field individually?
Some visitor trick, maybe?

Eric, Markus, Michael, do you have any suggestions?

> +
> +        machine_set_cpu_numa_node(ms, &cpu, &err);
> +        break;
>      default:
>          abort();
>      }
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 76d137d..5baf3a4 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -5680,10 +5680,12 @@
>  ##
>  # @NumaOptionsType:
>  #
> +# @cpu: property based CPU(s) to node mapping (Since: 2.10)
> +#
>  # Since: 2.1
>  ##
>  { 'enum': 'NumaOptionsType',
> -  'data': [ 'node' ] }
> +  'data': [ 'node', 'cpu' ] }
>  
>  ##
>  # @NumaOptions:
> @@ -5696,7 +5698,8 @@
>    'base': { 'type': 'NumaOptionsType' },
>    'discriminator': 'type',
>    'data': {
> -    'node': 'NumaNodeOptions' }}
> +    'node': 'NumaNodeOptions',
> +    'cpu': 'NumaCpuOptions' }}
>  
>  ##
>  # @NumaNodeOptions:
> @@ -5725,6 +5728,20 @@
>     '*memdev': 'str' }}
>  
>  ##
> +# @NumaCpuOptions:
> +#
> +# Option "-numa cpu" overrides default cpu to node mapping.
> +# It accepts the same set of cpu properties as returned by
> +# query-hotpluggable-cpus[].props, where node-id could be used to
> +# override default node mapping.
> +#
> +# Since: 2.10
> +##
> +{ 'struct': 'NumaCpuOptions',
> +   'base': 'CpuInstanceProperties',
> +   'data' : {} }
> +
> +##
>  # @HostMemPolicy:
>  #
>  # Host memory policy types
[...]

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]