[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200328221618.GA135902@google.com>
Date: Sat, 28 Mar 2020 17:16:18 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: "Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
ashok.raj@...el.com
Subject: Re: [PATCH v18 05/11] PCI/ERR: Remove service dependency in
pcie_do_recovery()
On Sat, Mar 28, 2020 at 02:55:50PM -0700, Kuppuswamy, Sathyanarayanan wrote:
> 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@...ux.intel.com wrote:
> > > > From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
> > > >
> > >
> > > > +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.
I think we should rework the documentation to remove that.
pcie_do_recovery() is internal to the PCI core and not directly
relevant to drivers.
Powered by blists - more mailing lists