mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +00:00
hypervisor: kvm: Ignore -EINVAL from KVM_KVMCLOCK_CTRL ioctl()
If the guest hasn't initialised a PV clock then the KVM_KVMCLOCK_CTRL ioctl will return -EINVAL. Therefore if running in the firmware or an OS that doesn't use the PV clock then we should ignore that error Tested by migrating a VM that has not yet booted into the Linux kernel (just in firmware) by specifying no disk image: e.g. target/debug/cloud-hypervisor --kernel ~/workloads/hypervisor-fw --api-socket /tmp/api --serial tty --console off Fixes: #3586 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
b7b3b45364
commit
658658e76c
@ -1051,9 +1051,16 @@ impl cpu::Vcpu for KvmVcpu {
|
||||
/// potential soft lockups when being resumed.
|
||||
///
|
||||
fn notify_guest_clock_paused(&self) -> cpu::Result<()> {
|
||||
self.fd
|
||||
.kvmclock_ctrl()
|
||||
.map_err(|e| cpu::HypervisorCpuError::NotifyGuestClockPaused(e.into()))
|
||||
if let Err(e) = self.fd.kvmclock_ctrl() {
|
||||
// Linux kernel returns -EINVAL if the PV clock isn't yet initialised
|
||||
// which could be because we're still in firmware or the guest doesn't
|
||||
// use KVM clock.
|
||||
if e.errno() != libc::EINVAL {
|
||||
return Err(cpu::HypervisorCpuError::NotifyGuestClockPaused(e.into()));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
fn vcpu_init(&self, kvi: &VcpuInit) -> cpu::Result<()> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user