libvirt/src/libxl
Jim Fehlig 7b3cf84bbb libxl: find virDomainObj in libxlDomainShutdownThread
libxl events are delivered to libvirt via the libxlDomainEventHandler
callback registered with libxl. Documenation in
$xensrc/tools/libxl/libxl_event.h states that the callback "may occur
on any thread in which the application calls libxl". This can result
in deadlock since many of the libvirt callees of libxl hold a lock on
the virDomainObj they are working on. When the callback is invoked, it
attempts to find a virDomainObj corresponding to the domain ID provided
by libxl. Searching the domain obj list results in locking each obj
before checking if it is active, and its ID equals the requested ID.
Deadlock is possible when attempting to lock an obj that is already
locked further up the call stack. Indeed, Max Ustermann reported an
instance of this deadlock

https://www.redhat.com/archives/libvir-list/2015-November/msg00130.html

Guido Rossmueller also recently stumbled across it

https://www.redhat.com/archives/libvir-list/2016-September/msg00287.html

Fix the deadlock by moving the lookup of virDomainObj to the
libxlDomainShutdownThread. After this patch, libxl events are
enqueued on the libvirt side and processed by dedicated thread,
avoiding the described deadlock.

Reported-by: Max Ustermann <ustermann78@web.de>
Reported-by: Guido Rossmueller <Guido.Rossmueller@gdata.de>
2016-09-27 09:14:10 -06:00
..
libvirtd_libxl.aug libxl: keepalive messages support 2016-02-09 21:14:12 -07:00
libxl_capabilities.c libxl: describe host cpu features based on hwcaps 2016-09-12 12:49:03 +02:00
libxl_capabilities.h libxl: implement connectGetDomainCapabilities 2016-06-13 14:13:17 -06:00
libxl_conf.c libxl: increase usbdevice list only when finding such an input device 2016-09-23 15:12:41 -06:00
libxl_conf.h libxl: support USB controllers in creation time 2016-08-02 14:02:21 +02:00
libxl_domain.c libxl: find virDomainObj in libxlDomainShutdownThread 2016-09-27 09:14:10 -06:00
libxl_domain.h libxl: add a flag to mark guests as tainted by a hook 2016-08-02 14:20:31 +02:00
libxl_driver.c virDomainDefParse{File,String}: Introduce @parseOpaque argument 2016-09-26 16:50:12 +02:00
libxl_driver.h libxl: Use standard format for source file copyright notice 2013-09-03 23:53:48 -06:00
libxl_migration.c virDomainDefParse{File,String}: Introduce @parseOpaque argument 2016-09-26 16:50:12 +02:00
libxl_migration.h libxl: support VIR_MIGRATE_PERSIST_DEST migration flag 2016-09-21 15:42:41 -06:00
libxl.conf libxl: keepalive messages support 2016-02-09 21:14:12 -07:00
test_libvirtd_libxl.aug.in libxl: keepalive messages support 2016-02-09 21:14:12 -07:00