[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 18/71] tests/libqos: embed allocators instead of
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 18/71] tests/libqos: embed allocators instead of malloc-ing them |
Date: |
Fri, 7 Dec 2018 14:57:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 07/12/18 13:32, Thomas Huth wrote:
> On 2018-12-03 16:32, Paolo Bonzini wrote:
>> qgraph will embed these objects instead of allocating them in a separate
>> object. Expose a new API "generic_alloc_init" and "generic_alloc_destroy"
>> for that, and rename the existing API with s/init/new/ and s/uninit/free/.
>
> Could you please add a sentence *why* you are doing this? ... without
> that information, this just looks like a lot of unnecessary code churn...
The explanation is simply that if you allocate them separately you have
to define a destructor function to free it---more boilerplate and more
stuff that you can get wrong. Therefore qgraph tries to use embedded
structs when something is always there (a "contains" edge).
The same is true for 16/71, you want to use heap-allocated PCI buses for
non-qgraph tests, but for a qgraph machine it would be very much
preferrable to embed it in the PCI host bridge QOSGraphObject.
Paolo
- [Qemu-devel] [PATCH 17/71] tests: remove rule for nonexisting qdev-monitor-test, (continued)
- [Qemu-devel] [PATCH 17/71] tests: remove rule for nonexisting qdev-monitor-test, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 16/71] tests/libqos: rename qpci_init_pc and qpci_init_spapr functions, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 15/71] tests/libqos: introduce virtio_start_device, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 13/71] vhost-user-test: small changes to init_hugepagefs, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 18/71] tests/libqos: embed allocators instead of malloc-ing them, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 22/71] tests/libqos: sdhci driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 21/71] tests/libqos: x86_64/pc machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 23/71] tests/libqos: arm/raspi2 machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 24/71] tests/libqos: arm/smdkc210 machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 20/71] tests/libqos: pci-pc driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 28/71] qos-test: sdhci test node, Paolo Bonzini, 2018/12/03