qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

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