New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guest does not boot when resuming before Linux boot #3658
Comments
@retrage Unfortunately i'm having trouble reproducing. Can you:
My hunch is that we're getting a vCPU process deadlock (like #3585) possibly around the same issue of pending virtio device barriers. |
Thank you for taking a look into this issue. Here is the full log and GDB output: |
Can you combine the log file and the serial output together (i.e. remove --log-file) so we can see the output from the fw interleaved with the log so we can see what the fw is doing when the pause/resume happens. |
@retrage I was able to reproduce with the debug build of rust-hypervisor-firmware. It looks like we end up in this tight loop: https://github.com/cloud-hypervisor/rust-hypervisor-firmware/blob/main/src/block.rs#L278-L281 // Check for the completion of the request
while unsafe { core::ptr::read_volatile(&state.used.idx) } != state.avail.idx {
core::sync::atomic::fence(core::sync::atomic::Ordering::Acquire);
} I think what is happening is that the asynchronous MMIO write to an ioeventfd is getting lost and the queue is not being processed resulting in the |
When running with rust-hypervisor-firmware which has a trivial virtio-block implementation it is necessary to try and process the queue as it does not use interrupts for knowing if the queue has been processed. Fixes: cloud-hypervisor#3658 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
@rbradford I confirmed it fixed with #3665. Thanks! |
As per this kernel documentation: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR, KVM_EXIT_XEN, KVM_EXIT_EPR, KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding operations are complete (and guest state is consistent) only after userspace has re-entered the kernel with KVM_RUN. The kernel side will first finish incomplete operations and then check for pending signals. The pending state of the operation is not preserved in state which is visible to userspace, thus userspace should ensure that the operation is completed before performing a live migration. Userspace can re-enter the guest with an unmasked signal pending or with the immediate_exit field set to complete pending operations without allowing any further instructions to be executed. Since we capture the state as part of the pause and override it as part of the resume we must ensure the state is consistent otherwise we will lose the results of the MMIO or PIO operation that caused the exit from which we paused. Fixes: cloud-hypervisor#3658 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
As per this kernel documentation: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR, KVM_EXIT_XEN, KVM_EXIT_EPR, KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding operations are complete (and guest state is consistent) only after userspace has re-entered the kernel with KVM_RUN. The kernel side will first finish incomplete operations and then check for pending signals. The pending state of the operation is not preserved in state which is visible to userspace, thus userspace should ensure that the operation is completed before performing a live migration. Userspace can re-enter the guest with an unmasked signal pending or with the immediate_exit field set to complete pending operations without allowing any further instructions to be executed. Since we capture the state as part of the pause and override it as part of the resume we must ensure the state is consistent otherwise we will lose the results of the MMIO or PIO operation that caused the exit from which we paused. Fixes: #3658 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
As per this kernel documentation: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR, KVM_EXIT_XEN, KVM_EXIT_EPR, KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding operations are complete (and guest state is consistent) only after userspace has re-entered the kernel with KVM_RUN. The kernel side will first finish incomplete operations and then check for pending signals. The pending state of the operation is not preserved in state which is visible to userspace, thus userspace should ensure that the operation is completed before performing a live migration. Userspace can re-enter the guest with an unmasked signal pending or with the immediate_exit field set to complete pending operations without allowing any further instructions to be executed. Since we capture the state as part of the pause and override it as part of the resume we must ensure the state is consistent otherwise we will lose the results of the MMIO or PIO operation that caused the exit from which we paused. Fixes: cloud-hypervisor#3658 Signed-off-by: Rob Bradford <robert.bradford@intel.com> (cherry picked from commit 5079123) Signed-off-by: Rob Bradford <robert.bradford@intel.com>
As per this kernel documentation: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR, KVM_EXIT_XEN, KVM_EXIT_EPR, KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding operations are complete (and guest state is consistent) only after userspace has re-entered the kernel with KVM_RUN. The kernel side will first finish incomplete operations and then check for pending signals. The pending state of the operation is not preserved in state which is visible to userspace, thus userspace should ensure that the operation is completed before performing a live migration. Userspace can re-enter the guest with an unmasked signal pending or with the immediate_exit field set to complete pending operations without allowing any further instructions to be executed. Since we capture the state as part of the pause and override it as part of the resume we must ensure the state is consistent otherwise we will lose the results of the MMIO or PIO operation that caused the exit from which we paused. Fixes: #3658 Signed-off-by: Rob Bradford <robert.bradford@intel.com> (cherry picked from commit 5079123) Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This issue appears when booting from firmware.
--kernel=hypervisor-fw
and--api-socket $API_SOCK
ch-remote --api-socket $API_SOCK pause
before starting Linuxch-remote --api-socket $API_SOCK resume
Both pause and resume command returns success, and the virtio devices are resuming as far as I see the log, but the guest does not boot after sending the resume.
CH version: cloud-hypervisor v21.0-67-g0dafd47a
Build command:
cargo build
VM configuration:
Log:
The text was updated successfully, but these errors were encountered: