Skip to content

PCI/AER: Handle Advisory Non-Fatal properly

Wang, Qingshun linux-acpi linux-cxl linux-edac linux-pci linuxppc-dev lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 10 repliesIn review
  2. v14 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Reference to the latest PCIe Specification in both commit messages and comments, as suggested by Bjorn Helgaas.
- Describe the reason for storing additional information in aer_err_info in the commit message of PATCH 1, as suggested by Bjorn Helgaas.
- Add more details of behavior changes in the commit message of PATCH 2, as suggested by Bjorn Helgaas.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4PCI/AER: Store more information in aer_err_infodrivers/acpi/apei/ghes.c drivers/cxl/core/pci.c drivers/pci/pci.h +3 more+111 -376 replies
2/4PCI/AER: Handle Advisory Non-Fatal properlydrivers/pci/pcie/aer.c+60 -12 replies
3/4PCI/AER: Fetch information for FTracedrivers/acpi/apei/ghes.c drivers/cxl/core/pci.c drivers/pci/pci.h +2 more+45 -102 replies
4/4RAS: Trace more information in aer_eventdrivers/pci/pcie/aer.c include/ras/ras_event.h include/uapi/linux/pci_regs.h+60 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] PCI/AER: Handle Advisory Non-Fatal properly

According to PCIe Base Specification Revision 6.1, Sections 6.2.3.4 and 6.2.4.3, certain uncorrectable errors will signal ERR_COR instead of ERR_NONFATAL, logged as Advisory Non-Fatal Error, and set bits in both Correctable Error Status register and Uncorrectable Error Status register. Currently, when handling AER events the kernel will only look at CE status or UE status, but never both. In the Advisory Non-Fatal Error case, bits set in the UE status register will not be reported and cleared until the next Fatal/Non-Fatal error arrives.

For instance, previously, when the kernel receives an ANFE with Poisoned TLP in OS native AER mode, only the status of CE will be reported and cleared:

AER: Corrected error received: 0000:b7:02.0
PCIe Bus Error: severity=Corrected, type=Transaction Layer, (Receiver ID)

    device [8086:0db0] error status/mask=00002000/00000000
     [13] NonFatalErr           

If the kernel receives a Malformed TLP after that, two UE will be reported, which is unexpected. The Malformed TLP Header was lost since the previous ANFE gated the TLP header logs:

PCIe Bus Error: severity=Uncorrected (Fatal), type=Transaction Layer, (Receiver ID)

    device [8086:0db0] error status/mask=00041000/00180020
     [12] TLP                    (First)
     [18] MalfTLP       

To handle this case properly, add additional fields in aer_err_info to track both CE and UE status/mask, UE severity, and Device Status. Use this information to determine the status bits that need to be cleared.

Now, in the previous scenario, both CE status and related UE status will be reported and cleared after ANFE:

AER: Corrected error received: 0000:b7:02.0
PCIe Bus Error: severity=Corrected, type=Transaction Layer, (Receiver ID)

    device [8086:0db0] error status/mask=00002000/00000000
     [13] NonFatalErr           
    Uncorrectable errors that may cause Advisory Non-Fatal:
     [18] TLP

Additionally, add more data to aer_event tracepoint, which would help to better understand ANFE and other errors for external observation.

Note:
checkpatch.pl will produce following errors and warnings on PATCH 4:

ERROR: space prohibited after that open parenthesis '(' #103: FILE: include/ras/ras_event.h:319:
+ __field( u16, link_status )

...similar errors omitted...

WARNING: quoted string split across lines
#126: FILE: include/ras/ras_event.h:342:
+ TP_printk("%s PCIe Bus Error: severity=%s, %s, TLP Header=%s, "
+ "Correctable Error Status=0x%08x, "

...similar warnings omitted...

For readability reasons, these errors and warnings are not fixed, following the code style of existing examples in the kernel source tree.

Change log:
v2:
- Reference to the latest PCIe Specification in both commit messages and comments, as suggested by Bjorn Helgaas.
- Describe the reason for storing additional information in aer_err_info in the commit message of PATCH 1, as suggested by Bjorn Helgaas.
- Add more details of behavior changes in the commit message of PATCH 2, as suggested by Bjorn Helgaas.

v1: https://lore.kernel.org/linux-pci/[email protected]/

Wang, Qingshun (4):
PCI/AER: Store more information in aer_err_info
PCI/AER: Handle Advisory Non-Fatal properly
PCI/AER: Fetch information for FTrace
RAS: Trace more information in aer_event

 drivers/acpi/apei/ghes.c      |  16 ++-
 drivers/cxl/core/pci.c        |  15 ++-
 drivers/pci/pci.h             |  12 ++-
 drivers/pci/pcie/aer.c        | 191 +++++++++++++++++++++++++++-------
 include/linux/aer.h           |   6 +-
 include/linux/pci.h           |  27 +++++
 include/ras/ras_event.h       |  48 ++++++++-
 include/uapi/linux/pci_regs.h |   1 +
 8 files changed, 269 insertions(+), 47 deletions(-)

base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d

Signature · 1 line
2.42.0