PCI/AER: Clean up logging
Subsystems (2)
cover PCI/AER: Clean up logging
From: Bjorn Helgaas <[email protected]>
Clean up some minor AER logging issues:
- Log as "Correctable errors", not "Corrected errors"
- Decode the Requester ID when we couldn't find detail error info
Bjorn Helgaas (3):
PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors PCI/AER: Decode Requester ID when no error info found PCI/AER: Use explicit register sizes for struct members
drivers/pci/pcie/aer.c | 19 ++++++++++++------- include/linux/aer.h | 8 ++++---- 2 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
From: Bjorn Helgaas <[email protected]>
The PCIe spec classifies errors as either "Correctable" or "Uncorrectable". Previously we printed these as "Corrected" or "Uncorrected". To avoid confusion, use the same terms as the spec.
One confusing situation is when one agent detects an error, but another agent is responsible for recovery, e.g., by re-attempting the operation. The first agent may log a "correctable" error but it has not yet been corrected. The recovery agent must report an uncorrectable error if it is unable to recover. If we print the first agent's error as "Corrected", it gives the false impression that it has already been resolved.
Sample message change:
- pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
--- drivers/pci/pcie/aer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/pcie/aer.c +3 -3
@@ -436,9 +436,9 @@ void pci_aer_exit(struct pci_dev *dev)* AER error strings */ static const char *aer_error_severity_string[] = { -"Uncorrected (Non-Fatal)" , -"Uncorrected (Fatal)" , -"Corrected" +"Uncorrectable (Non-Fatal)" , +"Uncorrectable (Fatal)" , +"Correctable" };static const char *aer_error_layer[] = {
Signature · 1 line
2.34.1
PATCH 2/3 PCI/AER: Decode Requester ID when no error info found
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info() prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but when find_source_device() finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.
Decode the Requester ID in the usual Linux format so it matches other messages.
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5
--- drivers/pci/pcie/aer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pcie/aer.c +7 -2
@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)u8 bus = info->id >>8 ;u8 devfn = info->id &0xff ; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
@@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent,pci_walk_bus (parent->subordinate, find_device_iter, e_info);if (!e_info->error_dev_num) { -pci_info (parent,"can't find device of ID%04x\n" , e_info->id); +u8 bus = e_info->id >>8 ; +u8 devfn = e_info->id &0xff ; + +pci_info (parent,"found no error details for %04x:%02x:%02x.%d\n" , +pci_domain_nr (parent->bus), bus,PCI_SLOT (devfn), +PCI_FUNC (devfn));return false; }return true;
Signature · 1 line
2.34.1
PATCH 3/3 PCI/AER: Use explicit register sizes for struct members
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
aer_irq() reads the AER Root Error Status and Error Source Identification (PCI_ERR_ROOT_STATUS and PCI_ERR_ROOT_ERR_SRC) registers directly into struct aer_err_source. Both registers are 32 bits, so declare the members explicitly as "u32" instead of "unsigned int".
Similarly, aer_get_device_error_info() reads the AER Header Log (PCI_ERR_HEADER_LOG) registers, which are also 32 bits, into struct aer_header_log_regs. Declare those members as "u32" as well.
No functional changes intended.
--- drivers/pci/pcie/aer.c | 4 ++-- include/linux/aer.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/pci/pcie/aer.c +2 -2
@@ -41,8 +41,8 @@#define AER_MAX_TYPEOF_UNCOR_ERRS 27/* as per PCI_ERR_UNCOR_STATUS*/ struct aer_err_source { -unsigned int status; -unsigned int id; +u32 status;/* PCI_ERR_ROOT_STATUS */ +u32 id;/* PCI_ERR_ROOT_ERR_SRC */ };struct aer_rpc {
include/linux/aer.h +4 -4
@@ -19,10 +19,10 @@struct pci_dev ;struct aer_header_log_regs { -unsigned int dw0; -unsigned int dw1; -unsigned int dw2; -unsigned int dw3; +u32 dw0; +u32 dw1; +u32 dw2; +u32 dw3; };struct aer_capability_regs {
Signature · 1 line
2.34.1
Re: [PATCH 1/3] PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
In reply to Bjorn HelgaasQuoted 13 lines · On Wed, 6 Dec 2023 16:42:29 -0600 Bjorn Helgaas <[email protected]> wrote:
From: Bjorn Helgaas <[email protected]>
The PCIe spec classifies errors as either "Correctable" or "Uncorrectable". Previously we printed these as "Corrected" or "Uncorrected". To avoid confusion, use the same terms as the spec.
One confusing situation is when one agent detects an error, but another agent is responsible for recovery, e.g., by re-attempting the operation. The first agent may log a "correctable" error but it has not yet been corrected. The recovery agent must report an uncorrectable error if it is unable to recover. If we print the first agent's error as "Corrected", it gives the false impression that it has already been resolved.
Quoted 6 lines
Sample message change:
- pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]
Good to tidy this up. FWIW
Re: [PATCH 2/3] PCI/AER: Decode Requester ID when no error info found
In reply to Bjorn HelgaasQuoted 16 lines · On Wed, 6 Dec 2023 16:42:30 -0600 Bjorn Helgaas <[email protected]> wrote:
From: Bjorn Helgaas <[email protected]>
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info()prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but whenfind_source_device()finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.Decode the Requester ID in the usual Linux format so it matches other messages.
Quoted 8 lines
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]>
LGTM
Re: [PATCH 3/3] PCI/AER: Use explicit register sizes for struct members
In reply to Bjorn HelgaasQuoted 7 lines · On Wed, 6 Dec 2023 16:42:31 -0600 Bjorn Helgaas <[email protected]> wrote:
From: Bjorn Helgaas <[email protected]>
aer_irq()reads the AER Root Error Status and Error Source Identification (PCI_ERR_ROOT_STATUSandPCI_ERR_ROOT_ERR_SRC) registers directly into structaer_err_source. Both registers are 32 bits, so declare the members explicitly as "u32" instead of "unsigned int".
Quoted 7 lines
Similarly,
aer_get_device_error_info()reads the AER Header Log (PCI_ERR_HEADER_LOG) registers, which are also 32 bits, into structaer_header_log_regs. Declare those members as "u32" as well.No functional changes intended.
Signed-off-by Bjorn Helgaas <[email protected]>
Another sensible cleanup. FWIW on such simple patches
Bjorn Helgaas
Applied[+cc Jonathan]
Quoted 8 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
Clean up some minor AER logging issues:
- Log as "Correctable errors", not "Corrected errors"
- Decode the Requester ID when we couldn't find detail error info
Quoted 8 lines
Bjorn Helgaas (3):
PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors PCI/AER: Decode Requester ID when no error info found PCI/AER: Use explicit register sizes for struct membersdrivers/pci/pcie/aer.c | 19 ++++++++++++------- include/linux/aer.h | 8 ++++---- 2 files changed, 16 insertions(+), 11 deletions(-)
Applied to pci/aer for v6.8. Thanks, Jonathan, for your time in taking a look.
Re: [PATCH 1/3] PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
In reply to Bjorn HelgaasHi Bjorn,
Will help prevent confusion. LGTM.
Quoted 40 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
The PCIe spec classifies errors as either "Correctable" or "Uncorrectable". Previously we printed these as "Corrected" or "Uncorrected". To avoid confusion, use the same terms as the spec.
One confusing situation is when one agent detects an error, but another agent is responsible for recovery, e.g., by re-attempting the operation. The first agent may log a "correctable" error but it has not yet been corrected. The recovery agent must report an uncorrectable error if it is unable to recover. If we print the first agent's error as "Corrected", it gives the false impression that it has already been resolved.
Sample message change:
- pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]>--- drivers/pci/pcie/aer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/pci/pcie/aer.c +3
-3@@ -436,9 +436,9 @@ void pci_aer_exit(struct pci_dev *dev)* AER error strings */ static const char *aer_error_severity_string[] = { -"Uncorrected (Non-Fatal)" , -"Uncorrected (Fatal)" , -"Corrected" +"Uncorrectable (Non-Fatal)" , +"Uncorrectable (Fatal)" , +"Correctable" };static const char *aer_error_layer[] = {
Re: [PATCH 2/3] PCI/AER: Decode Requester ID when no error info found
In reply to Bjorn HelgaasLGTM
Quoted 55 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info()prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but whenfind_source_device()finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.Decode the Requester ID in the usual Linux format so it matches other messages.
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]>--- drivers/pci/pcie/aer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/pci/pcie/aer.c +7
-2@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)u8 bus = info->id >>8 ;u8 devfn = info->id &0xff ; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),@@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent,pci_walk_bus (parent->subordinate, find_device_iter, e_info);if (!e_info->error_dev_num) { -pci_info (parent,"can't find device of ID%04x\n" , e_info->id); +u8 bus = e_info->id >>8 ; +u8 devfn = e_info->id &0xff ; + +pci_info (parent,"found no error details for %04x:%02x:%02x.%d\n" , +pci_domain_nr (parent->bus), bus,PCI_SLOT (devfn), +PCI_FUNC (devfn));return false; }return true;
Re: [PATCH 1/3] PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
In reply to Terry BowmanQuoted 3 lines · Terry Bowman
Hi Bjorn,
Will help prevent confusion. LGTM.
Thanks a lot for taking a look at these! I'd like to give you credit in the log, e.g., "Reviewed-by: Terry Bowman <[email protected]>", but I'm OCD enough that I don't want to translate "LGTM" into that all by myself.
If you want that credit (and, I guess, the privilege of being cc'd when we find that these patches break something :)), just reply again with that actual "Reviewed-by:" text in it.
Bjorn
Re: [PATCH 1/3] PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
No problem. You can add my "Reviewed-by". Thanks.
Regards,
Terry
Quoted 14 lines · Bjorn Helgaas
Quoted 3 lines · Terry Bowman
Hi Bjorn,
Will help prevent confusion. LGTM.
Thanks a lot for taking a look at these! I'd like to give you credit in the log, e.g., "Reviewed-by: Terry Bowman<[email protected]>", but I'm OCD enough that I don't want to translate "LGTM" into that all by myself.
If you want that credit (and, I guess, the privilege of being cc'd when we find that these patches break something :)), just reply again with that actual "Reviewed-by:" text in it.
Bjorn
Re: [PATCH 2/3] PCI/AER: Decode Requester ID when no error info found
In reply to Bjorn HelgaasQuoted 16 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info()prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but whenfind_source_device()finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.Decode the Requester ID in the usual Linux format so it matches other messages.
Quoted 8 lines
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]>
Except for the suggestion given below, it looks good to me.
Quoted 18 lines
--- drivers/pci/pcie/aer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/pci/pcie/aer.c +1
-1@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)u8 bus = info->id >>8 ;u8 devfn = info->id &0xff ; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
drivers/pci/pcie/aer.c static bool find_source_device(struct pci_dev *parent, · line 933
Quoted 6 lines
drivers/pci/pcie/aer.c +2
-1@@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent,pci_walk_bus (parent->subordinate, find_device_iter, e_info);if (!e_info->error_dev_num) { -pci_info (parent,"can't find device of ID%04x\n" , e_info->id); +u8 bus = e_info->id >>8 ; +u8 devfn = e_info->id &0xff ;
You can use PCI_BUS_NUM(e_info->id) for getting bus number. Since you are extracting this info in more than one place, maybe you can also define a macro PCI_DEVFN(id) (following PCI_BUS_NUM()).
Quoted 7 lines
drivers/pci/pcie/aer.c +4
-0+ +pci_info (parent,"found no error details for %04x:%02x:%02x.%d\n" , +pci_domain_nr (parent->bus), bus,PCI_SLOT (devfn), +PCI_FUNC (devfn));return false; }return true;
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Re: [PATCH 1/3] PCI/AER: Use 'Correctable' and 'Uncorrectable' spec terms for errors
In reply to Bjorn HelgaasQuoted 13 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
The PCIe spec classifies errors as either "Correctable" or "Uncorrectable". Previously we printed these as "Corrected" or "Uncorrected". To avoid confusion, use the same terms as the spec.
One confusing situation is when one agent detects an error, but another agent is responsible for recovery, e.g., by re-attempting the operation. The first agent may log a "correctable" error but it has not yet been corrected. The recovery agent must report an uncorrectable error if it is unable to recover. If we print the first agent's error as "Corrected", it gives the false impression that it has already been resolved.
Quoted 7 lines
Sample message change:
- pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5Signed-off-by Bjorn Helgaas <[email protected]>---
Looks good to me.
Quoted 20 lines
drivers/pci/pcie/aer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/pci/pcie/aer.c +3
-3@@ -436,9 +436,9 @@ void pci_aer_exit(struct pci_dev *dev)* AER error strings */ static const char *aer_error_severity_string[] = { -"Uncorrected (Non-Fatal)" , -"Uncorrected (Fatal)" , -"Corrected" +"Uncorrectable (Non-Fatal)" , +"Uncorrectable (Fatal)" , +"Correctable" };static const char *aer_error_layer[] = {
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Re: [PATCH 2/3] PCI/AER: Decode Requester ID when no error info found
In reply to Kuppuswamy SathyanarayananQuoted 24 lines · Kuppuswamy Sathyanarayanan
Quoted 23 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info()prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but whenfind_source_device()finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.Decode the Requester ID in the usual Linux format so it matches other messages.
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5
Quoted 5 lines
Quoted 1 line
Signed-off-by Bjorn Helgaas <[email protected]>Except for the suggestion given below, it looks good to me.
Reviewed-by Kuppuswamy Sathyanarayanan <[email protected]>
Thanks for taking a look!
Quoted 12 lines
Quoted 12 lines
drivers/pci/pcie/aer.c +1
-1@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)u8 bus = info->id >>8 ;u8 devfn = info->id &0xff ; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),@@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent,pci_walk_bus (parent->subordinate, find_device_iter, e_info);
Quoted 8 lines
drivers/pci/pcie/aer.c static bool find_source_device(struct pci_dev *parent, · line 933
Quoted 4 lines
drivers/pci/pcie/aer.c +2
-1if (!e_info->error_dev_num) { -pci_info (parent,"can't find device of ID%04x\n" , e_info->id); +u8 bus = e_info->id >>8 ; +u8 devfn = e_info->id &0xff ;You can use
PCI_BUS_NUM(e_info->id)for getting bus number. Since you are extracting this info in more than one place, maybe you can also define a macroPCI_DEVFN(id)(followingPCI_BUS_NUM()).
Thanks, both good ideas.
We already have a PCI_DEVFN() that *combines* slot + func into devfn, so we'd have to come up with a different name.
I'll add a patch to use PCI_BUS_NUM() in the two places here and in pme.c.
I think I'll wait with these until after the v6.7 release.
Quoted 10 lines
Quoted 6 lines
drivers/pci/pcie/aer.c +3
-0+pci_info (parent,"found no error details for %04x:%02x:%02x.%d\n" , +pci_domain_nr (parent->bus), bus,PCI_SLOT (devfn), +PCI_FUNC (devfn));return false; }return true;Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer