Re: [PATCH v1] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe

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

 



On Dec 21, 2023 / 18:52, Andy Shevchenko wrote:
> On Thu, Dec 21, 2023 at 06:39:36PM +0900, Shin'ichiro Kawasaki wrote:
> > p2sb_bar() unhides P2SB device to get resources from the device. It
> > guards the operation by locking pci_rescan_remove_lock so that parallel
> > rescans do not find the P2SB device. However, this lock causes deadlock
> > when PCI bus rescan is triggered by /sys/bus/pci/rescan. The rescan
> > locks pci_rescan_remove_lock and probes PCI devices. When PCI devices
> > call p2sb_bar() during probe, it locks pci_rescan_remove_lock again.
> > Hence the deadlock.
> > 
> > To avoid the deadlock, do not lock pci_rescan_remove_lock in p2sb_bar().
> > Instead, do the lock at fs_initcall. Introduce p2sb_cache_resources()
> > for fs_initcall which gets and caches the P2SB resources. At p2sb_bar(),
> > refer the cache and return to the caller.
> 
> Thank you for the update!
> My comments below.

Thank you very much for the valuable comments. One of them does not look valid
for me as I noted below. Other than that, all comments improve the patch :)
Will reflect them to v2.

...

> > +	if (!devfn) {
> 
> Maybe move this check to the callee?
> 
> > +		ret = p2sb_get_devfn(&devfn);
> > +		if (ret)
> > +			return ret;
> > +	}

If we move this check into p2sb_get_devfn(), it will add some complexity
to another caller of p2sb_get_devfn(). So I think it's the better to keep
the check here.




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux