Re: [PATCH] vfio/pci: Use RCU for error/request triggers to avoid circular locking

From: Jason Gunthorpe

Date: Wed Nov 26 2025 - 14:54:15 EST


On Mon, Nov 24, 2025 at 03:36:22PM -0700, Alex Williamson wrote:
> From: Alex Williamson <alex.williamson@xxxxxxxxxx>
>
> Thanks to a device generating an ACS violation during bus reset,
> lockdep reported the following circular locking issue:
>
> CPU0: SET_IRQS (MSI/X): holds igate, acquires memory_lock
> CPU1: HOT_RESET: holds memory_lock, acquires pci_bus_sem
> CPU2: AER: holds pci_bus_sem, acquires igate
>
> This results in a potential 3-way deadlock.
>
> Remove the pci_bus_sem->igate leg of the triangle by using RCU
> to peek at the eventfd rather than locking it with igate.
>
> Fixes: 3be3a074cf5b ("vfio-pci: Don't use device_lock around AER interrupt setup")
> Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
> ---
> drivers/vfio/pci/vfio_pci_core.c | 68 ++++++++++++++++++++++---------
> drivers/vfio/pci/vfio_pci_intrs.c | 52 ++++++++++++++---------
> drivers/vfio/pci/vfio_pci_priv.h | 4 ++
> include/linux/vfio_pci_core.h | 10 ++++-
> 4 files changed, 93 insertions(+), 41 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason