From: "Michael S. Tsirkin" <mst@redhat.com>
To: Xixin Liu <liuxixin@kylinos.cn>
Cc: linux-block@vger.kernel.org, virtualization@lists.linux.dev,
jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com,
axboe@kernel.dk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] virtio-pci: add error_detected for PCI AER recovery
Date: Sun, 2 Aug 2026 17:10:21 -0400 [thread overview]
Message-ID: <20260802165915-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <e2dda946e70e.v2.1785468000.git.liuxixin@kylinos.cn>
On Fri, Jul 31, 2026 at 11:17:00AM +0800, Xixin Liu wrote:
> virtio-pci only registered reset_prepare/reset_done. The PCI error
> recovery core treats devices without error_detected as NO_AER_DRIVER and
> does not deliver pci_channel_io_perm_failure to the driver after a failed
> recovery.
Maybe it should?
> Virtio devices therefore miss the normal ERS quiesce/teardown
> sequence.
>
> Register error_detected: quiesce on frozen (reset_prepare) before bus
> reset; on perm_failure break virtqueues and return DISCONNECT. Block-layer
> cleanup for virtio-blk is handled in the follow-up patch.
>
> Assisted-by: DeepSeek:deepseek-v3
> Signed-off-by: Xixin Liu <liuxixin@kylinos.cn>
> ---
> drivers/virtio/virtio_pci_common.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index 164f480b18a6..fff6b6e2d0c5 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -828,7 +828,37 @@ static void virtio_pci_reset_done(struct pci_dev *pci_dev)
> dev_warn(&pci_dev->dev, "Reset done failure: %d", ret);
> }
>
> +static pci_ers_result_t virtio_pci_error_detected(struct pci_dev *pci_dev,
> + pci_channel_state_t state)
> +{
> + struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
> +
> + /*
> + * PCI ERS error_detected: quiesce on frozen before bus reset; on
> + * permanent failure break virtqueues (follow-up may call driver
> + * .shutdown for block teardown).
block specifically? this is common code.
> + */
> + switch (state) {
> + case pci_channel_io_normal:
> + return PCI_ERS_RESULT_CAN_RECOVER;
> + case pci_channel_io_frozen:
> + pci_info(pci_dev, "frozen error detected, quiesce device\n");
> + if (virtio_device_reset_prepare(&vp_dev->vdev))
> + dev_warn(&pci_dev->dev, "frozen: reset prepare failed\n");
> + return PCI_ERS_RESULT_NEED_RESET;
so I guess pci will do slot reset? but what will call driver reset later? confused.
> + case pci_channel_io_perm_failure:
> + dev_warn(&pci_dev->dev,
> + "permanent failure, disconnecting device\n");
> + virtio_break_device(&vp_dev->vdev);
> + return PCI_ERS_RESULT_DISCONNECT;
> + default:
> + break;
> + }
> + return PCI_ERS_RESULT_NEED_RESET;
here, too, and we didn't virtio_device_reset_prepare either.
> +}
> +
> static const struct pci_error_handlers virtio_pci_err_handler = {
> + .error_detected = virtio_pci_error_detected,
> .reset_prepare = virtio_pci_reset_prepare,
> .reset_done = virtio_pci_reset_done,
> };
> --
> 2.43.0
next prev parent reply other threads:[~2026-08-02 21:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 2:00 [PATCH v1 0/2] virtio: PCI ERS permanent failure teardown for virtio-blk Xixin Liu
2026-06-10 6:20 ` [PATCH v1 1/2] virtio-pci: add error_detected for PCI AER recovery Xixin Liu
2026-06-12 10:00 ` [PATCH v1 2/2] virtio-blk: mark disk dead on ERS permanent failure Xixin Liu
2026-07-30 23:13 ` Michael S. Tsirkin
2026-07-31 3:29 ` Xixin Liu
2026-06-15 14:52 ` [PATCH v1 0/2] virtio: PCI ERS permanent failure teardown for virtio-blk Stefan Hajnoczi
2026-07-31 3:20 ` [PATCH v2 " Xixin Liu
2026-07-31 3:17 ` [PATCH v2 1/2] virtio-pci: add error_detected for PCI AER recovery Xixin Liu
2026-08-02 21:10 ` Michael S. Tsirkin [this message]
2026-08-07 6:15 ` Xixin Liu
2026-07-31 3:19 ` [PATCH v2 2/2] virtio-blk: mark disk dead on ERS permanent failure Xixin Liu
2026-08-02 20:59 ` Michael S. Tsirkin
2026-08-07 6:16 ` Xixin Liu
2026-08-06 1:20 ` [PATCH v3 0/2] virtio: PCI AER error_detected and virtio-blk shutdown Xixin Liu
2026-08-06 1:15 ` [PATCH v3 1/2] virtio-pci: add error_detected and slot_reset for AER Xixin Liu
2026-08-06 1:20 ` [PATCH v3 2/2] virtio-blk: add shutdown and fail queue_rq after VQ teardown Xixin Liu
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=20260802165915-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=axboe@kernel.dk \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuxixin@kylinos.cn \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox