qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

test-thread-pool: use generic AioContext infrastructure

Once the thread pool starts using aio_co_wake, it will also need
qemu_get_current_aio_context(). Make test-thread-pool create
an AioContext with qemu_init_main_loop, so that stubs/iothread.c
and tests/iothread.c can provide the rest.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20170213135235.12274-5-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

authored by

Paolo Bonzini and committed by
Stefan Hajnoczi
934ebf48 35f106e6

+3 -9
+3 -9
tests/test-thread-pool.c
··· 6 6 #include "qapi/error.h" 7 7 #include "qemu/timer.h" 8 8 #include "qemu/error-report.h" 9 + #include "qemu/main-loop.h" 9 10 10 11 static AioContext *ctx; 11 12 static ThreadPool *pool; ··· 224 225 int main(int argc, char **argv) 225 226 { 226 227 int ret; 227 - Error *local_error = NULL; 228 228 229 - init_clocks(); 230 - 231 - ctx = aio_context_new(&local_error); 232 - if (!ctx) { 233 - error_reportf_err(local_error, "Failed to create AIO Context: "); 234 - exit(1); 235 - } 229 + qemu_init_main_loop(&error_abort); 230 + ctx = qemu_get_current_aio_context(); 236 231 pool = aio_get_thread_pool(ctx); 237 232 238 233 g_test_init(&argc, &argv, NULL); ··· 245 240 246 241 ret = g_test_run(); 247 242 248 - aio_context_unref(ctx); 249 243 return ret; 250 244 }