FAILED: patch "[PATCH] PCI/AER: Emit TLP Log only for unmasked errors" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x a8bf2dd750de7d682fdaa2127f4e3217ce9c4a82
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090327-shy-dealmaker-b70c@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a8bf2dd750de7d682fdaa2127f4e3217ce9c4a82 Mon Sep 17 00:00:00 2001
From: Lukas Wunner <[email protected]>
Date: Fri, 24 Jul 2026 17:24:04 +0200
Subject: [PATCH] PCI/AER: Emit TLP Log only for unmasked errors
Per PCIe r7.0 sec 6.2.5, the prefix and header of an offending TLP is only recorded for unmasked Uncorrectable Errors. Yet when the AER driver determines whether a prefix and header has been logged, it does not take the Uncorrectable Error Mask Register into account. Fix it.
drivers/pci/pcie/aer.c +3 -2
@@ -954,7 +954,8 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, status = aer->uncor_status; mask = aer->uncor_mask; info.level =KERN_ERR ; - tlp_header_valid =tlp_header_logged (status, aer->cap_control); + tlp_header_valid =tlp_header_logged (status & ~mask, + aer->cap_control); } info.status = status;
@@ -1343,7 +1344,7 @@ int aer_get_device_error_info(struct aer_err_info *info, int i)pci_read_config_dword (dev, aer +PCI_ERR_CAP , &aercc); info->first_error =PCI_ERR_CAP_FEP (aercc); -if (tlp_header_logged (info->status, aercc)) { +if (tlp_header_logged (info->status & ~info->mask, aercc)) { info->tlp_header_valid =1 ; pcie_read_tlp_log(dev, aer + PCI_ERR_HEADER_LOG, aer + PCI_ERR_PREFIX_LOG,
Sasha Levin
maintainerPATCH 1/6 PCI/AER: Simplify pci_print_aer()
From: Bjorn Helgaas <[email protected]>
[ Upstream commit ad9839137cf9fb0f0c2d531bd04bc4382e6f2de9 ]
Simplify pci_print_aer() by initializing the struct aer_err_info "info" with a designated initializer list (it was previously initialized with memset()) and using pci_name().
Stable-dep-of: a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors")
--- drivers/pci/pcie/aer.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/pci/pcie/aer.c +8 -8
@@ -763,7 +763,10 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, {int layer, agent, tlp_header_valid =0 ;u32 status, mask; -struct aer_err_info info; +struct aer_err_info info = { + .severity = aer_severity, + .first_error =PCI_ERR_CAP_FEP (aer->cap_control), + };if (aer_severity ==AER_CORRECTABLE ) { status = aer->cor_status;
@@ -774,14 +777,11 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, tlp_header_valid = status &AER_LOG_TLP_MASKS ; } - layer =AER_GET_LAYER_ERROR (aer_severity, status); - agent =AER_GET_AGENT (aer_severity, status); - -memset (&info,0 ,sizeof (info)); - info.severity = aer_severity; info.status = status; info.mask = mask; - info.first_error =PCI_ERR_CAP_FEP (aer->cap_control); + + 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_print_error (dev, &info);
@@ -795,7 +795,7 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity,if (tlp_header_valid)__print_tlp_header (dev, &aer->header_log); -trace_aer_event (dev_name (&dev->dev), (status & ~mask), +trace_aer_event (pci_name (dev), (status & ~mask), aer_severity, tlp_header_valid, &aer->header_log); }#endif
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/6 PCI/AER: Update statistics before ratelimiting
From: Bjorn Helgaas <[email protected]>
[ Upstream commit 88a7765e62b9e4c79c7ca2c7b749ae04f54a5668 ]
There are two AER logging entry points:
- aer_print_error() is used by DPC (dpc_process_error()) and native AER handling (aer_process_err_devices()).
- pci_print_aer() is used by GHES (aer_recover_work_func()) and CXL (cxl_handle_rdport_errors())
Both use __aer_print_error() to print the AER error bits. Previously __aer_print_error() also incremented the AER statistics via pci_dev_aer_stats_incr().
Call pci_dev_aer_stats_incr() early in the entry points instead of in __aer_print_error() so we update the statistics even if the actual printing of error bits is rate limited by a future change.
Stable-dep-of: a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors")
--- drivers/pci/pcie/aer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/pcie/aer.c +4 -1
@@ -692,7 +692,6 @@ static void __aer_print_error(struct pci_dev *dev,pci_printk (level, dev," [%2d] %-22s%s\n" , i, errmsg, info->first_error == i ?" (First)" :"" ); } -pci_dev_aer_stats_incr (dev, info); }void aer_print_error (struct pci_dev *dev,struct aer_err_info *info)
@@ -701,6 +700,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)int id =pci_dev_id (dev);const char *level; +pci_dev_aer_stats_incr (dev, info); +if (!info->status) {pci_err (dev,"PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n" , aer_error_severity_string[info->severity]);
@@ -780,6 +781,8 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, info.status = status; info.mask = mask; +pci_dev_aer_stats_incr (dev, &info); + layer =AER_GET_LAYER_ERROR (aer_severity, status); agent =AER_GET_AGENT (aer_severity, status);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/6 PCI/AER: Check log level once and remember it
In reply to Sasha LevinFrom: Karolina Stolarek <[email protected]>
[ Upstream commit c8f6791e33a7757025285db26f3b382cdcb7f7cd ]
When reporting an AER error, we check its type multiple times to determine the log level for each message. Do this check only in the top-level functions (aer_isr_one_error(), pci_print_aer()) and save the level in struct aer_err_info.
[bhelgaas: save log level in struct aer_err_info instead of passing it as a parameter]
[ Stable adaptation: Keep the 6.6 pci_printk(), __print_tlp_header(), cper_print_aer(), and aer_isr_one_error() implementations. Initialize the saved level in both branches of the existing interrupt handler and in the firmware and DPC paths, without importing the upstream handler refactors.
Prepare the two TLP header predicates for a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors"). This tree lacks tlp_header_logged() and the newer capability-dependent TLP logging support. Provide the predicate as a macro containing the existing AER_LOG_TLP_MASKS test, and name the capability-register value aercc. The capctl argument is intentionally unused because the legacy test is capability-independent. This preserves the supported error set and the existing four-DWORD header reads while allowing the target's two mask changes to merge cleanly. No functions or new PCIe logging capabilities are added. ]
Stable-dep-of: a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors")
--- drivers/pci/pci.h | 1 + drivers/pci/pcie/aer.c | 34 ++++++++++++++++++---------------- drivers/pci/pcie/dpc.c | 1 + 3 files changed, 20 insertions(+), 16 deletions(-)
drivers/pci/pci.h +1 -0
@@ -420,6 +420,7 @@ static inline bool pci_dev_is_added(const struct pci_dev *dev)struct aer_err_info {struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES ];int error_dev_num; +const char *level;/* printk level */ unsigned int id:16 ;
drivers/pci/pcie/aer.c +18 -16
@@ -93,6 +93,9 @@ struct aer_stats { PCI_ERR_UNC_UNX_COMP| \ PCI_ERR_UNC_MALF_TLP) +/* Only the legacy, capability-independent TLP header errors are supported. */ +#define tlp_header_logged (status, capctl) ((status) & AER_LOG_TLP_MASKS) +#define SYSTEM_ERROR_INTR_ON_MESG_MASK (PCI_EXP_RTCTL_SECEE| \ PCI_EXP_RTCTL_SENFEE| \ PCI_EXP_RTCTL_SEFEE)
@@ -668,21 +671,18 @@ static void __print_tlp_header(struct pci_dev *dev, t->dw0, t->dw1, t->dw2, t->dw3); } -static void __aer_print_error (struct pci_dev *dev, -struct aer_err_info *info) +static void __aer_print_error (struct pci_dev *dev,struct aer_err_info *info) {const char **strings;unsigned long status = info->status & ~info->mask; -const char *level, *errmsg; +const char *level = info->level; +const char *errmsg;int i; -if (info->severity ==AER_CORRECTABLE ) { +if (info->severity ==AER_CORRECTABLE ) strings = aer_correctable_error_string; - level =KERN_WARNING ; - }else { +else strings = aer_uncorrectable_error_string; - level =KERN_ERR ; - }for_each_set_bit (i, &status,32 ) { errmsg = strings[i];
@@ -698,7 +698,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) {int layer, agent;int id =pci_dev_id (dev); -const char *level; +const char *level = info->level;pci_dev_aer_stats_incr (dev, info);
@@ -711,8 +711,6 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) layer =AER_GET_LAYER_ERROR (info->severity, info->status); agent =AER_GET_AGENT (info->severity, info->status); - level = (info->severity ==AER_CORRECTABLE ) ?KERN_WARNING :KERN_ERR ; -pci_printk (level, dev,"PCIe Bus Error: severity=%s, type=%s, (%s)\n" , aer_error_severity_string[info->severity], aer_error_layer[layer], aer_agent_string[agent]);
@@ -772,10 +770,12 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity,if (aer_severity ==AER_CORRECTABLE ) { status = aer->cor_status; mask = aer->cor_mask; + info.level =KERN_WARNING ; }else { status = aer->uncor_status; mask = aer->uncor_mask; - tlp_header_valid = status &AER_LOG_TLP_MASKS ; + info.level =KERN_ERR ; + tlp_header_valid =tlp_header_logged (status, aer->cap_control); } info.status = status;
@@ -1062,7 +1062,7 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) {int type =pci_pcie_type (dev);int aer = dev->aer_cap; -int temp; +u32 aercc;/* Must reset in this function */ info->status =0 ;
@@ -1093,10 +1093,10 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)return 0 ;/* Get First Error Pointer */ -pci_read_config_dword (dev, aer +PCI_ERR_CAP , &temp); - info->first_error =PCI_ERR_CAP_FEP (temp); +pci_read_config_dword (dev, aer +PCI_ERR_CAP , &aercc); + info->first_error =PCI_ERR_CAP_FEP (aercc); -if (info->status &AER_LOG_TLP_MASKS ) { +if (tlp_header_logged (info->status, aercc)) { info->tlp_header_valid =1 ;pci_read_config_dword (dev, aer +PCI_ERR_HEADER_LOG , &info->tlp.dw0);
@@ -1147,6 +1147,7 @@ static void aer_isr_one_error(struct aer_rpc *rpc,if (e_src->status &PCI_ERR_ROOT_COR_RCV ) { e_info.id =ERR_COR_ID (e_src->id); e_info.severity =AER_CORRECTABLE ; + e_info.level =KERN_WARNING ;if (e_src->status &PCI_ERR_ROOT_MULTI_COR_RCV ) e_info.multi_error_valid =1 ;
@@ -1160,6 +1161,7 @@ static void aer_isr_one_error(struct aer_rpc *rpc,if (e_src->status &PCI_ERR_ROOT_UNCOR_RCV ) { e_info.id =ERR_UNCOR_ID (e_src->id); + e_info.level =KERN_ERR ;if (e_src->status &PCI_ERR_ROOT_FATAL_RCV ) e_info.severity =AER_FATAL ;
drivers/pci/pcie/dpc.c +1 -0
@@ -257,6 +257,7 @@ static int dpc_get_aer_uncorrect_severity(struct pci_dev *dev,else info->severity =AER_NONFATAL ; + info->level =KERN_ERR ;return 1 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/6 PCI/AER: Rename struct aer_stats to aer_info
In reply to Sasha LevinFrom: Karolina Stolarek <[email protected]>
[ Upstream commit 09683a6184ad6fd635831402316651392b56cc3a ]
Update name to reflect the broader definition of structs/variables that are stored (e.g. ratelimits). This is a preparatory patch for adding rate limit support.
[bhelgaas: "aer_report" -> "aer_info"]
Stable-dep-of: a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors")
--- drivers/pci/pcie/aer.c | 46 +++++++++++++++++++++--------------------- include/linux/pci.h | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-)
drivers/pci/pcie/aer.c +23 -23
@@ -50,8 +50,8 @@ struct aer_rpc { DECLARE_KFIFO(aer_fifo, struct aer_err_source, AER_ERROR_SOURCES_MAX); }; -/* AER stats for the device */ -struct aer_stats { +/* AER info for the device */ +struct aer_info {/* * Fields for all AER capable devices. They indicate the errors
@@ -372,7 +372,7 @@ void pci_aer_init(struct pci_dev *dev)if (!dev->aer_cap)return ; - dev->aer_stats =kzalloc (sizeof (struct aer_stats ),GFP_KERNEL ); + dev->aer_info =kzalloc (sizeof (*dev->aer_info),GFP_KERNEL );/* * We save/restore PCI_ERR_UNCOR_MASK, PCI_ERR_UNCOR_SEVER,
@@ -393,8 +393,8 @@ void pci_aer_init(struct pci_dev *dev)void pci_aer_exit (struct pci_dev *dev) { -kfree (dev->aer_stats); - dev->aer_stats =NULL ; +kfree (dev->aer_info); + dev->aer_info =NULL ; }#define AER_AGENT_RECEIVER 0
@@ -532,10 +532,10 @@ static const char *aer_agent_string[] = { { \unsigned int i; \struct pci_dev *pdev =to_pci_dev (dev); \ -u64 *stats = pdev->aer_stats->stats_array; \ +u64 *stats = pdev->aer_info->stats_array; \size_t len =0 ; \ \ -for (i =0 ; i <ARRAY_SIZE (pdev->aer_stats->stats_array); i++) {\ +for (i =0 ; i <ARRAY_SIZE (pdev->aer_info->stats_array); i++) { \if (strings_array[i]) \ len += sysfs_emit_at(buf, len, "%s %llu\n", \ strings_array[i], \
@@ -546,7 +546,7 @@ static const char *aer_agent_string[] = { i, stats[i]); \ } \ len +=sysfs_emit_at (buf, len,"TOTAL_%s %llu\n" , total_string, \ - pdev->aer_stats->total_field); \ + pdev->aer_info->total_field); \return len; \ } \static DEVICE_ATTR_RO (name)
@@ -567,7 +567,7 @@ aer_stats_dev_attr(aer_dev_nonfatal, dev_nonfatal_errs, char *buf) \ { \struct pci_dev *pdev =to_pci_dev (dev); \ -return sysfs_emit (buf,"%llu\n" , pdev->aer_stats->field); \ +return sysfs_emit (buf,"%llu\n" , pdev->aer_info->field); \ } \static DEVICE_ATTR_RO (name)
@@ -594,7 +594,7 @@ static umode_t aer_stats_attrs_are_visible(struct kobject *kobj,struct device *dev =kobj_to_dev (kobj);struct pci_dev *pdev =to_pci_dev (dev); -if (!pdev->aer_stats) +if (!pdev->aer_info)return 0 ; if ((a == &dev_attr_aer_rootport_total_err_cor.attr ||
@@ -618,25 +618,25 @@ static void pci_dev_aer_stats_incr(struct pci_dev *pdev,unsigned long status = info->status & ~info->mask;int i, max =-1 ;u64 *counter =NULL ; -struct aer_stats *aer_stats = pdev->aer_stats; +struct aer_info *aer_info = pdev->aer_info; -if (!aer_stats) +if (!aer_info)return ;switch (info->severity) {case AER_CORRECTABLE : - aer_stats->dev_total_cor_errs++; - counter = &aer_stats->dev_cor_errs[0 ]; + aer_info->dev_total_cor_errs++; + counter = &aer_info->dev_cor_errs[0 ]; max =AER_MAX_TYPEOF_COR_ERRS ;break ;case AER_NONFATAL : - aer_stats->dev_total_nonfatal_errs++; - counter = &aer_stats->dev_nonfatal_errs[0 ]; + aer_info->dev_total_nonfatal_errs++; + counter = &aer_info->dev_nonfatal_errs[0 ]; max =AER_MAX_TYPEOF_UNCOR_ERRS ;break ;case AER_FATAL : - aer_stats->dev_total_fatal_errs++; - counter = &aer_stats->dev_fatal_errs[0 ]; + aer_info->dev_total_fatal_errs++; + counter = &aer_info->dev_fatal_errs[0 ]; max =AER_MAX_TYPEOF_UNCOR_ERRS ;break ; }
@@ -648,19 +648,19 @@ static void pci_dev_aer_stats_incr(struct pci_dev *pdev,static void pci_rootport_aer_stats_incr (struct pci_dev *pdev,struct aer_err_source *e_src) { -struct aer_stats *aer_stats = pdev->aer_stats; +struct aer_info *aer_info = pdev->aer_info; -if (!aer_stats) +if (!aer_info)return ;if (e_src->status &PCI_ERR_ROOT_COR_RCV ) - aer_stats->rootport_total_cor_errs++; + aer_info->rootport_total_cor_errs++;if (e_src->status &PCI_ERR_ROOT_UNCOR_RCV ) {if (e_src->status &PCI_ERR_ROOT_FATAL_RCV ) - aer_stats->rootport_total_fatal_errs++; + aer_info->rootport_total_fatal_errs++;else - aer_stats->rootport_total_nonfatal_errs++; + aer_info->rootport_total_nonfatal_errs++; } }
include/linux/pci.h +1 -1
@@ -347,7 +347,7 @@ struct pci_dev {u8 hdr_type;/* PCI header type (`multi' flag masked out) */ #ifdef CONFIG_PCIEAER u16 aer_cap;/* AER capability offset */ -struct aer_stats *aer_stats;/* AER stats for this device */ +struct aer_info *aer_info;/* AER info for this device */ #endif #ifdef CONFIG_PCIEPORTBUS struct rcec_ea *rcec_ea;/* RCEC cached endpoint association */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/6 PCI/AER: Simplify add_error_device()
In reply to Sasha LevinFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit d72bae423004aa7b4d94c34a7fd0b48b64305a08 ]
Return -ENOSPC error early so the usual path through add_error_device() is the straightline code.
Stable-dep-of: a8bf2dd750de ("PCI/AER: Emit TLP Log only for unmasked errors")
--- drivers/pci/pcie/aer.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/pci/pcie/aer.c +9 -6
@@ -810,12 +810,15 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity,*/ static int add_error_device (struct aer_err_info *e_info,struct pci_dev *dev) { -if (e_info->error_dev_num <AER_MAX_MULTI_ERR_DEVICES ) { - e_info->dev[e_info->error_dev_num] =pci_dev_get (dev); - e_info->error_dev_num++; -return 0 ; - } -return -ENOSPC ; +int i = e_info->error_dev_num; + +if (i >=AER_MAX_MULTI_ERR_DEVICES ) +return -ENOSPC ; + + e_info->dev[i] =pci_dev_get (dev); + e_info->error_dev_num++; + +return 0 ; }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/6 PCI/AER: Emit TLP Log only for unmasked errors
In reply to Sasha LevinFrom: Lukas Wunner <[email protected]>
[ Upstream commit a8bf2dd750de7d682fdaa2127f4e3217ce9c4a82 ]
Per PCIe r7.0 sec 6.2.5, the prefix and header of an offending TLP is only recorded for unmasked Uncorrectable Errors. Yet when the AER driver determines whether a prefix and header has been logged, it does not take the Uncorrectable Error Mask Register into account. Fix it.
--- drivers/pci/pcie/aer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/pcie/aer.c +3 -2
@@ -775,7 +775,8 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, status = aer->uncor_status; mask = aer->uncor_mask; info.level =KERN_ERR ; - tlp_header_valid =tlp_header_logged (status, aer->cap_control); + tlp_header_valid =tlp_header_logged (status & ~mask, + aer->cap_control); } info.status = status;
@@ -1099,7 +1100,7 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)pci_read_config_dword (dev, aer +PCI_ERR_CAP , &aercc); info->first_error =PCI_ERR_CAP_FEP (aercc); -if (tlp_header_logged (info->status, aercc)) { +if (tlp_header_logged (info->status & ~info->mask, aercc)) { info->tlp_header_valid =1 ;pci_read_config_dword (dev, aer +PCI_ERR_HEADER_LOG , &info->tlp.dw0);
Signature · 1 line
2.53.0