Skip to content

Commit

Permalink
powerpc/eeh: Permanently disable the removed device
Browse files Browse the repository at this point in the history
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.

Also, in eeh_dev_check_failure in we may consider the error as false
positive if the device is hotpluged out as the get_state call returns
EEH_STATE_NOT_SUPPORT and we may end up not clearing the device state,
so log the event if the state is not moved to permanent failure state.

Signed-off-by: Ganesh Goudar <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
  • Loading branch information
Ganesh Goudar authored and mpe committed Apr 23, 2024
1 parent d3b2cf0 commit a88e266
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 10 additions & 1 deletion arch/powerpc/kernel/eeh.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,18 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
* We will punt with the following conditions: Failure to get
* PE's state, EEH not support and Permanently unavailable
* state, PE is in good state.
*
* On the pSeries, after reaching the threshold, get_state might
* return EEH_STATE_NOT_SUPPORT. However, it's possible that the
* device state remains uncleared if the device is not marked
* pci_channel_io_perm_failure. Therefore, consider logging the
* event to let device removal happen.
*
*/
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;
Expand Down
13 changes: 11 additions & 2 deletions arch/powerpc/kernel/eeh_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,18 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
devices++;

if (!devices) {
pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n",
pr_warn("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.
*
* In the case of powernv, note that the removal of device
* is covered by pci rescan lock, so no problem even if hotplug
* driver attempts to remove the device.
*/
goto recover_failed;
}

/* Log the event */
Expand Down

0 comments on commit a88e266

Please sign in to comment.