[CRIU] Thread safety of C API

Michal Privoznik mprivozn at redhat.com
Wed Jun 8 06:14:25 PDT 2016


Dear list,

forgive me if this question has been asked already, but I didn't find
anything about that. Katerina (CCed) and me are working on implementing
migration support for our LXC driver [1] in libvirt [2]. And we wanted
to use the C API, however reading the documentation to that [3] and
checking out the sources we've found that C API is not threat safe. This
is a bummer, since libvirt is multi-threaded app where each thread is
allowed to execute an API over distant VMs (in this case containers) at
the same time. So we are unable to use the C API unless we serialize the
callers wanting to migrate on a mutex. This would, however, have
unfortunate effect on our performance.

My question here is, are there any plans on making the APIs thread safe?
I don't know what's the policy on changing APIs (for instance in Libvirt
we don't allow that and have to invent a new one for the flawed ones). I
can provide the patches if there's not enough bandwidth, but I'd rather
check with you before devoting my time to it.

Thanks!

Michal

1: https://www.redhat.com/archives/libvir-list/2016-May/msg00565.html
2: http://libvirt.org/internals/eventloop.html#worker_pool
3: https://criu.org/C_API


More information about the CRIU mailing list