Our reference locking for objects is great and powerful thing. The
problem is that it was either not followed through completely or the
design was not complete, but it doesn't matter now. There are few
bugs in the code due to the reference counting and the daemon is
lacking some performance in specific scenarios.
This "series" tried to fix that using the following idea:
- Each API working with a domain object that has to get it from the
list will have its *own* reference, not borrowed one from the list.
- When adding a domain into the list, the reference counter is
increased (this is the reference that is there just for being in
the list) and when being removed, it is decreased. No
special-casing of "if this is was the last reference" and other
funny stuff.
- When job is created, there is no need to increase the reference
counter as there are at least two references for the domain:
1) The API that created the job has one, so if it's not async it
will be kept until the API ends and at that point the job won't
exist any more.
2) The domain list has one and even though I said nobody needs to
rely on that, async APIs probably will do that, but there's an
excuse for that. In order to remove the domain from the list,
you need a job and that won't succeed unless the async one
ended. So we're good in this case as well.
After searching through the code for all things that needed to be
removed and fixing everything I could possibly think of, I tried a few
things on my setup and it looks like it works. However, I haven't
tried *every single API*, but I hope that's understandable. On the
other hand, I asked Pavel to try running virt-test with these patches
applied, hopefully we'll get an idea about how reliable this "series"
is.
I used "series" (with quotes) on purpose, because first patch just
adds two new wrappers for slightly modified function and the second
one changes the whole qemu driver at once. Unfortunately the second
patch couldn't be broken up to more parts due to the nature of the
fix.
Enough chit-chat, let's look at the codes!
Martin Kletzander (2):
conf: Rework virDomainObjListFindByUUID to allow more concurrent APIs
qemu: completely rework reference counting
src/conf/domain_conf.c | 27 +-
src/conf/domain_conf.h | 2 +
src/libvirt_private.syms | 1 +
src/qemu/THREADS.txt | 40 ++-
src/qemu/qemu_domain.c | 28 +-
src/qemu/qemu_domain.h | 12 +-
src/qemu/qemu_driver.c | 708 ++++++++++++++++------------------------------
src/qemu/qemu_migration.c | 108 +++----
src/qemu/qemu_migration.h | 10 +-
src/qemu/qemu_process.c | 126 ++++-----
10 files changed, 406 insertions(+), 656 deletions(-)
--
2.1.3