Coroutines: Audit use of "coroutine_fn" specifier
QEMU uses coroutines for asynchronous operations, especially in the block layer (disk I/O, disk image formats, network storage protocols, etc). The basics of coroutines are explained here: http://blog.vmsplice.net/2014/01/coroutines-in-qemu-basics.html
All functions that may yield (either directly or indirectly through a function they call) must be marked coroutine_fn
in their function signature. There is no build-time check for coroutine_fn, so it is accidentally missing in some places. Search the code for function names that contain co or end with _co() or functions that call qemu_coroutine_yield(), qemu_co_queue_wait(), or any other coroutine_fn. Add coroutine_fn to the function signature if it is missing.
A future task that is less bite-sized involves improving the compiler toolchain to enforce the presence of this specifier for any coroutine. One idea for how to accomplish this is to #define coroutine_fn
to be __attribute__((section(".coro")))
and use ELF sections to create a section specifically for coroutine functions. @stefanha has suggested that the linux kernel toolchain may have a build script that performs similar verification.