Re: [PATCH v18 05/11] PCI/ERR: Remove service dependency in pcie_do_recovery()

From: Kuppuswamy, Sathyanarayanan
Date: Sat Mar 28 2020 - 17:55:53 EST


Hi Bjorn,

On 3/28/20 2:32 PM, Bjorn Helgaas wrote:
On Sat, Mar 28, 2020 at 02:12:48PM -0700, Kuppuswamy, Sathyanarayanan wrote:
On 3/23/20 5:26 PM, sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx wrote:
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>


+void pcie_do_recovery(struct pci_dev *dev,
+ enum pci_channel_state state,
+ pci_ers_result_t (*reset_link)(struct pci_dev *pdev))
{
pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;
struct pci_bus *bus;
@@ -206,9 +165,12 @@ void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,
pci_dbg(dev, "broadcast error_detected message\n");
if (state == pci_channel_io_frozen) {
pci_walk_bus(bus, report_frozen_detected, &status);
- status = reset_link(dev, service);
- if if (reset_link)
status = reset_link(dev);(status == PCI_ERS_RESULT_DISCONNECT
+ status = reset_link(dev);
Above line needs to be replaced as below. Since there is a
possibility reset_link can NULL (eventhough currently its
not true).
if (reset_link)
status = reset_link(dev);
Shall I submit another version to add above fix on top of
our pci/edr branch ?

No, I can squash that in if needed.

But I don't actually think we *do* need it. All the callers supply a
valid reset_link function pointer, and if somebody changes or adds a
new one that doesn't, I'd rather take the null pointer exception and
find out about it than silently ignore it.
But the documentation says "If reset_link is not NULL, recovery function
will use it to reset the link." It considers NULL as a possible case.
So I think its better to allow that case with a pci_warn() message.

Bjorn