diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-03-11 14:41:27 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-03-11 14:41:27 +0000 |
commit | 6e8a73e911f066527e775e04b98f31ebd19db600 (patch) | |
tree | e7e14f8a09d10c275e4d8164b8b3091fedcdbc46 /util/aio-posix.h | |
parent | ba29883206d92a29ad5a466e679ccfc2ee6132ef (diff) | |
parent | d37d0e365afb6825a90d8356fc6adcc1f58f40f3 (diff) |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request
# gpg: Signature made Wed 11 Mar 2020 12:40:36 GMT
# gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
aio-posix: remove idle poll handlers to improve scalability
aio-posix: support userspace polling of fd monitoring
aio-posix: add io_uring fd monitoring implementation
aio-posix: simplify FDMonOps->update() prototype
aio-posix: extract ppoll(2) and epoll(7) fd monitoring
aio-posix: move RCU_READ_LOCK() into run_poll_handlers()
aio-posix: completely stop polling when disabled
aio-posix: remove confusing QLIST_SAFE_REMOVE()
qemu/queue.h: clear linked list pointers on remove
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/aio-posix.h')
-rw-r--r-- | util/aio-posix.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/util/aio-posix.h b/util/aio-posix.h new file mode 100644 index 0000000000..c80c04506a --- /dev/null +++ b/util/aio-posix.h @@ -0,0 +1,81 @@ +/* + * AioContext POSIX event loop implementation internal APIs + * + * Copyright IBM, Corp. 2008 + * Copyright Red Hat, Inc. 2020 + * + * Authors: + * Anthony Liguori <aliguori@us.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#ifndef AIO_POSIX_H +#define AIO_POSIX_H + +#include "block/aio.h" + +struct AioHandler { + GPollFD pfd; + IOHandler *io_read; + IOHandler *io_write; + AioPollFn *io_poll; + IOHandler *io_poll_begin; + IOHandler *io_poll_end; + void *opaque; + QLIST_ENTRY(AioHandler) node; + QLIST_ENTRY(AioHandler) node_ready; /* only used during aio_poll() */ + QLIST_ENTRY(AioHandler) node_deleted; + QLIST_ENTRY(AioHandler) node_poll; +#ifdef CONFIG_LINUX_IO_URING + QSLIST_ENTRY(AioHandler) node_submitted; + unsigned flags; /* see fdmon-io_uring.c */ +#endif + int64_t poll_idle_timeout; /* when to stop userspace polling */ + bool is_external; +}; + +/* Add a handler to a ready list */ +void aio_add_ready_handler(AioHandlerList *ready_list, AioHandler *node, + int revents); + +extern const FDMonOps fdmon_poll_ops; + +#ifdef CONFIG_EPOLL_CREATE1 +bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd); +void fdmon_epoll_setup(AioContext *ctx); +void fdmon_epoll_disable(AioContext *ctx); +#else +static inline bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd) +{ + return false; +} + +static inline void fdmon_epoll_setup(AioContext *ctx) +{ +} + +static inline void fdmon_epoll_disable(AioContext *ctx) +{ +} +#endif /* !CONFIG_EPOLL_CREATE1 */ + +#ifdef CONFIG_LINUX_IO_URING +bool fdmon_io_uring_setup(AioContext *ctx); +void fdmon_io_uring_destroy(AioContext *ctx); +#else +static inline bool fdmon_io_uring_setup(AioContext *ctx) +{ + return false; +} + +static inline void fdmon_io_uring_destroy(AioContext *ctx) +{ +} +#endif /* !CONFIG_LINUX_IO_URING */ + +#endif /* AIO_POSIX_H */ |