blob: 948ef47a4d3e01a940c7701ba2f51dcf6bfc83c4 [file] [log] [blame]
Paolo Bonzinif42b2202012-06-09 04:01:51 +02001/*
2 * QEMU aio implementation
3 *
4 * Copyright IBM Corp., 2008
5 * Copyright Red Hat Inc., 2012
6 *
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 * Paolo Bonzini <pbonzini@redhat.com>
10 *
11 * This work is licensed under the terms of the GNU GPL, version 2. See
12 * the COPYING file in the top-level directory.
13 *
14 * Contributions after 2012-01-13 are licensed under the terms of the
15 * GNU GPL, version 2 or (at your option) any later version.
16 */
17
Peter Maydelld38ea872016-01-29 17:50:05 +000018#include "qemu/osdep.h"
Paolo Bonzini737e1502012-12-17 18:19:44 +010019#include "block/block.h"
Volker Rümelineada6d92020-10-21 08:40:33 +020020#include "qemu/main-loop.h"
Paolo Bonzini1de7afc2012-12-17 18:20:00 +010021#include "qemu/queue.h"
22#include "qemu/sockets.h"
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +000023#include "qapi/error.h"
Paolo Bonzinib92d9a92017-01-12 19:07:58 +010024#include "qemu/rcu_queue.h"
Marc-André Lureaue2a3a212023-02-21 16:47:54 +040025#include "qemu/error-report.h"
Paolo Bonzinif42b2202012-06-09 04:01:51 +020026
27struct AioHandler {
28 EventNotifier *e;
Paolo Bonzinib4933172014-07-09 11:53:10 +020029 IOHandler *io_read;
30 IOHandler *io_write;
Paolo Bonzinif42b2202012-06-09 04:01:51 +020031 EventNotifierHandler *io_notify;
Paolo Bonzinif42b2202012-06-09 04:01:51 +020032 GPollFD pfd;
33 int deleted;
Paolo Bonzinib4933172014-07-09 11:53:10 +020034 void *opaque;
Paolo Bonzinif42b2202012-06-09 04:01:51 +020035 QLIST_ENTRY(AioHandler) node;
36};
37
Remy Noelfef16602018-12-20 16:20:30 +010038static void aio_remove_fd_handler(AioContext *ctx, AioHandler *node)
39{
Yonggang Luoda0652c2020-09-16 01:12:26 +080040 /*
41 * If the GSource is in the process of being destroyed then
42 * g_source_remove_poll() causes an assertion failure. Skip
43 * removal in that case, because glib cleans up its state during
44 * destruction anyway.
45 */
46 if (!g_source_is_destroyed(&ctx->source)) {
47 g_source_remove_poll(&ctx->source, &node->pfd);
48 }
49
Remy Noelfef16602018-12-20 16:20:30 +010050 /* If aio_poll is in progress, just mark the node as deleted */
51 if (qemu_lockcnt_count(&ctx->list_lock)) {
52 node->deleted = 1;
53 node->pfd.revents = 0;
54 } else {
55 /* Otherwise, delete it for real. We can't just mark it as
56 * deleted because deleted nodes are only cleaned up after
57 * releasing the list_lock.
58 */
59 QLIST_REMOVE(node, node);
60 g_free(node);
61 }
62}
63
Paolo Bonzinib4933172014-07-09 11:53:10 +020064void aio_set_fd_handler(AioContext *ctx,
65 int fd,
66 IOHandler *io_read,
67 IOHandler *io_write,
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +000068 AioPollFn *io_poll,
Stefan Hajnoczi826cc322021-12-07 13:23:31 +000069 IOHandler *io_poll_ready,
Paolo Bonzinib4933172014-07-09 11:53:10 +020070 void *opaque)
71{
Remy Noelfef16602018-12-20 16:20:30 +010072 AioHandler *old_node;
73 AioHandler *node = NULL;
Marc-André Lureauabe34282023-02-21 16:47:59 +040074 SOCKET s;
Paolo Bonzinib4933172014-07-09 11:53:10 +020075
Marc-André Lureaue2a3a212023-02-21 16:47:54 +040076 if (!fd_is_socket(fd)) {
77 error_report("fd=%d is not a socket, AIO implementation is missing", fd);
78 return;
79 }
80
Marc-André Lureauabe34282023-02-21 16:47:59 +040081 s = _get_osfhandle(fd);
82
Paolo Bonzinib92d9a92017-01-12 19:07:58 +010083 qemu_lockcnt_lock(&ctx->list_lock);
Remy Noelfef16602018-12-20 16:20:30 +010084 QLIST_FOREACH(old_node, &ctx->aio_handlers, node) {
Marc-André Lureauabe34282023-02-21 16:47:59 +040085 if (old_node->pfd.fd == s && !old_node->deleted) {
Paolo Bonzinib4933172014-07-09 11:53:10 +020086 break;
87 }
88 }
89
Remy Noelfef16602018-12-20 16:20:30 +010090 if (io_read || io_write) {
Paolo Bonzinib4933172014-07-09 11:53:10 +020091 HANDLE event;
Alistair Francis55d41b12017-07-06 13:15:14 -070092 long bitmask = 0;
Paolo Bonzinib4933172014-07-09 11:53:10 +020093
Remy Noelfef16602018-12-20 16:20:30 +010094 /* Alloc and insert if it's not already there */
95 node = g_new0(AioHandler, 1);
Marc-André Lureauabe34282023-02-21 16:47:59 +040096 node->pfd.fd = s;
Paolo Bonzinib4933172014-07-09 11:53:10 +020097
98 node->pfd.events = 0;
99 if (node->io_read) {
100 node->pfd.events |= G_IO_IN;
101 }
102 if (node->io_write) {
103 node->pfd.events |= G_IO_OUT;
104 }
105
106 node->e = &ctx->notifier;
107
108 /* Update handler with latest information */
109 node->opaque = opaque;
110 node->io_read = io_read;
111 node->io_write = io_write;
112
Alistair Francis55d41b12017-07-06 13:15:14 -0700113 if (io_read) {
114 bitmask |= FD_READ | FD_ACCEPT | FD_CLOSE;
115 }
116
117 if (io_write) {
118 bitmask |= FD_WRITE | FD_CONNECT;
119 }
120
Remy Noelfef16602018-12-20 16:20:30 +0100121 QLIST_INSERT_HEAD_RCU(&ctx->aio_handlers, node, node);
Paolo Bonzinib4933172014-07-09 11:53:10 +0200122 event = event_notifier_get_handle(&ctx->notifier);
Marc-André Lureauabe34282023-02-21 16:47:59 +0400123 qemu_socket_select(fd, event, bitmask, NULL);
Paolo Bonzinib4933172014-07-09 11:53:10 +0200124 }
Remy Noelfef16602018-12-20 16:20:30 +0100125 if (old_node) {
126 aio_remove_fd_handler(ctx, old_node);
127 }
Paolo Bonzinib4933172014-07-09 11:53:10 +0200128
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100129 qemu_lockcnt_unlock(&ctx->list_lock);
Paolo Bonzinib4933172014-07-09 11:53:10 +0200130 aio_notify(ctx);
131}
132
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200133void aio_set_event_notifier(AioContext *ctx,
134 EventNotifier *e,
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +0000135 EventNotifierHandler *io_notify,
Stefan Hajnoczi826cc322021-12-07 13:23:31 +0000136 AioPollFn *io_poll,
137 EventNotifierHandler *io_poll_ready)
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200138{
139 AioHandler *node;
140
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100141 qemu_lockcnt_lock(&ctx->list_lock);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200142 QLIST_FOREACH(node, &ctx->aio_handlers, node) {
143 if (node->e == e && !node->deleted) {
144 break;
145 }
146 }
147
148 /* Are we deleting the fd handler? */
149 if (!io_notify) {
150 if (node) {
Remy Noelfef16602018-12-20 16:20:30 +0100151 aio_remove_fd_handler(ctx, node);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200152 }
153 } else {
154 if (node == NULL) {
155 /* Alloc and insert if it's not already there */
Markus Armbruster3ba235a2014-12-04 13:55:09 +0100156 node = g_new0(AioHandler, 1);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200157 node->e = e;
158 node->pfd.fd = (uintptr_t)event_notifier_get_handle(e);
159 node->pfd.events = G_IO_IN;
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100160 QLIST_INSERT_HEAD_RCU(&ctx->aio_handlers, node, node);
Paolo Bonzinie3713e02012-09-24 14:57:41 +0200161
162 g_source_add_poll(&ctx->source, &node->pfd);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200163 }
164 /* Update handler with latest information */
165 node->io_notify = io_notify;
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200166 }
Paolo Bonzini7ed2b242012-09-25 10:22:39 +0200167
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100168 qemu_lockcnt_unlock(&ctx->list_lock);
Paolo Bonzini7ed2b242012-09-25 10:22:39 +0200169 aio_notify(ctx);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200170}
171
Stefan Hajnoczi684e5082016-12-01 19:26:49 +0000172void aio_set_event_notifier_poll(AioContext *ctx,
173 EventNotifier *notifier,
174 EventNotifierHandler *io_poll_begin,
175 EventNotifierHandler *io_poll_end)
176{
177 /* Not implemented */
178}
179
Paolo Bonzinia3462c62014-07-09 11:53:08 +0200180bool aio_prepare(AioContext *ctx)
181{
Paolo Bonzinib4933172014-07-09 11:53:10 +0200182 static struct timeval tv0;
183 AioHandler *node;
184 bool have_select_revents = false;
185 fd_set rfds, wfds;
186
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100187 /*
188 * We have to walk very carefully in case aio_set_fd_handler is
189 * called while we're walking.
190 */
191 qemu_lockcnt_inc(&ctx->list_lock);
192
Paolo Bonzinib4933172014-07-09 11:53:10 +0200193 /* fill fd sets */
194 FD_ZERO(&rfds);
195 FD_ZERO(&wfds);
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100196 QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
Paolo Bonzinib4933172014-07-09 11:53:10 +0200197 if (node->io_read) {
198 FD_SET ((SOCKET)node->pfd.fd, &rfds);
199 }
200 if (node->io_write) {
201 FD_SET ((SOCKET)node->pfd.fd, &wfds);
202 }
203 }
204
205 if (select(0, &rfds, &wfds, NULL, &tv0) > 0) {
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100206 QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
Paolo Bonzinib4933172014-07-09 11:53:10 +0200207 node->pfd.revents = 0;
208 if (FD_ISSET(node->pfd.fd, &rfds)) {
209 node->pfd.revents |= G_IO_IN;
210 have_select_revents = true;
211 }
212
213 if (FD_ISSET(node->pfd.fd, &wfds)) {
214 node->pfd.revents |= G_IO_OUT;
215 have_select_revents = true;
216 }
217 }
218 }
219
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100220 qemu_lockcnt_dec(&ctx->list_lock);
Paolo Bonzinib4933172014-07-09 11:53:10 +0200221 return have_select_revents;
Paolo Bonzinia3462c62014-07-09 11:53:08 +0200222}
223
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200224bool aio_pending(AioContext *ctx)
225{
226 AioHandler *node;
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100227 bool result = false;
Paolo Bonziniabf90d32017-01-12 19:07:56 +0100228
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200229 /*
Paolo Bonzini87f68d32014-07-07 15:18:02 +0200230 * We have to walk very carefully in case aio_set_fd_handler is
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200231 * called while we're walking.
232 */
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100233 qemu_lockcnt_inc(&ctx->list_lock);
234 QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
235 if (node->pfd.revents && node->io_notify) {
236 result = true;
237 break;
238 }
239
240 if ((node->pfd.revents & G_IO_IN) && node->io_read) {
241 result = true;
242 break;
243 }
244 if ((node->pfd.revents & G_IO_OUT) && node->io_write) {
245 result = true;
246 break;
247 }
248 }
249
250 qemu_lockcnt_dec(&ctx->list_lock);
251 return result;
252}
253
254static bool aio_dispatch_handlers(AioContext *ctx, HANDLE event)
255{
256 AioHandler *node;
257 bool progress = false;
258 AioHandler *tmp;
259
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100260 /*
261 * We have to walk very carefully in case aio_set_fd_handler is
262 * called while we're walking.
263 */
264 QLIST_FOREACH_SAFE_RCU(node, &ctx->aio_handlers, node, tmp) {
Paolo Bonzinib4933172014-07-09 11:53:10 +0200265 int revents = node->pfd.revents;
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200266
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200267 if (!node->deleted &&
Paolo Bonzinib4933172014-07-09 11:53:10 +0200268 (revents || event_notifier_get_handle(node->e) == event) &&
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200269 node->io_notify) {
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200270 node->pfd.revents = 0;
271 node->io_notify(node->e);
Stefan Hajnoczi164a1012013-04-11 16:56:50 +0200272
273 /* aio_notify() does not count as progress */
Stefan Hajnoczi8b2d42d2013-08-22 15:28:35 +0200274 if (node->e != &ctx->notifier) {
Stefan Hajnoczi164a1012013-04-11 16:56:50 +0200275 progress = true;
276 }
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200277 }
278
Paolo Bonzinib4933172014-07-09 11:53:10 +0200279 if (!node->deleted &&
280 (node->io_read || node->io_write)) {
281 node->pfd.revents = 0;
282 if ((revents & G_IO_IN) && node->io_read) {
283 node->io_read(node->opaque);
284 progress = true;
285 }
286 if ((revents & G_IO_OUT) && node->io_write) {
287 node->io_write(node->opaque);
288 progress = true;
289 }
290
291 /* if the next select() will return an event, we have progressed */
292 if (event == event_notifier_get_handle(&ctx->notifier)) {
293 WSANETWORKEVENTS ev;
294 WSAEnumNetworkEvents(node->pfd.fd, event, &ev);
295 if (ev.lNetworkEvents) {
296 progress = true;
297 }
298 }
299 }
300
Paolo Bonziniabf90d32017-01-12 19:07:56 +0100301 if (node->deleted) {
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100302 if (qemu_lockcnt_dec_if_lock(&ctx->list_lock)) {
Paolo Bonziniabf90d32017-01-12 19:07:56 +0100303 QLIST_REMOVE(node, node);
304 g_free(node);
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100305 qemu_lockcnt_inc_and_unlock(&ctx->list_lock);
Paolo Bonziniabf90d32017-01-12 19:07:56 +0100306 }
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200307 }
308 }
309
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200310 return progress;
311}
312
Paolo Bonzinia153bf52017-02-13 14:52:33 +0100313void aio_dispatch(AioContext *ctx)
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200314{
Paolo Bonzinibd451432017-02-13 14:52:34 +0100315 qemu_lockcnt_inc(&ctx->list_lock);
Paolo Bonzinia153bf52017-02-13 14:52:33 +0100316 aio_bh_poll(ctx);
317 aio_dispatch_handlers(ctx, INVALID_HANDLE_VALUE);
Paolo Bonzinibd451432017-02-13 14:52:34 +0100318 qemu_lockcnt_dec(&ctx->list_lock);
Paolo Bonzinia153bf52017-02-13 14:52:33 +0100319 timerlistgroup_run_timers(&ctx->tlg);
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200320}
321
322bool aio_poll(AioContext *ctx, bool blocking)
323{
324 AioHandler *node;
Bin Menge0d034b2022-10-19 18:20:15 +0800325 HANDLE events[MAXIMUM_WAIT_OBJECTS];
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200326 bool progress, have_select_revents, first;
Bin Menge0d034b2022-10-19 18:20:15 +0800327 unsigned count;
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200328 int timeout;
329
Paolo Bonzini5710a3e2020-04-07 10:07:46 -0400330 /*
331 * There cannot be two concurrent aio_poll calls for the same AioContext (or
332 * an aio_poll concurrent with a GSource prepare/check/dispatch callback).
333 * We rely on this below to avoid slow locked accesses to ctx->notify_me.
Volker Rümelineada6d92020-10-21 08:40:33 +0200334 *
335 * aio_poll() may only be called in the AioContext's thread. iohandler_ctx
336 * is special in that it runs in the main thread, but that thread's context
337 * is qemu_aio_context.
Paolo Bonzini5710a3e2020-04-07 10:07:46 -0400338 */
Volker Rümelineada6d92020-10-21 08:40:33 +0200339 assert(in_aio_context_home_thread(ctx == iohandler_get_aio_context() ?
340 qemu_get_aio_context() : ctx));
Paolo Bonzinia398dea2014-07-09 11:53:03 +0200341 progress = false;
342
Paolo Bonzini0a9dd162014-07-09 11:53:07 +0200343 /* aio_notify can avoid the expensive event_notifier_set if
344 * everything (file descriptors, bottom halves, timers) will
345 * be re-evaluated before the next blocking poll(). This is
346 * already true when aio_poll is called with blocking == false;
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200347 * if blocking == true, it is only true after poll() returns,
348 * so disable the optimization now.
Paolo Bonzini0a9dd162014-07-09 11:53:07 +0200349 */
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200350 if (blocking) {
Stefan Hajnoczid73415a2020-09-23 11:56:46 +0100351 qatomic_set(&ctx->notify_me, qatomic_read(&ctx->notify_me) + 2);
Paolo Bonzini5710a3e2020-04-07 10:07:46 -0400352 /*
353 * Write ctx->notify_me before computing the timeout
354 * (reading bottom half flags, etc.). Pairs with
355 * smp_mb in aio_notify().
356 */
357 smp_mb();
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200358 }
Paolo Bonzini0a9dd162014-07-09 11:53:07 +0200359
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100360 qemu_lockcnt_inc(&ctx->list_lock);
Paolo Bonzini6493c972015-07-21 16:07:50 +0200361 have_select_revents = aio_prepare(ctx);
362
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200363 /* fill fd sets */
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200364 count = 0;
Paolo Bonzinib92d9a92017-01-12 19:07:58 +0100365 QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
Stefan Hajnoczi60f782b2023-05-16 15:02:38 -0400366 if (!node->deleted && node->io_notify) {
Bin Menge0d034b2022-10-19 18:20:15 +0800367 assert(count < MAXIMUM_WAIT_OBJECTS);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200368 events[count++] = event_notifier_get_handle(node->e);
369 }
370 }
371
Paolo Bonzini3672fa52014-07-09 11:53:04 +0200372 first = true;
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200373
Paolo Bonzini6493c972015-07-21 16:07:50 +0200374 /* ctx->notifier is always registered. */
375 assert(count > 0);
376
377 /* Multiple iterations, all of them non-blocking except the first,
378 * may be necessary to process all pending events. After the first
379 * WaitForMultipleObjects call ctx->notify_me will be decremented.
380 */
381 do {
Paolo Bonzinib4933172014-07-09 11:53:10 +0200382 HANDLE event;
Alex Bligh438e1f42013-08-21 16:02:53 +0100383 int ret;
384
Paolo Bonzini6493c972015-07-21 16:07:50 +0200385 timeout = blocking && !have_select_revents
Paolo Bonzini845ca102014-07-09 11:53:01 +0200386 ? qemu_timeout_ns_to_ms(aio_compute_timeout(ctx)) : 0;
Alex Bligh438e1f42013-08-21 16:02:53 +0100387 ret = WaitForMultipleObjects(count, events, FALSE, timeout);
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200388 if (blocking) {
389 assert(first);
Stefan Hajnoczid73415a2020-09-23 11:56:46 +0100390 qatomic_store_release(&ctx->notify_me,
391 qatomic_read(&ctx->notify_me) - 2);
Fam Zhengb37548f2018-08-09 21:22:59 +0800392 aio_notify_accept(ctx);
Paolo Bonzinieabc9772015-07-21 16:07:51 +0200393 }
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200394
Paolo Bonzini21a03d12015-07-21 16:07:52 +0200395 if (first) {
Paolo Bonzini21a03d12015-07-21 16:07:52 +0200396 progress |= aio_bh_poll(ctx);
397 first = false;
Paolo Bonzini3672fa52014-07-09 11:53:04 +0200398 }
Paolo Bonzini3672fa52014-07-09 11:53:04 +0200399
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200400 /* if we have any signaled events, dispatch event */
Paolo Bonzinib4933172014-07-09 11:53:10 +0200401 event = NULL;
402 if ((DWORD) (ret - WAIT_OBJECT_0) < count) {
403 event = events[ret - WAIT_OBJECT_0];
Paolo Bonzinia90d4112014-09-15 14:52:58 +0200404 events[ret - WAIT_OBJECT_0] = events[--count];
Paolo Bonzinib4933172014-07-09 11:53:10 +0200405 } else if (!have_select_revents) {
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200406 break;
407 }
408
Paolo Bonzinib4933172014-07-09 11:53:10 +0200409 have_select_revents = false;
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200410 blocking = false;
411
Paolo Bonzinib4933172014-07-09 11:53:10 +0200412 progress |= aio_dispatch_handlers(ctx, event);
Paolo Bonzini6493c972015-07-21 16:07:50 +0200413 } while (count > 0);
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200414
Paolo Bonzinibd451432017-02-13 14:52:34 +0100415 qemu_lockcnt_dec(&ctx->list_lock);
416
Paolo Bonzinie4c7e2d2014-07-09 11:53:05 +0200417 progress |= timerlistgroup_run_timers(&ctx->tlg);
Stefan Hajnoczi164a1012013-04-11 16:56:50 +0200418 return progress;
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200419}
Fam Zheng37fcee52015-10-30 12:06:28 +0800420
Cao jin7e003462016-07-15 18:28:44 +0800421void aio_context_setup(AioContext *ctx)
Fam Zheng37fcee52015-10-30 12:06:28 +0800422{
423}
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +0000424
Jie Wangcd0a6d22018-05-17 08:42:43 +0800425void aio_context_destroy(AioContext *ctx)
426{
427}
428
Stefan Hajnocziba607ca2020-05-11 19:36:30 +0100429void aio_context_use_g_source(AioContext *ctx)
430{
431}
432
Stefan Hajnoczi82a41182016-12-01 19:26:51 +0000433void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
434 int64_t grow, int64_t shrink, Error **errp)
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +0000435{
Peter Xu90c558b2018-03-22 16:56:30 +0800436 if (max_ns) {
437 error_setg(errp, "AioContext polling is not implemented on Windows");
438 }
Stefan Hajnoczi4a1cba32016-12-01 19:26:42 +0000439}
Stefano Garzarella1793ad02021-07-21 11:42:10 +0200440
441void aio_context_set_aio_params(AioContext *ctx, int64_t max_batch,
442 Error **errp)
443{
444}