xapi-project/xenopsd — pull request #89 by johnelse (2014-07-23 14:23:44+00:00)
Title: CA-140974: Only attempt one bind per host at a time

If multiple VMs with vGPUs are starting in parallel, there is the
possibility that one thread will see that a GPU is not yet bound to the
NVIDIA driver while another thread is already attempting to bind the
GPU. The second thread will then also attempt to bind the device, which
will fail with ENODEV.

Moving the mutex to the top level of the bind function means that each
thread will only check the status of a device after any other threads
have finished binding it.