From: Farhan Ali <alifm@linux.ibm.com>
To: "Markus Armbruster" <armbru@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
mjrosato@linux.ibm.com, farman@linux.ibm.com, cohuck@redhat.com,
alex@shazbot.org, Shameer Kolothum <skolothumtho@nvidia.com>
Subject: Re: [PATCH v4 2/4] vfio/pci: Add an error handler callback
Date: Wed, 2 Sep 2026 09:23:10 -0700 [thread overview]
Message-ID: <2bd79117-a66f-49b9-a936-592ad2e00ceb@linux.ibm.com> (raw)
In-Reply-To: <87ecfc3pj6.fsf@pond.sub.org>
On 9/2/2026 3:39 AM, Markus Armbruster wrote:
> Cédric Le Goater <clg@redhat.com> writes:
>
>> +Shameer, who is looking at forwarding AER errors to guest :
>>
>> https://lore.kernel.org/qemu-devel/SJ0PR12MB8614DDFEE3A9575564EDEF99ABFF2@SJ0PR12MB8614.namprd12.prod.outlook.com/
>>
>> On 8/31/26 20:31, Farhan Ali wrote:
>>> Provide a vfio error handling callback, that can be used by devices to
>>> handle PCI errors for passthrough devices.
>>>
>>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>>> ---
>>> hw/vfio/pci.c | 27 +++++++++++++++++++++------
>>> hw/vfio/pci.h | 1 +
>>> 2 files changed, 22 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>>> index 428ab2f069..a2f489b34d 100644
>>> --- a/hw/vfio/pci.c
>>> +++ b/hw/vfio/pci.c
>>> @@ -3244,21 +3244,36 @@ void vfio_pci_put_device(VFIOPCIDevice *vdev)
>>> static void vfio_err_notifier_handler(void *opaque)
>>> {
>>> VFIOPCIDevice *vdev = opaque;
>>> + Error *err = NULL;
>>>
>>> if (!event_notifier_test_and_clear(&vdev->err_notifier)) {
>>> return;
>>> }
>>>
>>> /*
>>> - * TBD. Retrieve the error details and decide what action
>>> - * needs to be taken. One of the actions could be to pass
>>> - * the error to the guest and have the guest driver recover
>>> - * from the error. This requires that PCIe capabilities be
>>> - * exposed to the guest. For now, we just terminate the
>>> + * We can retrieve the error details and decide what action
>>> + * needs to be taken in err_handler(). One of the actions could
>>> + * be to pass the error to the guest and have the guest driver
>>> + * recover from the error. This requires that PCIe capabilities be
>>> + * exposed to the guest.
>>> + *
>>> + * If err_handler() is not implemented/fails, we just terminate the
>>> * guest to contain the error.
>>> */
>>>
>>> - error_report("%s(%s) Unrecoverable error detected. Please collect any data possible and then kill the guest", __func__, vdev->vbasedev.name);
>>> + if (vdev->err_handler && vdev->err_handler(vdev, &err)) {
>>> + return;
>>> + }
>>> +
>>> + if (err) {
>>> + error_prepend(&err, "Unrecoverable PCIe error detected for device %s",
>>> + vdev->vbasedev.name);
> This requires use of ERRP_GUARD(). See "Why, when and how to use
> ERRP_GUARD()" in qapi/error.h.
okay, I can add the ERRP_GUARD(). AFAIU it will then look something like
this?
Error **errp = NULL;
ERRP_GUARD();
if (vdev->err_handler && vdev->err_handler(vdev, errp)) {
return;
}
if (*errp) {
//print error with errp
} else {
//generic error
}
Thanks
Farhan
next prev parent reply other threads:[~2026-09-02 16:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 18:31 [PATCH v4 0/4] Error recovery for zPCI passthrough devices Farhan Ali
2026-08-31 18:31 ` [PATCH v4 1/4] linux-headers: Update Linux header to 7.3-rc1 Farhan Ali
2026-08-31 18:31 ` [PATCH v4 2/4] vfio/pci: Add an error handler callback Farhan Ali
2026-09-02 8:07 ` Cédric Le Goater
2026-09-02 8:21 ` Shameer Kolothum Thodi
2026-09-02 10:39 ` Markus Armbruster
2026-09-02 16:23 ` Farhan Ali [this message]
2026-09-03 10:24 ` Markus Armbruster
2026-09-02 16:34 ` Farhan Ali
2026-09-03 12:08 ` Shameer Kolothum Thodi
2026-09-03 18:07 ` Farhan Ali
2026-09-04 9:58 ` Shameer Kolothum Thodi
2026-08-31 18:31 ` [PATCH v4 3/4] s390x/pci: Add PCI error handling for vfio pci devices Farhan Ali
2026-09-02 8:22 ` Cédric Le Goater
2026-09-02 16:43 ` Farhan Ali
2026-08-31 18:31 ` [PATCH v4 4/4] s390x/pci: Reset a device in error state Farhan Ali
2026-09-02 8:27 ` Cédric Le Goater
2026-09-02 16:48 ` Farhan Ali
2026-09-03 9:19 ` [PATCH v4 0/4] Error recovery for zPCI passthrough devices Cédric Le Goater
2026-09-03 17:55 ` Farhan Ali
2026-09-08 19:25 ` 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=2bd79117-a66f-49b9-a936-592ad2e00ceb@linux.ibm.com \
--to=alifm@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=armbru@redhat.com \
--cc=clg@redhat.com \
--cc=cohuck@redhat.com \
--cc=farman@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=skolothumtho@nvidia.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.