[libvirt] PATCH: 0/5: Experimental patches for driver thread safety

Daniel P. Berrange berrange at redhat.com
Fri Oct 17 13:46:34 UTC 2008

The following series of 5 patches implement basic thread safety for the
QEMU, LXC and Network drivers. It does not address the OpenVZ or Test
driver yet. The Xen driver is totally stateless so does not require
changes - though I do need to verify there's no 'static' variables that
are used in an unsafe yet in Xen drivers.

Also note that these patches are *not* bisectable at this time, because
the domain config APIs add locking to some generic APIs, and unless the
drivers using these APIs are updated at same time deadlocks will occur.
I need to re-arrange ordering of changes a little to make it bisectable.

The core idea here is to have 2 levels of locking

 - A per-driver lock. 
 - A per-virDomainObjPtr/NetworkObjPtr lock

For every API call, the driver lock is initialy taken. If the API involves
use of a domain / network object, the 2nd object specific lock is taken,
and the driver lock can (optionally) be released at this time.

When creating / deleting domain/network objects though, the driver lock
has to be held for the entire duration of the API call. Fortunately these
API calls don't have very long critical sections.

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list