[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for pr
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping |
Date: |
Wed, 3 May 2017 14:58:02 -0300 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Wed, May 03, 2017 at 02:38:41PM -0300, Eduardo Habkost wrote:
> On Wed, May 03, 2017 at 11:39:10AM -0500, Eric Blake wrote:
> > On 05/03/2017 11:35 AM, Eduardo Habkost wrote:
> >
> > >> +
> > >> + 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?
> >
> > Markus just added QAPI_CLONE_MEMBERS(), which sounds like what you want:
> >
> > https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg04867.html
>
> Not sure if it would work in this case. Note that cpu and
> object->u.cpu have different types. 'cpu' is CpuInstanceProps,
> but object->u.cpu is NodeCpuOptions.
>
> NodeCpuOptions has { 'base': 'CpuInstanceProps' }, and
> CpuInstanceProps field declarations are duplicated in struct
> NodeCpuOptions. Do you know why struct inheritance is implemented
> by duplicating the fields of the base struct instead of embedding
> the base struct?
Nevermind, I just found out that QAPI generates a
qapi_NumaCpuOptions_base() upcast helper. So this can be solved
with no data copying at all:
machine_set_cpu_numa_nodes(ms, qapi_NumaCpuOptions_base(&object->u.cpu), &err);
--
Eduardo
- Re: [Qemu-ppc] [PATCH v2 20/24] machine: call machine init from wrapper, (continued)
- [Qemu-ppc] [PATCH v2 19/24] numa: remove no longer need numa_post_machine_init(), Igor Mammedov, 2017/05/03
- [Qemu-ppc] [PATCH v2 21/24] numa: use possible_cpus for not mapped CPUs check, Igor Mammedov, 2017/05/03
- [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, Igor Mammedov, 2017/05/03
- Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, Eduardo Habkost, 2017/05/03
- Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, Eric Blake, 2017/05/03
- Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, Eduardo Habkost, 2017/05/03
- Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping,
Eduardo Habkost <=
- Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, Igor Mammedov, 2017/05/04
Re: [Qemu-ppc] [PATCH v2 23/24] numa: add '-numa cpu, ...' option for property based node mapping, David Gibson, 2017/05/08
[Qemu-ppc] [PATCH v2 22/24] numa: remove node_cpu bitmaps as they are no longer used, Igor Mammedov, 2017/05/03
[Qemu-ppc] [PATCH v2 24/24] tests: check -numa node, cpu=props_list usecase, Igor Mammedov, 2017/05/03
Re: [Qemu-ppc] [PATCH v2 00/24] numa: add '-numa cpu' option, Eduardo Habkost, 2017/05/04