aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/malloc.h
AgeCommit message (Collapse)Author
2020-01-12tests/libqos: Move the libqos files under tests/qtest/Thomas Huth
The qos stuff belongs to qtest, so move it into that directory, too. Message-Id: <20191218103059.11729-8-thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-03-07tests/libqos: embed allocators instead of malloc-ing them separatelyPaolo Bonzini
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/. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-02-14libqos: Use explicit QTestState for fw_cfg operationsEric Blake
Drop one more client of global_qtest by teaching all fw_cfg test functionality (invoked through alloc-pc) to pass in an explicit QTestState, adjusting all callers. In particular, fw_cfg-test had to reorder things to create the test state prior to creating the fw_cfg (and drop a pointless strdup in the meantime), but that test now no longer depends on global_qtest. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> [thuth: Fixed conflict wrt pc_alloc_init() in vhost-user-test.c] Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-02-23all: Clean up includesPeter Maydell
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-05-22libqos: Add migration helpersJohn Snow
libqos.c: -set_context for addressing which commands go where -migrate performs the actual migration malloc.c: - Structure of the allocator is adjusted slightly with a second-tier malloc to make swapping around the allocators easy when we "migrate" the lists from the source to the destination. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-4-git-send-email-jsnow@redhat.com
2015-02-16libqos/ahci: Add ahci_clean_memJohn Snow
Clean up guest memory being used in ahci_clean_mem, to be called during ahci_shutdown. With all guest memory leaks removed, add an option to the allocator to throw an assertion if a leak occurs. This test adds some sanity to both the AHCI library and the allocator. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-18-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos: Update QGuestAllocator to be opaqueJohn Snow
To avoid the architecture-specific implementations of the generic qtest allocator having to know about fields within the allocator, add a page_size setter method for users or arch specializations to use. The allocator will assume a default page_size for general use, but it can always be overridden. Since this was the last instance of code directly using properties of the QGuestAllocator object directly, modify the type to be opaque and move the structure inside of malloc.c. mlist_new, which was previously exported, is made static local to malloc.c, as it has no external users. [Peter Maydell <peter.maydell@linaro.org> reported the following clang warning: tests/libqos/malloc.c:35:3: warning: redefinition of typedef 'QGuestAllocator' is a C11 feature [-Wtypedef-redefinition] } QGuestAllocator; I converted typedef struct ... QGuestAllocator; to struct ...; --Stefan] Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Marc Marí <marc.mari.barcelo@gmail.com> Message-id: 1421698563-6977-7-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos: add alloc_init_flagsJohn Snow
Allow a generic interface to alloc_init_flags, not just through pc_alloc_init_flags. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1421698563-6977-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-02-16libqos: Split apart pc_alloc_initJohn Snow
Move the list-specific initialization over into malloc.c, to keep all of the list implementation details within the same file. The allocation and freeing of these structures are now both back within the same layer. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1421698563-6977-2-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-01-13libqos: Convert malloc-pc allocator to a generic allocatorMarc Marí
The allocator in malloc-pc has been extracted, so it can be used in every arch. This operation showed that both the alloc and free functions can be also generic. Because of this, the QGuestAllocator has been removed from is function to wrap the alloc and free function, and now just contains the allocator parameters. As a result, only the allocator initalizer and unitializer are arch dependent. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-15libqos: Change free function called in mallocMarc Marí
Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-17libqos: add malloc supportAnthony Liguori
This is a very simple allocator for the PC platform. It should be possible to add backends for other platforms. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-5-git-send-email-aliguori@us.ibm.com