[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250521101527.000026b4@huawei.com>
Date: Wed, 21 May 2025 10:15:27 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Bjorn Helgaas <helgaas@...nel.org>
CC: <linux-pci@...r.kernel.org>, Jon Pan-Doh <pandoh@...gle.com>, "Karolina
Stolarek" <karolina.stolarek@...cle.com>, Weinan Liu <wnliu@...gle.com>,
Martin Petersen <martin.petersen@...cle.com>, Ben Fuller
<ben.fuller@...cle.com>, Drew Walton <drewwalton@...rosoft.com>, "Anil
Agrawal" <anilagrawal@...a.com>, Tony Luck <tony.luck@...el.com>, Ilpo
Järvinen <ilpo.jarvinen@...ux.intel.com>, Sathyanarayanan
Kuppuswamy <sathyanarayanan.kuppuswamy@...ux.intel.com>, Lukas Wunner
<lukas@...ner.de>, Sargun Dhillon <sargun@...a.com>, "Paul E . McKenney"
<paulmck@...nel.org>, Mahesh J Salgaonkar <mahesh@...ux.ibm.com>, Oliver
O'Halloran <oohall@...il.com>, Kai-Heng Feng <kaihengf@...dia.com>, Keith
Busch <kbusch@...nel.org>, Robert Richter <rrichter@....com>, "Terry Bowman"
<terry.bowman@....com>, Shiju Jose <shiju.jose@...wei.com>, "Dave Jiang"
<dave.jiang@...el.com>, <linux-kernel@...r.kernel.org>,
<linuxppc-dev@...ts.ozlabs.org>, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v7 03/17] PCI/AER: Factor COR/UNCOR error handling out
from aer_isr_one_error()
On Tue, 20 May 2025 16:50:20 -0500
Bjorn Helgaas <helgaas@...nel.org> wrote:
> From: Bjorn Helgaas <bhelgaas@...gle.com>
>
> aer_isr_one_error() duplicates the Error Source ID logging and AER error
> processing for Correctable Errors and Uncorrectable Errors. Factor out the
> duplicated code to aer_isr_one_error_type().
>
> aer_isr_one_error() doesn't need the struct aer_rpc pointer, so pass it the
> Root Port or RCEC pci_dev pointer instead.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
One passing comment inside (on neighbouring code)
Otherwise it is a sensible bit of cleanup.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> ---
> drivers/pci/pcie/aer.c | 36 +++++++++++++++++++++++-------------
> 1 file changed, 23 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index a1cf8c7ef628..568229288ca3 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1273,17 +1273,32 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info)
> }
>
> /**
> - * aer_isr_one_error - consume an error detected by Root Port
> - * @rpc: pointer to the Root Port which holds an error
> + * aer_isr_one_error_type - consume a Correctable or Uncorrectable Error
> + * detected by Root Port or RCEC
> + * @root: pointer to Root Port or RCEC that signaled AER interrupt
> + * @info: pointer to AER error info
> + */
> +static void aer_isr_one_error_type(struct pci_dev *root,
> + struct aer_err_info *info)
> +{
> + aer_print_port_info(root, info);
> +
> + if (find_source_device(root, info))
> + aer_process_err_devices(info);
> +}
> +
> +/**
> + * aer_isr_one_error - consume error(s) signaled by an AER interrupt from
> + * Root Port or RCEC
> + * @root: pointer to Root Port or RCEC that signaled AER interrupt
> * @e_src: pointer to an error source
> */
> -static void aer_isr_one_error(struct aer_rpc *rpc,
> +static void aer_isr_one_error(struct pci_dev *root,
> struct aer_err_source *e_src)
> {
> - struct pci_dev *pdev = rpc->rpd;
> struct aer_err_info e_info;
I wonder if, in the interests of readability this should be
initialized. That would allows some conditions to set
only the valid case (ones) rather than explicit zeros.
>
> - pci_rootport_aer_stats_incr(pdev, e_src);
> + pci_rootport_aer_stats_incr(root, e_src);
>
> /*
> * There is a possibility that both correctable error and
> @@ -1297,10 +1312,8 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
> e_info.multi_error_valid = 1;
> else
> e_info.multi_error_valid = 0;
> - aer_print_port_info(pdev, &e_info);
>
> - if (find_source_device(pdev, &e_info))
> - aer_process_err_devices(&e_info);
> + aer_isr_one_error_type(root, &e_info);
> }
>
> if (e_src->status & PCI_ERR_ROOT_UNCOR_RCV) {
> @@ -1316,10 +1329,7 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
> else
> e_info.multi_error_valid = 0;
>
> - aer_print_port_info(pdev, &e_info);
> -
> - if (find_source_device(pdev, &e_info))
> - aer_process_err_devices(&e_info);
> + aer_isr_one_error_type(root, &e_info);
> }
> }
>
> @@ -1340,7 +1350,7 @@ static irqreturn_t aer_isr(int irq, void *context)
> return IRQ_NONE;
>
> while (kfifo_get(&rpc->aer_fifo, &e_src))
> - aer_isr_one_error(rpc, &e_src);
> + aer_isr_one_error(rpc->rpd, &e_src);
> return IRQ_HANDLED;
> }
>
Powered by blists - more mailing lists