On Mon, May 19, 2025 at 04:39:19PM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 5/19/25 2:35 PM, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelg...@google.com>
> > 
> > Previously we decoded the AER Error Source ID in two places.  Consolidate
> > them so both places use aer_print_port_info().  Add a "details" parameter
> > so we can add a note when we didn't find any downstream devices with errors
> > logged in their AER Capability.
> > 
> > When we didn't read any error details from the source device, we logged two
> > messages: one in aer_isr_one_error() and another in find_source_device().
> > Since they both contain the same information, only log the first one when
> > when find_source_device() has found error details.
> /s/when//

Fixed, thanks!

> > -   pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n",
> > +   pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d%s\n",
> 
> Instead of relying on the callers, why not add a space before details here?

Could, but I don't like adding an extra space at the end of the line
when the caller passes "".  The extra space could make the line wrap
unnecessarily.

> >              info->multi_error_valid ? "Multiple " : "",
> >              aer_error_severity_string[info->severity],
> >              pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
> > -            PCI_FUNC(devfn));
> > +            PCI_FUNC(devfn), details);
> >   }
> >   #ifdef CONFIG_ACPI_APEI_PCIEAER
> > @@ -926,13 +927,13 @@ static bool find_source_device(struct pci_dev *parent,
> >     else
> >             pci_walk_bus(parent->subordinate, find_device_iter, e_info);
> > +   /*
> > +    * If we didn't find any devices with errors logged in the AER
> > +    * Capability, just print the Error Source ID from the Root Port or
> > +    * RCEC that received an ERR_* Message.
> > +    */
> >     if (!e_info->error_dev_num) {
> > -           u8 bus = e_info->id >> 8;
> > -           u8 devfn = e_info->id & 0xff;
> > -
> > -           pci_info(parent, "found no error details for 
> > %04x:%02x:%02x.%d\n",
> > -                    pci_domain_nr(parent->bus), bus, PCI_SLOT(devfn),
> > -                    PCI_FUNC(devfn));
> > +           aer_print_port_info(parent, e_info, " (no details found)");
> >             return false;
> >     }
> >     return true;
> > @@ -1297,10 +1298,11 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
> >                     e_info.multi_error_valid = 1;
> >             else
> >                     e_info.multi_error_valid = 0;
> > -           aer_print_port_info(pdev, &e_info);
> 
> Instead of printing the error information in find_source_device() (a helper 
> function), I think it be better to print it here (the error handler). 
> source_found = find_source_device(pdev, &e_info); aer_print_port_info(pdev, 
> &e_info, source_found? "" : "(no details found) " );
> 
> if (source_found) aer_process_err_devices(&e_info)

Great idea, thanks!  That looks much nicer.

> > -           if (find_source_device(pdev, &e_info))
> > +           if (find_source_device(pdev, &e_info)) {
> > +                   aer_print_port_info(pdev, &e_info, "");
> >                     aer_process_err_devices(&e_info);
> > +           }
> >     }
> >     if (e_src->status & PCI_ERR_ROOT_UNCOR_RCV) {
> > @@ -1316,10 +1318,10 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
> >             else
> >                     e_info.multi_error_valid = 0;
> > -           aer_print_port_info(pdev, &e_info);
> > -
> > -           if (find_source_device(pdev, &e_info))
> > +           if (find_source_device(pdev, &e_info)) {
> > +                   aer_print_port_info(pdev, &e_info, "");
> >                     aer_process_err_devices(&e_info);
> > +           }
> >     }
> >   }
> 
> -- 
> Sathyanarayanan Kuppuswamy
> Linux Kernel Developer
> 

Reply via email to