diff options
author | Peter Maydell | 2017-11-21 18:05:49 +0100 |
---|---|---|
committer | Peter Maydell | 2017-11-21 18:05:49 +0100 |
commit | 64807cd77938885f681a9a18b5736e923ad50b7c (patch) | |
tree | 7785670f2bc440477c5727b73766685017f6feee /util/qemu-coroutine.c | |
parent | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (diff) | |
parent | qemu-iotest: add test for blockjob coroutine race condition (diff) | |
download | qemu-64807cd77938885f681a9a18b5736e923ad50b7c.tar.gz qemu-64807cd77938885f681a9a18b5736e923ad50b7c.tar.xz qemu-64807cd77938885f681a9a18b5736e923ad50b7c.zip |
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
# gpg: Signature made Tue 21 Nov 2017 17:01:33 GMT
# gpg: using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg: aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg: aka "Jeffrey Cody <codyprime@gmail.com>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057
* remotes/cody/tags/block-pull-request:
qemu-iotest: add test for blockjob coroutine race condition
qemu-iotests: add option in common.qemu for mismatch only
coroutine: abort if we try to schedule or enter a pending coroutine
blockjob: do not allow coroutine double entry or entry-after-completion
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/qemu-coroutine.c')
-rw-r--r-- | util/qemu-coroutine.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c index d6095c1d5a..9eff7fd450 100644 --- a/util/qemu-coroutine.c +++ b/util/qemu-coroutine.c @@ -107,8 +107,22 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co) Coroutine *self = qemu_coroutine_self(); CoroutineAction ret; + /* Cannot rely on the read barrier for co in aio_co_wake(), as there are + * callers outside of aio_co_wake() */ + const char *scheduled = atomic_mb_read(&co->scheduled); + trace_qemu_aio_coroutine_enter(ctx, self, co, co->entry_arg); + /* if the Coroutine has already been scheduled, entering it again will + * cause us to enter it twice, potentially even after the coroutine has + * been deleted */ + if (scheduled) { + fprintf(stderr, + "%s: Co-routine was already scheduled in '%s'\n", + __func__, scheduled); + abort(); + } + if (co->caller) { fprintf(stderr, "Co-routine re-entered recursively\n"); abort(); |