Thread (68 messages) flat view 68 messages, 5 authors, 2025-05-21

Re: [PATCH v6 12/16] PCI/AER: Make all pci_print_aer() log levels depend on error type

From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2025-05-20 15:04:57
Also in: linux-pci, lkml

On Tue, May 20, 2025 at 02:37:33PM +0300, Ilpo Järvinen wrote:
On Mon, 19 May 2025, Bjorn Helgaas wrote:
quoted
From: Karolina Stolarek <redacted>

Some existing logs in pci_print_aer() log with error severity by default.
Convert them to depend on error type (consistent with rest of AER logging).

Link: https://lore.kernel.org/r/20250321015806.954866-3-pandoh@google.com (local)
Signed-off-by: Karolina Stolarek <redacted>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/aer.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 73b03a195b14..06a7dda20846 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -788,15 +788,21 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
 	layer = AER_GET_LAYER_ERROR(aer_severity, status);
 	agent = AER_GET_AGENT(aer_severity, status);
 
-	pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask);
+	aer_printk(info.level, dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
+		   status, mask);
 	__aer_print_error(dev, &info);
-	pci_err(dev, "aer_layer=%s, aer_agent=%s\n",
-		aer_error_layer[layer], aer_agent_string[agent]);
+	aer_printk(info.level, dev, "aer_layer=%s, aer_agent=%s\n",
+		   aer_error_layer[layer], aer_agent_string[agent]);
 
 	if (aer_severity != AER_CORRECTABLE)
-		pci_err(dev, "aer_uncor_severity: 0x%08x\n",
-			aer->uncor_severity);
+		aer_printk(info.level, dev, "aer_uncor_severity: 0x%08x\n",
+			   aer->uncor_severity);
 
+	/*
+	 * pcie_print_tlp_log() uses KERN_ERR, but we only call it when
+	 * tlp_header_valid is set, and info.level is always KERN_ERR in
+	 * that case.
+	 */
 	if (tlp_header_valid)
 		pcie_print_tlp_log(dev, &aer->header_log, dev_fmt("  "));
There's another similar callsite but only this has the comment added. I 
was thinking if this call could be made from __aer_print_error(). There 
would be small change in order of messages but I can't seem to decide if 
it would be bad/good.
I guess the other caller is dpc_process_rp_pio_error(), which uses
pci_err() for other logging, so at least it matches the level used by
pcie_print_tlp_log().

This patch uses info.level to control the message level, and
pcie_print_tlp_log() doesn't look at info.level.  I added this comment
to explain why that's OK and the message level happens to match
already.  Maybe not super ideal long term.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help