Re: [PATCH v6 10/16] PCI/AER: Combine trace_aer_event() with statistics updates

Sathyanarayanan Kuppuswamy
2025-05-20T01:49:51Z

On 5/19/25 2:35 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> As with the AER statistics, we always want to emit trace events, even if
> the actual dmesg logging is rate limited.
>
> Call trace_aer_event() directly from pci_dev_aer_stats_incr(), where we
> update the statistics.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

> drivers/pci/pcie/aer.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index eb80c382187d..4683a99c7568 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -625,6 +625,9 @@ static void pci_dev_aer_stats_incr(struct pci_dev *pdev,
> u64 *counter = NULL;
> struct aer_stats *aer_stats = pdev->aer_stats;
>
> + trace_aer_event(pci_name(pdev), (info->status & ~info->mask),
> + info->severity, info->tlp_header_valid, &info->tlp);
> +
> if (!aer_stats)
> return;
>
> @@ -741,9 +744,6 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
> out:
> if (info->id && info->error_dev_num > 1 && info->id == id)
> pci_err(dev, " Error of this Agent is reported first\n");
> -
> - trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask),
> - info->severity, info->tlp_header_valid, &info->tlp);
> }
>
> #ifdef CONFIG_ACPI_APEI_PCIEAER
> @@ -782,6 +782,9 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
>
> info.status = status;
> info.mask = mask;
> + info.tlp_header_valid = tlp_header_valid;
> + if (tlp_header_valid)

I think you can skip this check. The trace call checks for valid flag before accessing
the tlp buffer. If you want to keep it, try to set it to NULL for !tlp_header_valid case.

> + info.tlp = aer->header_log;
>
> pci_dev_aer_stats_incr(dev, &info);
>
> @@ -799,9 +802,6 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
>
> if (tlp_header_valid)
> pcie_print_tlp_log(dev, &aer->header_log, dev_fmt(" "));
> -
> - trace_aer_event(pci_name(dev), (status & ~mask),
> - aer_severity, tlp_header_valid, &aer->header_log);
> }
> EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");
>

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer