Re: [PATCHv2 2/5] pci: make pci_destroy_dev concurrent safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 02, 2024 at 07:34:13PM -0700, Davidlohr Bueso wrote:
> On Tue, 27 Aug 2024, Keith Busch wrote:
> > static void pci_destroy_dev(struct pci_dev *dev)
> > {
> > -	if (!dev->dev.kobj.parent)
> > +	if (pci_dev_test_and_set_removed(dev))
> 
> Doesn't this want to be if (!pci_dev_test_and_set_removed()) ?

No, this function returns the previous value of the REMOVED flag. If
it's already set, then another thread already removed this device.
 
> This also fixes a splat when triggering a removal when you add
> subordinate refcounting is added:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git/commit/?h=pci-bus-locking-2024-09-09&id=3883c485d5e45b5e17f685f77ff4020bec162336

Oh, that's pretty neat. Thanks for testing that! I think that reference
counting patch is pretty safe too. I can rebase the series with that one
included next time.




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux