Re: [RFC] Observed lockdep circular dependency in SR-IOV paths
From: Jason Gunthorpe
Date: Mon Apr 06 2026 - 18:34:59 EST
On Tue, Mar 31, 2026 at 10:23:06AM -0700, Raghavendra Rao Ananta wrote:
> Hi Alex,
>
> While running the vfio_pci_sriov_uapi_test [1] on a CONFIG_LOCKDEP
> enabled kernel (7.0-rc1), we observed the following lockdep circular
> locking dependency warning:
This loos more like a class issue, the locks used by the VF driver are
different than the locks used by the PF driver, and even though the
devsets are shared a devset should never have both the PF and VF.
Maybe shifting memory_lock into a different lock class for VFs is
enough.
However, I think it is a bad idea to hold the memory_lock while
probing a device, I'd prefer to revisit f4162eb1e2fc ("vfio/pci:
Change the PF power state to D0 before enabling VFs") and change it's
logic to rely on a private flag instead of pci_num_vf()
Then we don't need to hold the lock any longer than just setting the
flag.
Jason