Skip to contentSkip to conversation

PCI/AER: Print error message as per the TODO

PATCH Superseded Abhinav Jain 3 participants 5 messages Apr 15, 2024 – Jun 5, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/AER: Print error message as per the TODO

Add a pr_err() to print the add device error in find_device_iter()

---
 drivers/pci/pcie/aer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pcie/aer.c +2 -1
index ac6293c24976..0e1ad2998116 100644
@@ -885,7 +885,8 @@ static int find_device_iter(struct pci_dev *dev, void *data)
 		/* List this device */
 		if (add_error_device(e_info, dev)) {
 			/* We cannot handle more... Stop iteration */
-			/* TODO: Should print error message here? */
+			pr_err("find_device_iter: Cannot handle more devices.
+					Stopping iteration");
 			return 1;
 		}
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 1 line · Abhinav Jain

Add a pr_err() to print the add device error in find_device_iter()

[]

drivers/pci/pcie/aer.c

Quoted 1 line
drivers/pci/pcie/aer.c +0 -0

[]

drivers/pci/pcie/aer.c static int find_device_iter(struct pci_dev *dev, void *data) · line 889

Quoted 7 lines
drivers/pci/pcie/aer.c +2 -1
@@ -885,7 +885,8 @@ static int find_device_iter(struct pci_dev *dev, void *data)
 		/* List this device */
 		if (add_error_device(e_info, dev)) {
 			/* We cannot handle more... Stop iteration */
-			/* TODO: Should print error message here? */
+			pr_err("find_device_iter: Cannot handle more devices.
+					Stopping iteration");

You are adding unnecessary whitespace after the period. String concatenation keeps _all_ the whitespace.

The format is fine on a single line too.

Something like:

		pr_notice("%s: Cannot handle more devices - iteration stopped\n",
			  __func__);
#2 lore raw

PATCH v2 1/1 PCI/AER: Print error message as per the TODO

In reply to Abhinav Jain

Print the add device error in find_device_iter()

PATCH v1 link : https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Replaced pr_err() with pr_notice()
- Removed unncessary whitespaces

---
 drivers/pci/pcie/aer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pcie/aer.c +2 -2
index 0e1ad2998116..8b820a74dd6b 100644
@@ -885,8 +885,8 @@ static int find_device_iter(struct pci_dev *dev, void *data)
 		/* List this device */
 		if (add_error_device(e_info, dev)) {
 			/* We cannot handle more... Stop iteration */
-			pr_err("find_device_iter: Cannot handle more devices.
-					Stopping iteration");
+			pr_notice("%s: Cannot handle more devices - iteration stopped\n",
+					__func__);
 			return 1;
 		}
 
Signature · 1 line
2.34.1
#3 lore raw
Quoted 10 lines · Abhinav Jain

Print the add device error in find_device_iter()

PATCH v1 link : https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Replaced pr_err() with pr_notice()
- Removed unncessary whitespaces
---

Thanks for looking at this.

- It doesn't apply to -rc1 (the TODO message is missing). In PCI, we normally apply patches on topic branches based on -rc1.

- The subject should be more specific so it makes sense all by itself, e.g., "Log note if we find too many devices with errors"

- Add period at end of sentence in commit log.

- Move historical notes (v1 URL, changes since v1) below the "---" line so they don't get included in the commit log.

- __func__ is not relevant here -- that's generally a debugging thing. We can find the function by searching for the message text. In cases like this, I'd rather have something that helps identify a *device* that's related to the message, e.g., the pci_dev in this case. So I'd suggest pci_err(dev, "...") here.

- I'd keep pci_err() instead of switching to pr_notice(). If we get this message, we should re-think the way we collect this information, so I want to hear about it.

Quoted 21 lines
 drivers/pci/pcie/aer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pcie/aer.c +2 -2
index 0e1ad2998116..8b820a74dd6b 100644
@@ -885,8 +885,8 @@ static int find_device_iter(struct pci_dev *dev, void *data)
 		/* List this device */
 		if (add_error_device(e_info, dev)) {
 			/* We cannot handle more... Stop iteration */
-			pr_err("find_device_iter: Cannot handle more devices.
-					Stopping iteration");
+			pr_notice("%s: Cannot handle more devices - iteration stopped\n",
+					__func__);
 			return 1;
 		}
 
Signature · 1 line
2.34.1
#4 lore raw
Quoted 2 lines · Bjorn Helgaas

- It doesn't apply to -rc1 (the TODO message is missing). In PCI, we normally apply patches on topic branches based on -rc1.

Thank you for the detailed feedback. I was looking at mainline only.

Quoted 6 lines

- The subject should be more specific so it makes sense all by itself, e.g., "Log note if we find too many devices with errors"

- Add period at end of sentence in commit log.
- Move historical notes (v1 URL, changes since v1) below the "---" line so they don't get included in the commit log.

I have included these changes to the v3. Please find it here:
https://lore.kernel.org/all/[email protected]/

Quoted 9 lines

- __func__ is not relevant here -- that's generally a debugging thing. We can find the function by searching for the message text. In cases like this, I'd rather have something that helps identify a *device* that's related to the message, e.g., the pci_dev in this case. So I'd suggest pci_err(dev, "...") here.

- I'd keep pci_err() instead of switching to pr_notice(). If we get this message, we should re-think the way we collect this information, so I want to hear about it.

I understand, this helped me get a clear picture of what needs to be done. I have accordingly added two pci_err for the same. Please review.