mbox series

[v5,0/2] platform/x86: p2sb: Fix deadlock at sysfs PCI bus rescan

Message ID 20231229063912.2517922-1-shinichiro.kawasaki@wdc.com
Headers show
Series platform/x86: p2sb: Fix deadlock at sysfs PCI bus rescan | expand

Message

Shinichiro Kawasaki Dec. 29, 2023, 6:39 a.m. UTC
When PCI devices call p2sb_bar() during probe for sysfs PCI bus rescan, deadlock
happens due to double lock of pci_rescan_remove_lock [1]. The first patch in
this series addresses the deadlock. The second patch is a code improvement which
was pointed out during review for the first patch.

I confirmed the patches fix the problem using a system with i2c_i801 device,
building i2c_i801 module as both built-in and loadable.

[1] https://lore.kernel.org/linux-pci/6xb24fjmptxxn5js2fjrrddjae6twex5bjaftwqsuawuqqqydx@7cl3uik5ef6j/

Changes from v4:
* Separated a hunk for pci_resource_n() as the second patch
* Reflected other review comments by Ilpo

Changes from v3:
* Modified p2sb_valid_resource() to return boolean

Changes from v2:
* Improved p2sb_scan_and_cache() and p2sb_scan_and_cache_devfn()
* Reflected other review comments by Andy

Changes from v1:
* Reflected review comments by Andy
* Removed RFC prefix

Changes from RFC v2:
* Reflected review comments on the list

Changes from RFC v1:
* Fixed a build warning poitned out in llvm list by kernel test robot

Shin'ichiro Kawasaki (2):
  platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe
  platform/x86: p2sb: Use pci_resource_n() in p2sb_read_bar0()

 drivers/platform/x86/p2sb.c | 174 +++++++++++++++++++++++++++---------
 1 file changed, 132 insertions(+), 42 deletions(-)