Skip to contentSkip to conversation

powerpc/eeh: Permanently disable the removed device

PATCH Superseded Ganesh Goudar 2 participants 3 messages Apr 5, 2024 – Apr 15, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/eeh: Permanently disable the removed device

When a device is hot removed on powernv, the hotplug driver clears the device's state. However, on pseries, if a device is removed by phyp after reaching the error threshold, the kernel remains unaware, leading to the device not being torn down. This prevents necessary remediation actions like failover.

Permanently disable the device if the presence check fails.

---
 arch/powerpc/kernel/eeh.c        | 4 +++-
 arch/powerpc/kernel/eeh_driver.c | 8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/powerpc/kernel/eeh.c +3 -1
index ab316e155ea9..8d1606406d3f 100644
@@ -508,7 +508,9 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
 	 * state, PE is in good state.
 	 */
 	if ((ret < 0) ||
-	    (ret == EEH_STATE_NOT_SUPPORT) || eeh_state_active(ret)) {
+	    (ret == EEH_STATE_NOT_SUPPORT &&
+	     dev->error_state == pci_channel_io_perm_failure) ||
+	    eeh_state_active(ret)) {
 		eeh_stats.false_positives++;
 		pe->false_positives++;
 		rc = 0;
arch/powerpc/kernel/eeh_driver.c +7 -1
index 48773d2d9be3..10317badf471 100644
@@ -867,7 +867,13 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
 	if (!devices) {
 		pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n",
 			pe->phb->global_number, pe->addr);
-		goto out; /* nothing to recover */
+		/*
+		 * The device is removed, Tear down its state,
+		 * On powernv hotplug driver would take care of
+		 * it but not on pseries, Permanently disable the
+		 * card as it is hot removed.
+		 */
+		goto recover_failed;
 	}
 
 	/* Log the event */
Signature · 1 line
2.44.0
#1 lore raw

Hi Ganesh,

Quoted 9 lines · Ganesh Goudar

When a device is hot removed on powernv, the hotplug driver clears the device's state. However, on pseries, if a device is removed by phyp after reaching the error threshold, the kernel remains unaware, leading to the device not being torn down. This prevents necessary remediation actions like failover.

Permanently disable the device if the presence check fails.

You can wrap your changelogs a bit wider, 70 or 80 columns is fine.

Quoted 5 lines
arch/powerpc/kernel/eeh.c +0 -0
index ab316e155ea9..8d1606406d3f 100644

arch/powerpc/kernel/eeh.c int eeh_dev_check_failure(struct eeh_dev *edev) · line 516

Quoted 10 lines
arch/powerpc/kernel/eeh.c +3 -1
@@ -508,7 +508,9 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
 	 * state, PE is in good state.
 	 */
 	if ((ret < 0) ||
-	    (ret == EEH_STATE_NOT_SUPPORT) || eeh_state_active(ret)) {
+	    (ret == EEH_STATE_NOT_SUPPORT &&
+	     dev->error_state == pci_channel_io_perm_failure) ||
+	    eeh_state_active(ret)) {
 		eeh_stats.false_positives++;
 		pe->false_positives++;
 		rc = 0;

How does this hunk relate the changelog?

This is adding an extra condition to the false positive check, so there's a risk this causes devices to go into failure when previously they didn't, right? So please explain why it's a good change. The comment above the if needs updating too.

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 870

Quoted 9 lines
arch/powerpc/kernel/eeh_driver.c +0 -1
index 48773d2d9be3..10317badf471 100644
@@ -867,7 +867,13 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
 	if (!devices) {
 		pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n",
 			pe->phb->global_number, pe->addr);
-		goto out; /* nothing to recover */

The other cases that go to recover_failed usually print something at warn level, so this probably should too. So either make the above a pr_warn(), or change it to a warn with a more helpful message.

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 875

Quoted 6 lines
arch/powerpc/kernel/eeh_driver.c +6 -0
+		/*
+		 * The device is removed, Tear down its state,
+		 * On powernv hotplug driver would take care of
+		 * it but not on pseries, Permanently disable the
+		 * card as it is hot removed.
+		 */

Formatting and punctuation is weird. It can be wider, and capital letter is only required after a full stop, not a comma.

Also you say that the powernv hotplug driver "would" take care of it, that's past tense, is that what you mean? Does the powernv hotplug driver still take care of it after this change? And (how) does that driver cope with it happening here also?

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 878

Quoted 3 lines
arch/powerpc/kernel/eeh_driver.c +1 -0
+		goto recover_failed;
 	}
 

