Instead I suggest to serialize qemu monitor commands. My original motivation is to prepare job exclusion code to add agent jobs. This job is a special job to operate on guest agent only so first it can be run in parallel with sync, async and nested jobs and second it should not block any qemu monitor job at all. Eventually I want to move from a lot of different types of jobs to just a job with some kind of matrix which describes what jobs can run in a parallel. As a first step I want to drop nested jobs. AFAIU *main* nested job purpuse is to serialize requests to monitor from async jobs and allowed sync jobs as monitor does not do it by himself now. Strictly speaking this assertion is rather rough because nested jobs and sync jobs serialized at job level and thus chunks of code that serialized differ from case when only monitor requests are serialized. Nevertheless IFAIU this part of libvirt is not strict too. We have a lot of query commands and async commands that can execute in parallel and have no definition of what query job or async job are. Thus it is not clear is this code correct or not. So the same argument is applicable to new approach: query jobs are safe to be called during async jobs. (Except that new approach opens situation when async job interrupts query job itself but it generally not clear how this can break query job). On this path job became high level concept which I think it should be. Also we drop boring passing of current async job which we need only for safety check deep down below the stack. We drop driver passing for nested jobs which I guess we really don't need to pass at all as we need it only to check queue size and nested job probably should skip this check. The diff stat looks large but most of code is dumb renaming or dropping unused parameter in patches 4 and 5. To reduce risk of introducing an error on this tedious task I used sed and perl where I can. I ran only a simple test with this series of quering a domain during its migration. Nikolay Shirokovskiy (5): qemu: monitor: serialize send command requests qemu: job: drop nested job qemu: monitor: add closed monitor flag qemu: drop driver parameter on domain enter/exit monitor qemu: drop qemuDomainObjEnterMonitorAsync src/qemu/qemu_domain.c | 154 ++++--------------- src/qemu/qemu_domain.h | 43 ++---- src/qemu/qemu_driver.c | 374 ++++++++++++++++++++-------------------------- src/qemu/qemu_hotplug.c | 282 ++++++++++++++++------------------ src/qemu/qemu_hotplug.h | 21 +-- src/qemu/qemu_migration.c | 292 +++++++++++++----------------------- src/qemu/qemu_migration.h | 7 +- src/qemu/qemu_monitor.c | 93 ++++++++++-- src/qemu/qemu_process.c | 279 +++++++++++++--------------------- src/qemu/qemu_process.h | 20 +-- tests/qemuhotplugtest.c | 2 +- 11 files changed, 636 insertions(+), 931 deletions(-) -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list