]> git.ipfire.org Git - thirdparty/qemu.git/commit
eventfd: making it thread safe
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Wed, 18 Jul 2012 12:52:04 +0000 (22:52 +1000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 28 Aug 2012 06:50:01 +0000 (01:50 -0500)
commitb598cb2214cbc197a7d8a677644a7ef3ea17c2c1
tree5f504f4175179f33b8be2d17c04d0972868f3455
parent799c27e1243769a52fb3edc7e5b42f9f50c9fba6
eventfd: making it thread safe

QEMU uses IO handlers to run select() in the main loop.
The handlers list is managed by qemu_set_fd_handler() helper
which works fine when called from the main thread as it is
called when select() is not waiting.

However IO handlers list can be changed in the thread other than
the main one doing os_host_main_loop_wait(), for example, as a result
of a hypercall which changes PCI config space (VFIO on POWER is the case)
and enables/disabled MSI/MSIX which closes/creates eventfd handles.
As the main loop should be waiting on the newly created eventfds,
it has to be restarted.

The patch adds the qemu_notify_event() call to interrupt select()
to make main_loop() restart select() with the updated IO handlers
list.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 55ce75faf253d4369670f60409c608e665e8dde9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
iohandler.c