]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI/AER: Add sysfs attributes for log ratelimits
authorJon Pan-Doh <pandoh@google.com>
Thu, 22 May 2025 23:21:26 +0000 (18:21 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 23 May 2025 16:11:45 +0000 (11:11 -0500)
commitb4fe7398def6df344442b884d2288f80205cbd2d
tree86f87cf71514fb3a718007a548bd5fae35faa293
parent24816cc298ee9cc01003b10b888427faada4403d
PCI/AER: Add sysfs attributes for log ratelimits

Allow userspace to read/write log ratelimits per device (including
enable/disable). Create aer/ sysfs directory to store them and any
future AER configs.

The new sysfs files are:

  /sys/bus/pci/devices/*/aer/correctable_ratelimit_burst
  /sys/bus/pci/devices/*/aer/correctable_ratelimit_interval_ms
  /sys/bus/pci/devices/*/aer/nonfatal_ratelimit_burst
  /sys/bus/pci/devices/*/aer/nonfatal_ratelimit_interval_ms

The default values are ratelimit_burst=10, ratelimit_interval_ms=5000, so
if we try to emit more than 10 messages in a 5 second period, some are
suppressed.

Update AER sysfs ABI filename to reflect the broader scope of AER sysfs
attributes (e.g. stats and ratelimits).

  Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats ->
    sysfs-bus-pci-devices-aer

Tested using aer-inject[1]. Configured correctable log ratelimit to 5.
Sent 6 AER errors. Observed 5 errors logged while AER stats
(cat /sys/bus/pci/devices/<dev>/aer_dev_correctable) shows 6.

Disabled ratelimiting and sent 6 more AER errors. Observed all 6 errors
logged and accounted in AER stats (12 total errors).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/gong.chen/aer-inject.git

[bhelgaas: note fatal errors are not ratelimited, "aer_report" ->
"aer_info", replace ratelimit_log_enable toggle with *_ratelimit_interval_ms]

Signed-off-by: Karolina Stolarek <karolina.stolarek@oracle.com>
Signed-off-by: Jon Pan-Doh <pandoh@google.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: https://patch.msgid.link/20250522232339.1525671-21-helgaas@kernel.org
Documentation/ABI/testing/sysfs-bus-pci-devices-aer [moved from Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats with 72% similarity]
Documentation/PCI/pcieaer-howto.rst
drivers/pci/pci-sysfs.c
drivers/pci/pci.h
drivers/pci/pcie/aer.c