As discussed on the previous RFC[1] the thread-pool's dynamic thread management doesn't play well with real-time and latency sensitive systems. This series introduces a set of controls that'll permit achieving more deterministic behaviours, for example by fixing the pool's size.
We first introduce a new common interface to event loop configuration by moving iothread's already available properties into an abstract class called 'EventLooopBackend' and have both 'IOThread' and the newly created 'MainLoop' inherit the properties from that class. With this new configuration interface in place it's relatively simple to introduce new options to fix the even loop's thread pool sizes. The resulting QAPI looks like this: -object main-loop,id=main-loop,thread-pool-min=1,thread-pool-max=1 Note that all patches are bisect friendly and pass all the tests. [1] https://patchwork.ozlabs.org/project/qemu-devel/patch/20220202175234.656711-1-nsaen...@redhat.com/ --- Nicolas Saenz Julienne (3): util & iothread: Introduce event-loop abstract class util/main-loop: Introduce the main loop into QOM util/event-loop: Introduce options to set the thread pool size MAINTAINERS | 1 + include/block/aio.h | 11 +++ include/qemu/main-loop.h | 11 +++ include/sysemu/iothread.h | 11 +-- iothread.c | 171 ++++---------------------------------- qapi/qom.json | 14 ++-- qga/meson.build | 2 +- qom/meson.build | 1 + tests/unit/meson.build | 10 +-- util/async.c | 3 + util/event-loop.c | 168 +++++++++++++++++++++++++++++++++++++ util/event-loop.h | 45 ++++++++++ util/main-loop.c | 56 +++++++++++++ util/thread-pool.c | 41 ++++++++- 14 files changed, 368 insertions(+), 177 deletions(-) create mode 100644 util/event-loop.c create mode 100644 util/event-loop.h -- 2.35.1