[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250317205516.599440-1-sargun@sargun.me>
Date: Mon, 17 Mar 2025 13:55:15 -0700
From: Sargun Dhillon <sargun@...gun.me>
To: linux-kernel@...r.kernel.org,
linux-edac@...r.kernel.org
Cc: Sargun Dhillon <sargun@...gun.me>,
"Paul E . McKenney" <paulmck@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Borislav Petkov <bp@...en8.de>
Subject: [PATCH] trace, RAS: Use __print_symbolic helper for entry severity for aer_events
The chained ternary conditional operator in the perf event format for
ras:aer_event was causing a misrepresentation of the severity of the event
when used with "perf script". Rather than building our own hand-rolled
formatting, just use the __print_symbolic helper to format it.
The before / after are as follows (and also tested to make sure
uncorrectable events) still show up as uncorrectable.
aer-inject was used with the following AER event injection script:
AER
PCI_ID 00:05.0
COR_STATUS BAD_TLP
HEADER_LOG 0 1 2 3
dmesg (unchanged between runs):
pcieport 0000:00:05.0: aer_inject: Injecting errors 00000040/00000000 into device 0000:00:05.0
pcieport 0000:00:05.0: AER: Correctable error message received from 0000:00:05.0
pcieport 0000:00:05.0: PCIe Bus Error: severity=Correctable, type=Data Link Layer, (Receiver ID)
pcieport 0000:00:05.0: device [1b36:000c] error status/mask=00000040/0000e000
pcieport 0000:00:05.0: [ 6] BadTLP
Before:
virtme-ng:/# perf script |cat
irq/24-aerdrv 424 [002] 392.240255: ras:aer_event: 0000:00:05.0 PCIe Bus Error: severity=Uncorrected, non-fatal, Bad TLP, TLP Header=Not available
After:
irq/24-aerdrv 424 [002] 29.198383: ras:aer_event: 0000:00:05.0 PCIe Bus Error: severity=Corrected, Bad TLP, TLP Header=Not available
Signed-off-by: Sargun Dhillon <sargun@...gun.me>
---
include/ras/ras_event.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index e5f7ee0864e7..9312007096d7 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -327,9 +327,10 @@ TRACE_EVENT(aer_event,
TP_printk("%s PCIe Bus Error: severity=%s, %s, TLP Header=%s\n",
__get_str(dev_name),
- __entry->severity == AER_CORRECTABLE ? "Corrected" :
- __entry->severity == AER_FATAL ?
- "Fatal" : "Uncorrected, non-fatal",
+ __print_symbolic(__entry->severity,
+ {AER_NONFATAL, "Uncorrected, non-fatal"},
+ {AER_FATAL, "Fatal"},
+ {AER_CORRECTABLE, "Corrected"}),
__entry->severity == AER_CORRECTABLE ?
__print_flags(__entry->status, "|", aer_correctable_errors) :
__print_flags(__entry->status, "|", aer_uncorrectable_errors),
--
2.47.1
Powered by blists - more mailing lists