Message ID | 20220928105946.12469-5-chenzhuo.1@bytedance.com |
---|---|
State | New |
Headers | show |
Series | PCI/AER: Fix and optimize usage of status clearing api | expand |
[moved James, Dick, LPFC supporters to "to"] On Wed, Sep 28, 2022 at 06:59:41PM +0800, Zhuo Chen wrote: > lpfc_aer_cleanup_state() requires clearing both fatal and non-fatal > uncorrectable error status. I don't know what the point of lpfc_aer_cleanup_state() is. AER errors should be handled and cleared by the PCI core, not by individual drivers. Only lpfc, liquidio, and sky2 touch PCI_ERR_UNCOR_STATUS. But lpfc_aer_cleanup_state() is visible in the "lpfc_aer_state_cleanup" sysfs file, so removing it would break any userspace that uses it. If we can rely on the PCI core to clean up AER errors itself (admittedly, that might be a big "if"), maybe lpfc_aer_cleanup_state() could just become a no-op? Any comment from the LPFC folks? Ideally, I would rather not export pci_aer_clear_nonfatal_status() or pci_aer_clear_uncorrect_error_status() outside the PCI core at all. > But using pci_aer_clear_nonfatal_status() > will only clear non-fatal error status. To clear both fatal and > non-fatal error status, use pci_aer_clear_uncorrect_error_status(). > > Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com> > --- > drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c > index 09cf2cd0ae60..d835cc0ba153 100644 > --- a/drivers/scsi/lpfc/lpfc_attr.c > +++ b/drivers/scsi/lpfc/lpfc_attr.c > @@ -4689,7 +4689,7 @@ static DEVICE_ATTR_RW(lpfc_aer_support); > * Description: > * If the @buf contains 1 and the device currently has the AER support > * enabled, then invokes the kernel AER helper routine > - * pci_aer_clear_nonfatal_status() to clean up the uncorrectable > + * pci_aer_clear_uncorrect_error_status() to clean up the uncorrectable > * error status register. > * > * Notes: > @@ -4715,7 +4715,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, > return -EINVAL; > > if (phba->hba_flag & HBA_AER_ENABLED) > - rc = pci_aer_clear_nonfatal_status(phba->pcidev); > + rc = pci_aer_clear_uncorrect_error_status(phba->pcidev); > > if (rc == 0) > return strlen(buf); > -- > 2.30.1 (Apple Git-130) >
On Tue, Dec 06, 2022 at 04:13:35PM -0600, Bjorn Helgaas wrote: > On Wed, Sep 28, 2022 at 06:59:41PM +0800, Zhuo Chen wrote: > > lpfc_aer_cleanup_state() requires clearing both fatal and non-fatal > > uncorrectable error status. > > I don't know what the point of lpfc_aer_cleanup_state() is. AER > errors should be handled and cleared by the PCI core, not by > individual drivers. Only lpfc, liquidio, and sky2 touch > PCI_ERR_UNCOR_STATUS. > > But lpfc_aer_cleanup_state() is visible in the > "lpfc_aer_state_cleanup" sysfs file, so removing it would break any > userspace that uses it. > > If we can rely on the PCI core to clean up AER errors itself > (admittedly, that might be a big "if"), maybe lpfc_aer_cleanup_state() > could just become a no-op? > > Any comment from the LPFC folks? > > Ideally, I would rather not export pci_aer_clear_nonfatal_status() or > pci_aer_clear_uncorrect_error_status() outside the PCI core at all. Resurrecting this old thread. Zhuo, can you figure out where the PCI core clears these errors, include that in the commit log, and propose a patch that makes lpfc_aer_cleanup_state() a no-op, by removing the pci_aer_clear_nonfatal_status() call completely? Such a patch could be sent to the SCSI maintainers since it doesn't involve the PCI core. If it turns out that the PCI core *doesn't* clear these errors, we should figure out *why* it doesn't and try to change the PCI core so it does. > > But using pci_aer_clear_nonfatal_status() > > will only clear non-fatal error status. To clear both fatal and > > non-fatal error status, use pci_aer_clear_uncorrect_error_status(). > > > > Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com> > > --- > > drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c > > index 09cf2cd0ae60..d835cc0ba153 100644 > > --- a/drivers/scsi/lpfc/lpfc_attr.c > > +++ b/drivers/scsi/lpfc/lpfc_attr.c > > @@ -4689,7 +4689,7 @@ static DEVICE_ATTR_RW(lpfc_aer_support); > > * Description: > > * If the @buf contains 1 and the device currently has the AER support > > * enabled, then invokes the kernel AER helper routine > > - * pci_aer_clear_nonfatal_status() to clean up the uncorrectable > > + * pci_aer_clear_uncorrect_error_status() to clean up the uncorrectable > > * error status register. > > * > > * Notes: > > @@ -4715,7 +4715,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, > > return -EINVAL; > > > > if (phba->hba_flag & HBA_AER_ENABLED) > > - rc = pci_aer_clear_nonfatal_status(phba->pcidev); > > + rc = pci_aer_clear_uncorrect_error_status(phba->pcidev); > > > > if (rc == 0) > > return strlen(buf); > > -- > > 2.30.1 (Apple Git-130) > >
Hi Bjorn, > But lpfc_aer_cleanup_state() is visible in the > "lpfc_aer_state_cleanup" sysfs file, so removing it would break any > userspace that uses it. > > If we can rely on the PCI core to clean up AER errors itself > (admittedly, that might be a big "if"), maybe lpfc_aer_cleanup_state() > could just become a no-op? > > Any comment from the LPFC folks? We have notified all users of the lpfc_aer_cleanup_state sysfs entry, and Broadcom LPFC is okay to no-op. Regards, Justin On Wed, Mar 15, 2023 at 2:39 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > On Tue, Dec 06, 2022 at 04:13:35PM -0600, Bjorn Helgaas wrote: > > On Wed, Sep 28, 2022 at 06:59:41PM +0800, Zhuo Chen wrote: > > > lpfc_aer_cleanup_state() requires clearing both fatal and non-fatal > > > uncorrectable error status. > > > > I don't know what the point of lpfc_aer_cleanup_state() is. AER > > errors should be handled and cleared by the PCI core, not by > > individual drivers. Only lpfc, liquidio, and sky2 touch > > PCI_ERR_UNCOR_STATUS. > > > > But lpfc_aer_cleanup_state() is visible in the > > "lpfc_aer_state_cleanup" sysfs file, so removing it would break any > > userspace that uses it. > > > > If we can rely on the PCI core to clean up AER errors itself > > (admittedly, that might be a big "if"), maybe lpfc_aer_cleanup_state() > > could just become a no-op? > > > > Any comment from the LPFC folks? > > > > Ideally, I would rather not export pci_aer_clear_nonfatal_status() or > > pci_aer_clear_uncorrect_error_status() outside the PCI core at all. > > Resurrecting this old thread. Zhuo, can you figure out where the PCI > core clears these errors, include that in the commit log, and propose > a patch that makes lpfc_aer_cleanup_state() a no-op, by removing the > pci_aer_clear_nonfatal_status() call completely? > > Such a patch could be sent to the SCSI maintainers since it doesn't > involve the PCI core. > > If it turns out that the PCI core *doesn't* clear these errors, we > should figure out *why* it doesn't and try to change the PCI core so > it does. > > > > But using pci_aer_clear_nonfatal_status() > > > will only clear non-fatal error status. To clear both fatal and > > > non-fatal error status, use pci_aer_clear_uncorrect_error_status(). > > > > > > Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com> > > > --- > > > drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c > > > index 09cf2cd0ae60..d835cc0ba153 100644 > > > --- a/drivers/scsi/lpfc/lpfc_attr.c > > > +++ b/drivers/scsi/lpfc/lpfc_attr.c > > > @@ -4689,7 +4689,7 @@ static DEVICE_ATTR_RW(lpfc_aer_support); > > > * Description: > > > * If the @buf contains 1 and the device currently has the AER support > > > * enabled, then invokes the kernel AER helper routine > > > - * pci_aer_clear_nonfatal_status() to clean up the uncorrectable > > > + * pci_aer_clear_uncorrect_error_status() to clean up the uncorrectable > > > * error status register. > > > * > > > * Notes: > > > @@ -4715,7 +4715,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, > > > return -EINVAL; > > > > > > if (phba->hba_flag & HBA_AER_ENABLED) > > > - rc = pci_aer_clear_nonfatal_status(phba->pcidev); > > > + rc = pci_aer_clear_uncorrect_error_status(phba->pcidev); > > > > > > if (rc == 0) > > > return strlen(buf); > > > -- > > > 2.30.1 (Apple Git-130) > > >
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 09cf2cd0ae60..d835cc0ba153 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -4689,7 +4689,7 @@ static DEVICE_ATTR_RW(lpfc_aer_support); * Description: * If the @buf contains 1 and the device currently has the AER support * enabled, then invokes the kernel AER helper routine - * pci_aer_clear_nonfatal_status() to clean up the uncorrectable + * pci_aer_clear_uncorrect_error_status() to clean up the uncorrectable * error status register. * * Notes: @@ -4715,7 +4715,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, return -EINVAL; if (phba->hba_flag & HBA_AER_ENABLED) - rc = pci_aer_clear_nonfatal_status(phba->pcidev); + rc = pci_aer_clear_uncorrect_error_status(phba->pcidev); if (rc == 0) return strlen(buf);
lpfc_aer_cleanup_state() requires clearing both fatal and non-fatal uncorrectable error status. But using pci_aer_clear_nonfatal_status() will only clear non-fatal error status. To clear both fatal and non-fatal error status, use pci_aer_clear_uncorrect_error_status(). Signed-off-by: Zhuo Chen <chenzhuo.1@bytedance.com> --- drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)