Re: [PATCH] pci: Don't call resume callback for nearly bound devices
From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2021-11-11 17:01:33
Also in:
linux-i2c, linux-pci, lkml
On Wed, Nov 10, 2021 at 03:19:05PM -0600, Bjorn Helgaas wrote:
On Wed, Nov 10, 2021 at 05:33:11PM +0100, Robert Święcki wrote:quoted
śr., 10 lis 2021 o 15:14 Bjorn Helgaas [off-list ref] napisał(a):quoted
On Tue, Nov 09, 2021 at 02:05:18PM -0600, Bjorn Helgaas wrote:quoted
On Tue, Nov 09, 2021 at 07:58:47PM +0100, Rafael J. Wysocki wrote:quoted
On Tue, Nov 9, 2021 at 7:52 PM Rafael J. Wysocki [off-list ref] wrote:quoted
...quoted
quoted
quoted
So instead, we can drop the pm_runtime_get_sync() and pm_runtime_put_sync() from local_pci_probe() and pci_device_remove(), respectively, and add pm_runtine_get_noresume() to pci_pm_init(), which will prevent PM-runtime from touching the device until it has a driver that supports PM-runtime. We'll lose the theoretical ability to put unbound devices into D3 this way, but we learned some time ago that this isn't safe in all cases anyway.IOW, something like this (untested and most likely white-space-damaged).Thanks! I applied this manually to for-linus in hopes of making the the next linux-next build. Please send any testing reports and corrections to the patch and commit log!Robert, I hate to ask even more of you, but if you have a chance, it would be very helpful if you could test the patch below. I'm pretty sure it should fix the problem you saw, and I hope to ask Linus to merge it today.I think the most recent patch creates some timeouts and other problems in pci-related code? Things I haven't seen before. But, granted, my kernel testing approach is not with focus on details, so maybe I did sth wrong.Thank you very much for testing this. The patch changed the way we use runtime PM, and the dmesg snippets below look like they could be related to runtime PM issues. I think the conclusion is that we need to revert these commits: b5f9c644eb1b ("PCI: Remove struct pci_dev->driver") 2a4d9408c9e8 ("PCI: Use to_pci_driver() instead of pci_dev->driver") from Linus' tree. I queued up those reverts on https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=for-linus
These reverts appeared in the Nov 11 linux-next tree. Any chance you could verify that they solve the i2c_dw_pci_resume() issue? If it's easier, you can apply them from: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=for-linus instead. Bjorn