]> www.infradead.org Git - users/dwmw2/linux.git/commit
vfio: Introduce interface to flush virqfd inject workqueue
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 29 Mar 2024 22:59:39 +0000 (16:59 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:30 +0000 (16:19 +0200)
commit26a6a1e0b4ecea56862f40fd2939f327395afc49
tree58bc2e99ead03c90f5b0b533c1cd5edfb95e9736
parentec73e079729258a05452356cf6d098bf1504d5a6
vfio: Introduce interface to flush virqfd inject workqueue

[ Upstream commit b620ecbd17a03cacd06f014a5d3f3a11285ce053 ]

In order to synchronize changes that can affect the thread callback,
introduce an interface to force a flush of the inject workqueue.  The
irqfd pointer is only valid under spinlock, but the workqueue cannot
be flushed under spinlock.  Therefore the flush work for the irqfd is
queued under spinlock.  The vfio_irqfd_cleanup_wq workqueue is re-used
for queuing this work such that flushing the workqueue is also ordered
relative to shutdown.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20240308230557.805580-4-alex.williamson@redhat.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/virqfd.c
include/linux/vfio.h