mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Farhan Ali <alifm@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org
Cc: helgaas@kernel.org, lukas@wunner.de, alex@shazbot.org,
	clg@redhat.com, stable@vger.kernel.org, mjrosato@linux.ibm.com
Subject: Re: [PATCH v7 6/9] s390/pci: Store PCI error information for passthrough devices
Date: Tue, 20 Jan 2026 23:34:05 +0100	[thread overview]
Message-ID: <99b0c4dd03013226c8e3fa9dc6661f40fc1b0b88.camel@linux.ibm.com> (raw)
In-Reply-To: <20260107183217.1365-7-alifm@linux.ibm.com>

On Wed, 2026-01-07 at 10:32 -0800, Farhan Ali wrote:
> For a passthrough device we need co-operation from user space to recover
> the device. This would require to bubble up any error information to user
> space.  Let's store this error information for passthrough devices, so it
> can be retrieved later.
> 
> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
> ---
>  arch/s390/include/asm/pci.h      | 28 ++++++++++
>  arch/s390/pci/pci.c              |  1 +
>  arch/s390/pci/pci_event.c        | 95 +++++++++++++++++++-------------
>  drivers/vfio/pci/vfio_pci_zdev.c |  2 +
>  4 files changed, 88 insertions(+), 38 deletions(-)
> 
> 
--- snip ---
>  
> +static void zpci_store_pci_error(struct pci_dev *pdev,
> +				 struct zpci_ccdf_err *ccdf)
> +{
> +	struct zpci_dev *zdev = to_zpci(pdev);
> +	int i;
> +
> +	mutex_lock(&zdev->pending_errs_lock);
> +	if (zdev->pending_errs.count >= ZPCI_ERR_PENDING_MAX) {
> +		pr_err("%s: Maximum number (%d) of pending error events queued",
> +				pci_name(pdev), ZPCI_ERR_PENDING_MAX);

Nit: Here and in a few other places the alignment doesn't match the
open parenthesis. These are caught by checkpatch.pl with "--strict".
That also points out a couple of lines over 75 characters in commit
messages in this series.

> +		mutex_unlock(&zdev->pending_errs_lock);
> +		return;
> +	}
> +
> +	i = zdev->pending_errs.tail % ZPCI_ERR_PENDING_MAX;
> +	memcpy(&zdev->pending_errs.err[i], ccdf, sizeof(struct zpci_ccdf_err));
> +	zdev->pending_errs.tail++;
> +	zdev->pending_errs.count++;
> +	mutex_unlock(&zdev->pending_errs_lock);
> +}
> +
> +void zpci_cleanup_pending_errors(struct zpci_dev *zdev)
> +{
> +	struct pci_dev *pdev = NULL;
> +
> +	mutex_lock(&zdev->pending_errs_lock);
> +	pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
> +	if (zdev->pending_errs.count)
> +		pr_info("%s: Unhandled PCI error events count=%d",
> +				pci_name(pdev), zdev->pending_errs.count);

Nit: Align with open parenthesis (see above)

> +	memset(&zdev->pending_errs, 0, sizeof(struct zpci_ccdf_pending));
> +	pci_dev_put(pdev);

Yay, the previously missing pci_dev_put()

> +	mutex_unlock(&zdev->pending_errs_lock);
> +}
> +EXPORT_SYMBOL_GPL(zpci_cleanup_pending_errors);
> +
> 
--- snip ---
> @@ -210,12 +223,23 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
>  		goto out_unlock;
>  	}
>  
> +	if (needs_mediated_recovery(pdev))
> +		zpci_store_pci_error(pdev, ccdf);
> +
>  	ers_res = zpci_event_notify_error_detected(pdev, driver);
>  	if (ers_result_indicates_abort(ers_res)) {
>  		status_str = "failed (abort on detection)";
>  		goto out_unlock;
>  	}
>  
> +	if (needs_mediated_recovery(pdev)) {
> +		pr_info("%s: Leaving recovery of pass-through device to user-space\n",
> +				pci_name(pdev));

Nit: Code alignment

> +		ers_res = PCI_ERS_RESULT_RECOVERED;
> +		status_str = "in progress";
> +		goto out_unlock;
> +	}
> +

With the style issues fixed feel free to add my:

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>

  reply	other threads:[~2026-01-20 22:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07 18:32 [PATCH v7 0/9] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-01-07 18:32 ` [PATCH v7 1/9] PCI: Allow per function PCI slots Farhan Ali
2026-01-07 18:32 ` [PATCH v7 2/9] s390/pci: Add architecture specific resource/bus address translation Farhan Ali
2026-01-20 22:15   ` Niklas Schnelle
2026-01-07 18:32 ` [PATCH v7 3/9] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-01-19 21:23   ` Niklas Schnelle
2026-01-20 19:50     ` Farhan Ali
2026-01-20 22:12   ` Niklas Schnelle
2026-01-07 18:32 ` [PATCH v7 4/9] PCI: Add additional checks for flr reset Farhan Ali
2026-01-19 21:34   ` Niklas Schnelle
2026-01-07 18:32 ` [PATCH v7 5/9] s390/pci: Update the logic for detecting passthrough device Farhan Ali
2026-01-07 18:32 ` [PATCH v7 6/9] s390/pci: Store PCI error information for passthrough devices Farhan Ali
2026-01-20 22:34   ` Niklas Schnelle [this message]
2026-01-07 18:32 ` [PATCH v7 7/9] vfio-pci/zdev: Add a device feature for error information Farhan Ali
2026-01-19 16:24   ` Julian Ruess
2026-01-20 18:54     ` Farhan Ali
2026-01-07 18:32 ` [PATCH v7 8/9] vfio: Add a reset_done callback for vfio-pci driver Farhan Ali
2026-01-19 16:41   ` Julian Ruess
2026-01-07 18:32 ` [PATCH v7 9/9] vfio: Remove the pcie check for VFIO_PCI_ERR_IRQ_INDEX Farhan Ali
2026-01-19 16:56   ` Julian Ruess
2026-01-20 18:56     ` Farhan Ali
2026-01-15 18:28 ` [PATCH v7 0/9] Error recovery for vfio-pci devices on s390x Farhan Ali

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=99b0c4dd03013226c8e3fa9dc6661f40fc1b0b88.camel@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=alex@shazbot.org \
    --cc=alifm@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mjrosato@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®