[PATCH] powerpc/eeh: fix deadlock when PE frozen state can't be cleared

Subsystems: linux for powerpc (32-bit and 64-bit), pci enhanced error handling (eeh) for powerpc, the rest

STALE3565d

3 messages, 3 authors, 2016-12-03 · open the first message on its own page

[PATCH] powerpc/eeh: fix deadlock when PE frozen state can't be cleared

From: Andrew Donnellan <hidden>
Date: 2016-12-01 00:23:21

In eeh_reset_device(), we take the pci_rescan_remove_lock immediately after
after we call eeh_reset_pe() to reset the PCI controller. We then call
eeh_clear_pe_frozen_state(), which can return an error. In this case, we
bail out of eeh_reset_device() without calling pci_unlock_rescan_remove().

Add a call to pci_unlock_rescan_remove() in the eeh_clear_pe_frozen_state()
error path so that we don't cause a deadlock later on.

Reported-by: Pradipta Ghosh <redacted>
Fixes: 78954700631f ("powerpc/eeh: Avoid I/O access during PE reset")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
---
 arch/powerpc/kernel/eeh_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index a62be72..5c31369 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -671,8 +671,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
 
 	/* Clear frozen state */
 	rc = eeh_clear_pe_frozen_state(pe, false);
-	if (rc)
+	if (rc) {
+		pci_unlock_rescan_remove();
 		return rc;
+	}
 
 	/* Give the system 5 seconds to finish running the user-space
 	 * hotplug shutdown scripts, e.g. ifdown for ethernet.  Yes,
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

Re: [PATCH] powerpc/eeh: fix deadlock when PE frozen state can't be cleared

From: Russell Currey <hidden>
Date: 2016-12-01 00:27:44

On Thu, 2016-12-01 at 11:23 +1100, Andrew Donnellan wrote:
In eeh_reset_device(), we take the pci_rescan_remove_lock immediately after
after we call eeh_reset_pe() to reset the PCI controller. We then call
eeh_clear_pe_frozen_state(), which can return an error. In this case, we
bail out of eeh_reset_device() without calling pci_unlock_rescan_remove().

Add a call to pci_unlock_rescan_remove() in the eeh_clear_pe_frozen_state()
error path so that we don't cause a deadlock later on.

Reported-by: Pradipta Ghosh <redacted>
Fixes: 78954700631f ("powerpc/eeh: Avoid I/O access during PE reset")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
---
Locking in this function is such a mess, we (I) should revisit it at some point.

Acked-by: Russell Currey <redacted>

Re: powerpc/eeh: fix deadlock when PE frozen state can't be cleared

From: Michael Ellerman <hidden>
Date: 2016-12-03 11:31:13

On Thu, 2016-12-01 at 00:23:05 UTC, Andrew Donnellan wrote:
In eeh_reset_device(), we take the pci_rescan_remove_lock immediately after
after we call eeh_reset_pe() to reset the PCI controller. We then call
eeh_clear_pe_frozen_state(), which can return an error. In this case, we
bail out of eeh_reset_device() without calling pci_unlock_rescan_remove().

Add a call to pci_unlock_rescan_remove() in the eeh_clear_pe_frozen_state()
error path so that we don't cause a deadlock later on.

Reported-by: Pradipta Ghosh <redacted>
Fixes: 78954700631f ("powerpc/eeh: Avoid I/O access during PE reset")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
Acked-by: Russell Currey <redacted>
Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/409bf7f8a02ef88db5a0f2cdcf9489

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help