diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-12-16 12:48:16 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-20 11:17:35 +0200 |
commit | 394b9407e4c515f96df6647d629ee28cbb86f07c (patch) | |
tree | 586b944f5e1f8c339a2b3b735082fe5e28009ab5 /migration/qemu-file.h | |
parent | 1dd91b22a620616cad08bee7efc29280121ff0da (diff) |
migration: mark mixed functions that can suspend
There should be no paths from a coroutine_fn to aio_poll, however in
practice coroutine_mixed_fn will call aio_poll in the !qemu_in_coroutine()
path. By marking mixed functions, we can track accurately the call paths
that execute entirely in coroutine context, and find more missing
coroutine_fn markers. This results in more accurate checks that
coroutine code does not end up blocking.
If the marking were extended transitively to all functions that call
these ones, static analysis could be done much more efficiently.
However, this is a start and makes it possible to use vrc's path-based
searches to find potential bugs where coroutine_fns call blocking functions.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration/qemu-file.h')
-rw-r--r-- | migration/qemu-file.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 9d0155a2a1..d16cd50448 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -108,8 +108,8 @@ bool qemu_file_is_writable(QEMUFile *f); #include "migration/qemu-file-types.h" -size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset); -size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size); +size_t coroutine_mixed_fn qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset); +size_t coroutine_mixed_fn qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size); ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream, const uint8_t *p, size_t size); int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src); @@ -119,7 +119,7 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src); * is; you aren't guaranteed to be able to peak to +n bytes unless you've * previously peeked +n-1. */ -int qemu_peek_byte(QEMUFile *f, int offset); +int coroutine_mixed_fn qemu_peek_byte(QEMUFile *f, int offset); void qemu_file_skip(QEMUFile *f, int size); /* * qemu_file_credit_transfer: |