From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVGdA-0006lU-8e for qemu-devel@nongnu.org; Fri, 07 Dec 2018 08:57:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVGd5-0003m5-Fx for qemu-devel@nongnu.org; Fri, 07 Dec 2018 08:57:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVGd3-0003Pe-IW for qemu-devel@nongnu.org; Fri, 07 Dec 2018 08:57:19 -0500 References: <1543851204-41186-1-git-send-email-pbonzini@redhat.com> <1543851204-41186-19-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 7 Dec 2018 14:57:07 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 18/71] tests/libqos: embed allocators instead of malloc-ing them List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-devel@nongnu.org Cc: Emanuele Giuseppe Esposito , Laurent Vivier 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