Re: [PATCH v9 01/26] PCI: Fix race condition in pci_enable/disable_device()

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

 



Hi,

The kbuild test robot has reported a build error on some configs,
pointing out that another #ifdef should be used. I've checked, the
DEBUG_LOCK_ALLOC seems to suit better here:

On Fri, 2020-12-18 at 20:39 +0300, Sergei Miroshnichenko wrote:
> This is a yet another approach to fix an old [1-2] concurrency issue,
> when:
>  - two or more devices are being hot-added into a bridge which was
>    initially empty;
>  - a bridge with two or more devices is being hot-added;
>  - the BIOS/bootloader/firmware doesn't pre-enable bridges during
> boot;
> 
> ...
>  
> +#ifdef CONFIG_PROVE_LOCKING

+#ifdef CONFIG_DEBUG_LOCK_ALLOC

> +static int pci_bridge_depth(struct pci_dev *dev)
> +{
> +	struct pci_dev *bridge = pci_upstream_bridge(dev);
> +
> +	if (!bridge)
> +		return 0;
> +
> +	return 1 + pci_bridge_depth(bridge);
> +}
> +#endif /* CONFIG_PROVE_LOCKING */

+#endif /* CONFIG_DEBUG_LOCK_ALLOC */

> +
>  static void pci_enable_bridge(struct pci_dev *dev)
>  {
>  	struct pci_dev *bridge;
>  	int retval;
>  
> +	mutex_lock_nested(&dev->enable_mutex, pci_bridge_depth(dev));
> +
>  	bridge = pci_upstream_bridge(dev);
>  	if (bridge)
>  		pci_enable_bridge(bridge);

Is there a proper way to send a "hotfix" for a single patch of the
series of 26, without resending them all?

Best regards,
Serge




[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