All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: linux-pci@vger.kernel.org, Yury Murashka <yurypm@arista.com>,
	Matthew W Carlis <mattc@purestorage.com>,
	Zhenzhong Duan <zhenzhong.duan@intel.com>,
	Qingshun Wang <qingshun.wang@linux.intel.com>,
	Yicong Yang <yang.yicong@picoheart.com>,
	dio.sun@enflame-tech.com,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	Oliver OHalloran <oohall@gmail.com>,
	linuxppc-dev@lists.ozlabs.org,
	Terry Bowman <terry.bowman@amd.com>,
	Sathyanarayanan Kuppuswamy
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Arjun Govindjee <agovindjee@purestorage.com>,
	Ashish Karkare <ashishk@purestorage.com>,
	Jasjeet Rangi <jrangi@purestorage.com>,
	Meeta Saggi <msaggi@purestorage.com>,
	rhan@purestorage.com, sconnor@purestorage.com,
	an.luo@enflame-tech.com, fernando.hu@enflame-tech.com,
	bill.wu@enflame-tech.com, xin.wang@enflame-tech.com
Subject: Re: [PATCH] PCI/AER: Fix ratelimit and log level of Advisory Non-Fatal Errors
Date: Tue, 18 Aug 2026 17:33:20 -0500	[thread overview]
Message-ID: <20260818223320.GA754605@bhelgaas> (raw)
In-Reply-To: <120da0565eac0157ffd913423c7cfa66e985ff59.1786800931.git.lukas@wunner.de>

On Sat, Aug 15, 2026 at 03:47:10PM +0200, Lukas Wunner wrote:
> When Advisory Non-Fatal Errors are reported, the Uncorrectable Error bits
> should be reported using the same ratelimit counter and log level as the
> accompanying Correctable Error.
> 
> This is done correctly when they are handled natively in aer_print_error()
> but it is not done correctly when they are handled in Firmware First mode
> in pci_print_aer().
> 
> Fix it.
> 
> Fixes: 21963e6e4e04 ("PCI/AER: Support Advisory Non-Fatal Errors")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> The offending commit is the top-most one on pci/aer (queued for v7.3-rc1).
> This fix could either be folded into or applied on top of it.

Folded in, thanks!

>  drivers/pci/pcie/aer.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 2a380bb..dd2aa5d 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1028,13 +1028,15 @@ int cper_severity_to_aer(int cper_severity)
>  EXPORT_SYMBOL_GPL(cper_severity_to_aer);
>  #endif
>  
> -void pci_print_aer(struct pci_dev *dev, int aer_severity,
> -		   struct aer_capability_regs *aer)
> +static void __pci_print_aer(struct pci_dev *dev, int aer_severity,
> +			    struct aer_capability_regs *aer,
> +			    bool ratelimit_print, const char *level)
>  {
>  	const char *bus_type, *sev;
>  	int tlp_header_valid = 0;
>  	u32 status, mask;
>  	struct aer_err_info info = {
> +		.level = level,
>  		.severity = aer_severity,
>  		.first_error = PCI_ERR_CAP_FEP(aer->cap_control),
>  	};
> @@ -1043,12 +1045,10 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
>  		status = aer->cor_status;
>  		mask = aer->cor_mask;
>  		sev = "cor";
> -		info.level = KERN_WARNING;
>  	} else {
>  		status = aer->uncor_status;
>  		mask = aer->uncor_mask;
>  		sev = "uncor";
> -		info.level = KERN_ERR;
>  		tlp_header_valid = tlp_header_logged(status & ~mask,
>  						     aer->cap_control);
>  	}
> @@ -1067,7 +1067,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
>  	 * For Advisory Non-Fatal Errors, record statistics and tracing
>  	 * even if ratelimited
>  	 */
> -	if (!aer_ratelimit(dev, info.severity))
> +	if (!ratelimit_print)
>  		goto anfe;
>  
>  	aer_printk(info.level, dev,
> @@ -1094,10 +1094,25 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
>  		if (anfe_status) {
>  			aer->uncor_status = anfe_status;
>  			aer->uncor_mask = 0;
> -			pci_print_aer(dev, AER_NONFATAL, aer);
> +			__pci_print_aer(dev, AER_NONFATAL, aer,
> +					ratelimit_print, level);
>  		}
>  	}
>  }
> +
> +void pci_print_aer(struct pci_dev *dev, int aer_severity,
> +		   struct aer_capability_regs *aer)
> +{
> +	/*
> +	 * Precalculate ratelimit counter and log level so that Advisory
> +	 * Non-Fatal Errors are treated like the accompanying Correctable Error
> +	 */
> +	bool ratelimit_print = aer_ratelimit(dev, aer_severity);
> +	const char *level = aer_severity == AER_CORRECTABLE ? KERN_WARNING
> +							    : KERN_ERR;
> +
> +	__pci_print_aer(dev, aer_severity, aer, ratelimit_print, level);
> +}
>  EXPORT_SYMBOL_GPL(pci_print_aer);
>  
>  /**
> 
> base-commit: 21963e6e4e0425b12d3128eea5a5104a3bc909c4
> -- 
> 2.53.0
> 

      parent reply	other threads:[~2026-08-18 22:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-15 13:47 [PATCH] PCI/AER: Fix ratelimit and log level of Advisory Non-Fatal Errors Lukas Wunner
2026-08-15 13:52 ` sashiko-bot
2026-08-18 22:33 ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260818223320.GA754605@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=agovindjee@purestorage.com \
    --cc=an.luo@enflame-tech.com \
    --cc=ashishk@purestorage.com \
    --cc=bill.wu@enflame-tech.com \
    --cc=dio.sun@enflame-tech.com \
    --cc=fernando.hu@enflame-tech.com \
    --cc=jrangi@purestorage.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mahesh@linux.ibm.com \
    --cc=mattc@purestorage.com \
    --cc=msaggi@purestorage.com \
    --cc=oohall@gmail.com \
    --cc=qingshun.wang@linux.intel.com \
    --cc=rhan@purestorage.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sconnor@purestorage.com \
    --cc=terry.bowman@amd.com \
    --cc=xin.wang@enflame-tech.com \
    --cc=yang.yicong@picoheart.com \
    --cc=yurypm@arista.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.