On 2024-05-10 16:50, Andy Shevchenko wrote:
On Thu, May 09, 2024 at 07:04:32PM +0200, Lukas Wunner wrote:
[cc += Shin'ichiro, Klara, Andy, Danil]
Thank you!
On Thu, May 09, 2024 at 04:49:34PM +0000, bcfradella@xxxxxxxxx wrote:
From: Ben Fradella <bfradell@xxxxxxxxxx>
The P2SB could get an invalid BAR from the BIOS, and that won't be fixed
up until pcibios_assign_resources(), which is an fs_initcall().
- Move p2sb_fs_init() to an fs_initcall_sync(). This is still early
enough to avoid a race with any dependent drivers.
- Add a check for IORESOURCE_UNSET in p2sb_valid_resource() to catch
unset BARs going forward.
- Return error values from p2sb_fs_init() so that the 'initcall_debug'
cmdline arg provides useful data.
...
/*
- * pci_rescan_remove_lock to avoid access to unhidden P2SB devices can
- * not be locked in sysfs pci bus rescan path because of deadlock. To
- * avoid the deadlock, access to P2SB devices with the lock at an early
- * step in kernel initialization and cache required resources. This
- * should happen after subsys_initcall which initializes PCI subsystem
- * and before device_initcall which requires P2SB resources.
+ * pci_rescan_remove_lock() can not be locked in sysfs pci bus rescan path
PCI bus
+ * because of deadlock. To avoid the deadlock, access P2SB devices with the lock
+ * at an early step in kernel initialization and cache required resources.
+ *
+ * We want to run as early as possible. If the P2SB was assigned a bad BAR,
+ * we'll need to wait on pcibios_assign_resources() to fix it. So, our list of
+ * initcall dependencies looks something like this:
+ *
+ * ...
+ * subsys_initcall (pci_subsys_init)
+ * fs_initcall (pcibios_assign_resources)
*/
This makes sense to me
Acked-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
I assume others will conduct the proper review and testing.
This patch did not introduce any new issues on my previously problematic
system.
Tested-by: Klara Modin <klarasmodin@xxxxxxxxx>