cheers

author
#2 lore raw
Quoted 10 lines · Michael Ellerman

Hi Ganesh,

Quoted 7 lines · Ganesh Goudar

When a device is hot removed on powernv, the hotplug driver clears the device's state. However, on pseries, if a device is removed by phyp after reaching the error threshold, the kernel remains unaware, leading to the device not being torn down. This prevents necessary remediation actions like failover.

Quoted 3 lines
Quoted 2 lines

Permanently disable the device if the presence check fails.

You can wrap your changelogs a bit wider, 70 or 80 columns is fine.

ok

Quoted 17 lines
Quoted 5 lines
arch/powerpc/kernel/eeh.c +0 -0
index ab316e155ea9..8d1606406d3f 100644

arch/powerpc/kernel/eeh.c int eeh_dev_check_failure(struct eeh_dev *edev) · line 516

Quoted 10 lines
arch/powerpc/kernel/eeh.c +3 -1
@@ -508,7 +508,9 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
  	 * state, PE is in good state.
  	 */
  	if ((ret < 0) ||
-	    (ret == EEH_STATE_NOT_SUPPORT) || eeh_state_active(ret)) {
+	    (ret == EEH_STATE_NOT_SUPPORT &&
+	     dev->error_state == pci_channel_io_perm_failure) ||
+	    eeh_state_active(ret)) {
  		eeh_stats.false_positives++;
  		pe->false_positives++;
  		rc = 0;

How does this hunk relate the changelog?

Quoted 4 lines

This is adding an extra condition to the false positive check, so there's a risk this causes devices to go into failure when previously they didn't, right? So please explain why it's a good change. The comment above the if needs updating too.

We need this change to log the event and get the device removed, I will explain this in commit message.

Quoted 4 lines
Quoted 4 lines
arch/powerpc/kernel/eeh_driver.c +0 -0
index 48773d2d9be3..10317badf471 100644
Quoted 8 lines

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 870

Quoted 5 lines
arch/powerpc/kernel/eeh_driver.c +0 -1
@@ -867,7 +867,13 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
  	if (!devices) {
  		pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n",
  			pe->phb->global_number, pe->addr);
-		goto out; /* nothing to recover */

The other cases that go to recover_failed usually print something at warn level, so this probably should too. So either make the above a pr_warn(), or change it to a warn with a more helpful message.

ok

Quoted 8 lines

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 875

Quoted 6 lines
arch/powerpc/kernel/eeh_driver.c +6 -0
+		/*
+		 * The device is removed, Tear down its state,
+		 * On powernv hotplug driver would take care of
+		 * it but not on pseries, Permanently disable the
+		 * card as it is hot removed.
+		 */

Formatting and punctuation is weird. It can be wider, and capital letter is only required after a full stop, not a comma.

ok, i will take care of it.

Quoted 4 lines

Also you say that the powernv hotplug driver "would" take care of it, that's past tense, is that what you mean? Does the powernv hotplug driver still take care of it after this change? And (how) does that driver cope with it happening here also?

Yes, hotplug driver can still remove the device and the removal of device is covered by pci rescan lock.

Quoted 4 lines

arch/powerpc/kernel/eeh_driver.c void eeh_handle_normal_event(struct eeh_pe *pe) · line 878

Quoted 3 lines
arch/powerpc/kernel/eeh_driver.c +1 -0
+		goto recover_failed;
  	}
 

cheers