On Fri, Jul 03, 2026 at 07:59:46AM -0600, Alex Williamson wrote: > > > On Fri, Jul 3, 2026, at 5:13 AM, Satyanarayana K V P wrote: > > Today, vfio-pci unconditionally stops the VM when any error event is > > reported by device. This prevents guest-driven error handling and recovery > > for platforms that support PCIe AER. > > > > This series adds an optional vfio-pci extension parameter, > > "x-forward-aer=on", to forward AER errors to the guest instead of > > forcing an immediate VM stop. If the endpoint supports AER, the error is > > forwarded directly; otherwise, checks the upstream PCIe bridge and > > forwards the error there when supported.If neither device nor PCIe bridge > > supports AER, the VM is immediately stopped when the error is reported. > > The error eventfd is signaled for err_detected in the host, this is the > beginning of the host error handling and the point at which drivers should > stop accessing the device until the resume callback. Letting the VMM > continue at this point does the opposite of that. Thanks, > > Alex
Hi, Today - the default error handler used by VFIO is not implementing the .resume() callback and just signals err_trigger and returns PCI_ERS_RESULT_CAN_RECOVER as part of .error_detected(). Qemu registers a callback to be called upon err_trigger signal (using one of the poll/select syscall variants), the callback calls vm_stop(RUN_STATE_INTERNAL_ERROR) - this is a runstate that can't continue, the VM is effectively killed (qemu needs to trigger VM reset to recover). The AER forward was proposed as a relatively simple opt-in mechanism to avoid hitting RUN_STATE_INTERNAL_ERROR and be able to handle errors for SR-IOV VFs using VFIO. For uncorrectable errors with SR-IOV, PF driver can be the entity that handles the device recovery. The VF driver needs to stop using the device until it is recovered by PF, and reinitialize any state that was lost as part of the recovery action. Forwarding AER would allow the VM to move forward without introducing any new uAPI. If we would want to build a generic error recovery mechanism, we would need to duplicate more of the err_handler_t callbacks as VFIO uAPI. If the recovery is handled by other entity running on the host (VFIO variant? Or for SR-IOV, the PF driver), we could also go into a different runstate (RUN_STATE_PAUSED? something that doesn't require full VM reset) and add a VFIO uAPI that can propagate the .resume() into userspace. If we would want the SW running inside the VM to handle the recovery... it becomes more involved, and it requires a more substantial solution that wasn't meant to be addressed here. So - we're letting the VMM continue but we're also informing it that something went wrong with the device, so that the SW running inside the VM can do its own action. If it's a virtual function, the driver can potentially fully recover after the host does its thing. If it's a regular native function, it will probably need to go into PCI_ERS_RESULT_DISCONNECT, which, for most usecases is still a better scenario then having to reset the entire VM. If we would want to absolutely make sure that the users are not able to issue any IO across error recovery, we can probably unmap (or zero-map) the BARs at VFIO driver level, similar to what's done during reset. Thanks, -Michał
