fdmon-poll: reset npfd when upgrading to fdmon-epoll
v2 cover fdmon-poll: reset npfd when upgrading to fdmon-epoll
v2:
* Rebased onto qemu.git/master for meson
Fix an assertion failure when aio_poll() is called in a aio_disable_external() region. The failure happens when fdmon-poll is first upgraded to fdmon-epoll and then downgraded again due to aio_disable_external().
Stefan Hajnoczi (2):
fdmon-poll: reset npfd when upgrading to fdmon-epoll
tests: add test-fdmon-epoll
MAINTAINERS | 1 + tests/test-fdmon-epoll.c | 73 ++++++++++++++++++++++++++++++++++++++++ util/fdmon-poll.c | 1 + tests/meson.build | 3 ++ 4 files changed, 78 insertions(+) create mode 100644 tests/test-fdmon-epoll.c
Signature · 1 line
2.26.2
PATCH v2 1/2 fdmon-poll: reset npfd when upgrading to fdmon-epoll
npfd keeps track of how many pollfds are currently being monitored. It must be reset to 0 when fdmon_poll_wait() returns.
When npfd reaches a treshold we switch to fdmon-epoll because it scales better.
This patch resets npfd in the case where we switch to fdmon-epoll. Forgetting to do so results in the following assertion failure:
util/fdmon-poll.c:65: fdmon_poll_wait: Assertion `npfd == 0' failed.
--- util/fdmon-poll.c | 1 + 1 file changed, 1 insertion(+)
util/fdmon-poll.c +1 -0
@@ -73,6 +73,7 @@ static int fdmon_poll_wait(AioContext *ctx, AioHandlerList *ready_list,/* epoll(7) is faster above a certain number of fds */ if (fdmon_epoll_try_upgrade (ctx, npfd)) { + npfd =0 ;/* we won't need pollfds[], reset npfd */ return ctx->fdmon_ops->wait (ctx, ready_list, timeout); }
Signature · 1 line
2.26.2
PATCH v2 2/2 tests: add test-fdmon-epoll
In reply to Stefan HajnocziTest aio_disable_external(), which switches from fdmon-epoll back to fdmon-poll. This resulted in an assertion failure that was fixed in the previous patch.
--- MAINTAINERS | 1 + tests/test-fdmon-epoll.c | 73 ++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 3 ++ 3 files changed, 77 insertions(+) create mode 100644 tests/test-fdmon-epoll.c
MAINTAINERS +1 -0
@@ -2132,6 +2132,7 @@ F: migration/block* F: include/block/aio.h F: include/block/aio-wait.h F: scripts/qemugdb/aio.py +F: tests/test-fdmon-epoll.c T: git https://github.com/stefanha/qemu.git block Block SCSI subsystem
tests/test-fdmon-epoll.c new file +73 -0
73 lines not on this page · raw message
tests/meson.build +3 -0
@@ -169,6 +169,9 @@ if have_block if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host tests += {'test-crypto-pbkdf': [io]} endif + if 'CONFIG_EPOLL_CREATE1' in config_host + tests += {'test-fdmon-epoll': [testblock]} + endif benchs += { 'benchmark-crypto-hash': [crypto], 'benchmark-crypto-hmac': [crypto],
Signature · 1 line
2.26.2
Stefan Hajnoczi
AppliedQuoted 11 lines · Stefan Hajnoczi
v2:
* Rebased onto qemu.git/master for mesonFix an assertion failure when
aio_poll()is called in aaio_disable_external()region. The failure happens when fdmon-poll is first upgraded to fdmon-epoll and then downgraded again due toaio_disable_external().Stefan Hajnoczi (2):
fdmon-poll: reset npfd when upgrading to fdmon-epoll
tests: add test-fdmon-epoll
Quoted 10 lines
MAINTAINERS | 1 + tests/test-fdmon-epoll.c | 73 ++++++++++++++++++++++++++++++++++++++++ util/fdmon-poll.c | 1 + tests/meson.build | 3 ++ 4 files changed, 78 insertions(+) create mode 100644 tests/test-fdmon-epoll.cSignature · 1 line
2.26.2
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan