Alexandru Elisei <alexandru.elisei@xxxxxxx> writes: > Hi Aneesh, > > Is this to fix Will's report that the series breaks boot on x86? > Yes. > On Mon, Apr 28, 2025 at 05:27:44PM +0530, Aneesh Kumar K.V (Arm) wrote: >> When KVM_RUN fails with EINTR or EAGAIN, we should retry the ioctl >> without checking kvm_run->exit_reason. These errors don't indicate a >> valid VM exit, hence exit_reason may contain stale or undefined values. > > EAGAIN is not documented in Documentation/virt/kvm/api.rst. So I'm going to > assume it's this code path that is causing the -EAGAIN return value [1]. > IIUC, EAGAIN and EINTR are syscall return errno that indicates a system call need to be retried. Documentation/virt/kvm/api.rst do mention that exit_reason is value only with return value 0. __u32 exit_reason; When KVM_RUN has returned successfully (return value 0), this informs application code why KVM_RUN has returned. > > If that's the case, how does retrying KVM_RUN solve the issue? Just trying to > get to the bottom of it, because there's not much detail in the docs. > > [1] https://elixir.bootlin.com/linux/v6.15-rc3/source/arch/x86/kvm/x86.c#L11532 > > So in that code path vcpu will be in kvm_vcpu_block(vcpu) waiting for the IPI. On IPI kvm_apic_accept_events() will return 0 after setting the vcpu->arch.mp_state. Hence a KVM_RUN ioctl again will find the mp_state correctly updated. -aneesh