[PATCH v2 0/2] Rework reference counting in QEMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


Martin Kletzander (2):
  conf: Rework virDomainObjListFindByUUID to allow more concurrent APIs
  qemu: completely rework reference counting

 src/conf/domain_conf.c    |  29 +-
 src/conf/domain_conf.h    |   2 +
 src/libvirt_private.syms  |   1 +
 src/qemu/THREADS.txt      |  40 ++-
 src/qemu/qemu_domain.c    |  49 ++--
 src/qemu/qemu_domain.h    |  12 +-
 src/qemu/qemu_driver.c    | 708 ++++++++++++++++------------------------------
 src/qemu/qemu_migration.c | 111 +++-----
 src/qemu/qemu_migration.h |  10 +-
 src/qemu/qemu_process.c   |  77 ++---
 10 files changed, 400 insertions(+), 639 deletions(-)

--
2.2.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]